Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] listening port already in use, dnsmasq
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Treborius
Guru
Guru


Joined: 18 Oct 2005
Posts: 585
Location: Berlin

PostPosted: Tue Nov 05, 2019 10:52 am    Post subject: [Solved] listening port already in use, dnsmasq Reply with quote

i have 2 network interfaces


enp6s0: inet 192.168.178.111/24 brd 192.168.178.255 scope global enp6s0
wlp1s0u1: inet 192.168.100.1/32 scope global wlp1s0u1

i want sshd to listen on :
(1) enp6s0 on port 53 (facist firewall at work)
(2) wlp1s0u1 on port 22 (for home-subnet)

so i configured sshd (/etc/ssh/sshd_config) :
Code:

ListenAddress 192.168.178.111:53
ListenAddress 192.168.100.1:22


and i want dnsmasq to listen on port 53 in the private subnet (/etc/dnsmasq.conf)
Code:

interface=wlp1s0u1
listen-address=192.168.100.1


i can't imagine why this configuration shouldn't be possible,
anyway dnsmasq is complaining, that port 53 is in use :
Code:

dnsmasq: failed to create listening socket for port 53: Address already in use


here is the output of netstat
Code:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 192.168.178.111:53      0.0.0.0:*               LISTEN      10703/sshd
tcp        0      0 192.168.100.1:22        0.0.0.0:*               LISTEN      10703/sshd


any help would be highly appreciated
_________________
Systems running gentoo :
Desktop, Laptop, ZOTAC AD-10 media-center, odroid-xu4 server / wLan-router


Last edited by Treborius on Tue Nov 05, 2019 12:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3923
Location: Rasi, Finland

PostPosted: Tue Nov 05, 2019 11:53 am    Post subject: Reply with quote

192.168.100.1/32 network can only contain one address, which is invalid.

At least four addresses are needed:
  • .0 reserved for the network
  • computer 1
  • computer 2
  • and broadcast address, which is usually the last one.
... so maybe you meant to specify "192.168.100.1/30" instead?

I'd try to fix that first. Maybe it solves your problem?
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Treborius
Guru
Guru


Joined: 18 Oct 2005
Posts: 585
Location: Berlin

PostPosted: Tue Nov 05, 2019 11:59 am    Post subject: Reply with quote

i missed the following option in the dnsmasq configuration :

-z, --bind-interfaces
On systems which support it, dnsmasq binds the wildcard address, even when it is listening on only some interfaces. It then discards requests that it shouldn't reply to. This has the advantage of working even when interfaces come and go and change address. This option forces dnsmasq to really bind only the interfaces it is listening on. About the only time when this is useful is when running another nameserver (or another instance of dnsmasq) on the same machine. Setting this option also enables multiple instances of dnsmasq which provide DHCP service to run in the same machine.

Zucca wrote:
192.168.100.1/32 network can only contain one address, which is invalid.

At least four addresses are needed:
  • .0 reserved for the network
  • computer 1
  • computer 2
  • and broadcast address, which is usually the last one.
... so maybe you meant to specify "192.168.100.1/30" instead?

I'd try to fix that first. Maybe it solves your problem?


this is an error too, thanks for pointing it out
_________________
Systems running gentoo :
Desktop, Laptop, ZOTAC AD-10 media-center, odroid-xu4 server / wLan-router
Back to top
View user's profile Send private message
mike155
Advocate
Advocate


Joined: 17 Sep 2010
Posts: 4438
Location: Frankfurt, Germany

PostPosted: Tue Nov 05, 2019 3:56 pm    Post subject: Reply with quote

You probably use OpenRC, dont you? Be prepared that binding services to interfaces won't work when you switch to Systemd. It works if you use OpenRC and there's nothing wrong with it. But since nearly the whole world uses Systemd nowadays, and thus cannot use this technique, it might not be recommendable for OpenRC as well.
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3923
Location: Rasi, Finland

PostPosted: Fri Jan 24, 2020 10:48 am    Post subject: Reply with quote

I'm now having this same problem. :D

Except whatever I do, dnsmasq does listen to 0.0.0.0:domain. :evil:

mike155 wrote:
Be prepared that binding services to interfaces won't work when you switch to Systemd.
Ok. Why? Is binding to interfaces a bad practice?
_________________
..: Zucca :..

My gentoo installs:
init=/sbin/openrc-init
-systemd -logind -elogind seatd

Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum