0

I have some issue with dnsmasq. I'm trying to use the existing dhcp that is provide by my router to create a pxe server but dnsmasq give me an errror.

/etc/dnsmasq.conf :

port=0
log-dhcp
dhcp-range=192.168.0.0,proxy
dhcp-boot=pxelinux.0
pxe-service=x86PC,'Network Boot',pxelinux
enable-tftp
tftp-root=/tftpboot

the error :

● dnsmasq.service - DNS caching server.
   Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sat 2022-05-07 14:50:57 CEST; 1s ago
  Process: 22959 ExecStart=/usr/sbin/dnsmasq -k (code=exited, status=2)
 Main PID: 22959 (code=exited, status=2)

mai 07 14:50:57 host.dynamic.voo.be systemd[1]: Started DNS caching server..
mai 07 14:50:57 host.dynamic.voo.be dnsmasq[22959]: dnsmasq: failed to bind DHCP server socket: Address already in use
mai 07 14:50:57 host.dynamic.voo.be dnsmasq[22959]: failed to bind DHCP server socket: Address already in use
mai 07 14:50:57 host.dynamic.voo.be systemd[1]: dnsmasq.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
mai 07 14:50:57 host.dynamic.voo.be dnsmasq[22959]: FAILED to start up
mai 07 14:50:57 host.dynamic.voo.be systemd[1]: dnsmasq.service: Failed with result 'exit-code'.

The interface configuration :

2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 10:e7:c6:16:55:8b brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.100/24 brd 192.168.0.255 scope global noprefixroute eno1
       valid_lft forever preferred_lft forever
    inet6 2a02:2788:7d4:66b::9/128 scope global dynamic noprefixroute 
       valid_lft 912066sec preferred_lft 307266sec
    inet6 2a02:2788:7d4:66b:aca7:f9f4:3c57:9d62/64 scope global dynamic noprefixroute 
       valid_lft 1209592sec preferred_lft 604792sec
    inet6 fe80::7f8c:47f6:d123:7c38/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

My dhcp parameter on my router :

ip of my router : 192.168.0.1
1st address : 192.168.0.10
last address : 192.168.0.99
release time in sec : 604800

regards,

stickman

1 Answers1

0

In essence I do not see any real problems with your setup or config. I've tested if dnsmasq is able to start up OK with the provided .conf file and it can:

root@debian11-template:~# systemctl status dnsmasq.service
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
     Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-05-09 00:50:29 CEST; 6s ago
    Process: 13153 ExecStartPre=/etc/init.d/dnsmasq checkconfig (code=exited, status=0/SUCCESS)
    Process: 13160 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
    Process: 13168 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
   Main PID: 13167 (dnsmasq)
      Tasks: 1 (limit: 1129)
     Memory: 576.0K
        CPU: 28ms
     CGroup: /system.slice/dnsmasq.service
             └─13167 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service --trust-anchor=.,20326,8,2,e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8e>

May 09 00:50:29 debian11-template systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
May 09 00:50:29 debian11-template dnsmasq[13167]: started, version 2.85 DNS disabled
May 09 00:50:29 debian11-template dnsmasq[13167]: compile time options: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 no-Lua TFTP conntrack ipset auth cryptohash DNSSEC loop-detect inotify dumpfile
May 09 00:50:29 debian11-template dnsmasq-dhcp[13167]: DHCP, proxy on subnet 192.168.1.0
May 09 00:50:29 debian11-template dnsmasq-tftp[13167]: TFTP root is /tftpboot
May 09 00:50:29 debian11-template systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
root@debian11-template:~# cat /etc/dnsmasq.conf
port=0
log-dhcp
dhcp-range=192.168.1.0,proxy
dhcp-boot=pxelinux.0
pxe-service=x86PC,'Network Boot',pxelinux
enable-tftp
tftp-root=/tftpboot
root@debian11-template:~# ss -tlnp|grep dnsm
root@debian11-template:~# ss -tlnp|grep dns
root@debian11-template:~# ss -ulnp|grep dns
UNCONN 0      0            0.0.0.0:4011      0.0.0.0:*    users:(("dnsmasq",pid=13167,fd=5))
UNCONN 0      0            0.0.0.0:67        0.0.0.0:*    users:(("dnsmasq",pid=13167,fd=4))
UNCONN 0      0            0.0.0.0:69        0.0.0.0:*    users:(("dnsmasq",pid=13167,fd=7))
UNCONN 0      0               [::]:69           [::]:*    users:(("dnsmasq",pid=13167,fd=8))

Please know that dhcp-range was adjusted to fit my IP subnet.

Roman Spiak
  • 519
  • 2
  • 9