solamour l33t
Joined: 21 Dec 2004 Posts: 723 Location: San Diego, CA
|
Posted: Tue Sep 24, 2024 4:26 am Post subject: Can't start dnsmasq when libvirt is running |
|
|
My system has 2 network interfaces; enp1s0 is for connecting to the outside world and enp2s0 (whose IP is 192.168.1.254/24) is for the local network. I use dnsmasq to give dynamic IPs (192.168.1.100 ~ 192.168.1.200) to the local network machines. I also set up iptables with NAT, so that the local network machines can access the outside world.
Code: | +----------+ +----- machine1
Internet enp1s0 | | enp2s0 |
-----------------------+ gentoo +-------------+----- machine2
| | |
+----------+ +----- machine3 |
When I run libvirt for QEMU/KVM, dnsmasq gives me the following error message.
Code: | # rc-service dnsmasq start
* Starting dnsmasq ...
dnsmasq: failed to bind DHCP server socket: Address already in use
* start-stop-daemon: failed to start `/usr/sbin/dnsmasq'
* Failed to start dnsmasq [ !! ]
* ERROR: dnsmasq failed to start |
I see "6382/dnsmasq" is already listening to port 53 (possibly by libvirt).
Code: | # netstat -plnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 4041/Xvnc
tcp 0 0 192.168.100.254:53 0.0.0.0:* LISTEN 6382/dnsmasq <--
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2284/sshd: /usr/sbi
tcp6 0 0 :::5901 :::* LISTEN 4041/Xvnc
tcp6 0 0 :::22 :::* LISTEN 2284/sshd: /usr/sbi
# ps aux | grep [d]nsmasq
nobody 6382 0.0 0.0 2816 1536 ? S 16:36 0:00 /bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/network.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
root 6383 0.0 0.0 2816 1280 ? S 16:36 0:00 /bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/network.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper |
Is there a way to let libvirt hand out the IPs (192.168.100.100 ~ 192.168.100.200) to the virtual machines only, and I still get to manage the local network machines with dnsmasq?
__
sol |
|