[GH-ISSUE #8] Problem running on Ubuntu desktop #7

Closed
opened 2026-02-26 04:33:45 +03:00 by kerem · 6 comments
Owner

Originally created by @ghost on GitHub (Sep 26, 2016).
Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/8

It runs just fine on Ubuntu Server but thats not a suitable development environment.

When running on a Ubuntu Desktop its unable to start on port 53.

developer@Dev:~/Code/DnsServer$ sudo node app.js { Error: bind EADDRINUSE 0.0.0.0:53 at Object.exports._errnoException (util.js:1036:11) at exports._exceptionWithHostPort (util.js:1059:20) at dgram.js:221:18 at _combinedTickCallback (internal/process/next_tick.js:77:11) at process._tickCallback (internal/process/next_tick.js:98:9) at Module.runMain (module.js:592:11) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3 code: 'EADDRINUSE', errno: 'EADDRINUSE', syscall: 'bind', address: '0.0.0.0', port: 53 }

Listing processes on port 53 shows nothing:
lsof -i tcp:53

How have you setup your development environment?

Originally created by @ghost on GitHub (Sep 26, 2016). Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/8 It runs just fine on Ubuntu Server but thats not a suitable development environment. When running on a Ubuntu Desktop its unable to start on port 53. `developer@Dev:~/Code/DnsServer$ sudo node app.js { Error: bind EADDRINUSE 0.0.0.0:53 at Object.exports._errnoException (util.js:1036:11) at exports._exceptionWithHostPort (util.js:1059:20) at dgram.js:221:18 at _combinedTickCallback (internal/process/next_tick.js:77:11) at process._tickCallback (internal/process/next_tick.js:98:9) at Module.runMain (module.js:592:11) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3 code: 'EADDRINUSE', errno: 'EADDRINUSE', syscall: 'bind', address: '0.0.0.0', port: 53 } ` Listing processes on port 53 shows nothing: `lsof -i tcp:53` How have you setup your development environment?
kerem 2026-02-26 04:33:45 +03:00
Author
Owner

@mageddo commented on GitHub (Sep 26, 2016):

@fernfrost
Yes I did.

The solutions are two:

1 Find what program is starting a DNS server at your machine

You probably can not found with lsof -i tcp:53 because DNS servers uses UDP, Try the bellow to get the used port

netstat -anp | grep ":53"

In fact you can use this application running in another port (app.js:8 server.serve(53);) but by some tests that I've done linux could not understand a different port than 53.
This is link talking about how disable the default Linux DNS server, network manager(used by Fedora and Unbutu desktop version) that start a local DNS server (53 port).

2 Run it from docker

more details

To use this approach you will need docker and JAVA installed, because using docker the application will use a port inside the docker container where everything is free to be used.

I suggest for test that you run:

$ npm install
$ ./gradlew build

It will change your DNS files automatically(only while the docker containers is running, after everything backs to original stage) or run

$ npm install
$ ./gradlew build-dev

But it will not change your /etc/resolv.conf ( where you set your DNS servers) so you need to change manually. To change your /etc/resolv.conf do something like:

nameserver dockerip

To get the docker container ip you can run docker inspect dns-proxy-server

Testing it

Finally to test if it is working run nslookup dns.mageddo it need to be resolved by the dns-proxy-server

<!-- gh-comment-id:249701684 --> @mageddo commented on GitHub (Sep 26, 2016): @fernfrost Yes I did. The solutions are two: # 1 Find what program is starting a **DNS server** at your machine You probably can not found with `lsof -i tcp:53` because DNS servers uses UDP, Try the bellow to get the used port ``` netstat -anp | grep ":53" ``` In fact you can use this application running in another port (app.js:8 `server.serve(53);`) but by some tests that I've done linux could not understand a different port than **53**. [This](http://askubuntu.com/a/279539/258912) is link talking about how disable the default Linux DNS server, network manager(used by Fedora and Unbutu desktop version) that start a local DNS server (53 port). # 2 Run it from docker [more details](https://github.com/mageddo/dns-proxy-server/blob/master/README.md#running-on-docker) To use this approach you will need docker and JAVA installed, because using docker the application will use a port inside the docker container where everything is free to be used. I suggest for test that you run: ``` $ npm install $ ./gradlew build ``` It will change your DNS files automatically(only while the docker containers is running, after everything backs to original stage) or run ``` $ npm install $ ./gradlew build-dev ``` But it will not change your `/etc/resolv.conf` ( where you set your DNS servers) so you need to change manually. To change your `/etc/resolv.conf` do something like: ``` nameserver dockerip ``` To get the docker container ip you can run `docker inspect dns-proxy-server` # Testing it Finally to test if it is working run `nslookup dns.mageddo` it need to be resolved by the **dns-proxy-server**
Author
Owner

@mageddo commented on GitHub (Sep 26, 2016):

In fact gradle is not necessary to use docker, for this reason I've created the #2 issue that implements a docker-compose.yml but not implemented yet

<!-- gh-comment-id:249707191 --> @mageddo commented on GitHub (Sep 26, 2016): In fact gradle is not necessary to use docker, for this reason I've created the #2 issue that implements a docker-compose.yml but not implemented yet
Author
Owner

@ghost commented on GitHub (Sep 28, 2016):

Thank you.

running netstat -anp | grep ":53" on a fresh install of ubuntu desktop reveals that networkmanager listens to port 53 (though it is listed as dnsmasq)

I tried installing dnsmasq and setting the port=0.
This should according to documentation disable dns capabilities entirely.
But, alas, no success.

Running killall dnsmasq solved the problem but its not a good solution

I would like to utilize the dhcp capabilities of dnsmasq.

So is there a way of disable the built-in dns listening to port 53?

<!-- gh-comment-id:250189044 --> @ghost commented on GitHub (Sep 28, 2016): Thank you. running `netstat -anp | grep ":53"` on a fresh install of ubuntu desktop reveals that networkmanager listens to port 53 (though it is listed as dnsmasq) I tried installing dnsmasq and setting the port=0. This should according to documentation disable dns capabilities entirely. But, alas, no success. Running `killall dnsmasq` solved the problem but its not a good solution I would like to utilize the dhcp capabilities of dnsmasq. So is there a way of disable the built-in dns listening to port 53?
Author
Owner

@ghost commented on GitHub (Sep 28, 2016):

Actually, setting port=0 in /etc/dnsmasq.conf, took effect after a reboot.

So happy for now:)

<!-- gh-comment-id:250190539 --> @ghost commented on GitHub (Sep 28, 2016): Actually, setting port=0 in /etc/dnsmasq.conf, took effect after a reboot. So happy for now:)
Author
Owner

@ghost commented on GitHub (Sep 28, 2016):

Will request.address.address in handleRequest be the ip address of the device that made the request or will it always be 127.0.0.1?

Is there a way of testing this other than host some.domain on the local machine that always results in the request address being 127.0.0.1?

<!-- gh-comment-id:250196931 --> @ghost commented on GitHub (Sep 28, 2016): Will `request.address.address` in `handleRequest` be the ip address of the device that made the request or will it always be 127.0.0.1? Is there a way of testing this other than `host some.domain` on the local machine that always results in the request address being 127.0.0.1?
Author
Owner

@mageddo commented on GitHub (Sep 29, 2016):

I don't know how effective is the client IP identifier but testing with docker I did the follow:

  • Create two Ubuntu machines
  • Run the DNS server at one IP 172.21.0.4
  • Run the command host google.com 172.21.0.4 in the another
  • Result is: m=solve, requestFrom= 172.21.0.6 really is the client IP

To make some tests you can do the same or create two virtual machines with Virtualbox, configure a bridge network, run the DNS in one and test from another.

I am curious, Why did it is important for you?

<!-- gh-comment-id:250337981 --> @mageddo commented on GitHub (Sep 29, 2016): I don't know how effective is the client IP identifier but testing with docker I did the follow: - Create two Ubuntu machines - Run the DNS server at one IP 172.21.0.4 - Run the command `host google.com 172.21.0.4` in the another - Result is: `m=solve, requestFrom= 172.21.0.6` really is the client IP To make some tests you can do the same or create two virtual machines with Virtualbox, configure a bridge network, run the DNS in one and test from another. I am curious, Why did it is important for you?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/dns-proxy-server-mageddo#7
No description provided.