2

So I am running a dev server for KVM virtual machines. I have a DHCP server running locally on the host node with the following configuration:

/etc/dhcp/dhcpd.conf

ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
option rfc3442-classless-static-routes code 121 = array of integer 8;
option ms-classless-static-routes code 249 = array of integer 8;

subnet xxx.xxx.x.0 netmask 255.255.255.0 {
 range xxx.xxx.x.2 xxx.xxx.x.127;
 option routers xxx.xxx.x.1;
 option broadcast-address xxx.xxx.x.255;
 option domain-name-servers 8.8.8.8;
 option netbios-name-servers 8.8.8.8;
 default-lease-time 86400;
 max-lease-time 86400;
 option rfc3442-classless-static-routes 24, xxx, xxx, x, 0, 0, 0, 0, 0, 0, xxx, xxx, x, 1;
 option ms-classless-static-routes 24, xxx, xxx, x, 0, 0, 0, 0, 0, 0, xxx, xxx, x, 1;
         host 102 {hardware ethernet 4A:19:BD:DF:B0:07;fixed-address xxx.xxx.x.5;}


 }

/etc/default/isc-dhcp-server

# Defaults for isc-dhcp-server initscript
# sourced by /etc/init.d/isc-dhcp-server
# installed at /etc/default/isc-dhcp-server by the maintainer scripts

#
# This is a POSIX shell fragment
#

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPD_CONF=/etc/dhcp/dhcpd.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPD_PID=/var/run/dhcpd.pid

# Additional options to start dhcpd with.
#       Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#       Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="vmbr0"

For reference, this is a debian 7 proxmox server.

The issue is, the server is assigned an IP via DHCP without issue. It gets xxx.xxx.x.5, however the gateway is set as 0.0.0.0 when viewed via route -n and the network therefore is not reachable.

Contents of VM network config file:

DEVICE=eth01
BOOTPROTO=dhcp 
ONBOOT=yes

invalid argument

In addition the there is an invalid argument error when it is getting information from DHCP, they might be related.

Error log on client:

enter image description here

  • Have you tried moving the 102 host definition block outside the subnet block? – Alpha01 Sep 27 '15 at 3:31
  • no change in the result – awmusic12635 Sep 27 '15 at 3:57
  • What do the logs say? – 030 Sep 27 '15 at 17:57
  • cl.ly/image/3j0A0H1m0O1M on the client – awmusic12635 Sep 27 '15 at 19:49
5
+50

It's difficult to troubleshoot remotely with limited information. But I'd like to try.

First, just a guess. Usually the DEVICE name is eth0 or eth1, not eth01. This might explain the "invalid argument error". Make sure you are dealing with the right NIC by ifconfig -a or ip link in the VM.

Another suspect is the static route. It should have 13 items in the array, instead of your 14. The format is <netmask>, <network-byte1>, <network-byte2>, <network-byte3>, <router-byte1>, <router-byte2>, <router-byte3>.... So it should look like this 24,192,168,1, 192,168,1,1, 0, 192,168,1,1. Take a look here. I guess the wrong static route overwrites the default gateway.

If that's not the problem, you need a process to debug. From your DHCP config, I assume vmbr0 is a Linux Bridge and VMs are created from there. You need to confirm the VM network is created right, by checking virt net-list and virt edit <vm> on the host/hyperviser. You can also use virt-manager. Make sure the VM has only one NIC, which is bridged from vmbr0.

If still not fixed, go into the VM and debug DHCP client. First, killall dhclient, and then run dhclient eth0 and monitor traffic with dhcpdump -i eth0 or tcpdump udp and port 67 or 68. Look for gateway options. Make sure there's no other DHCP server in the way. (Might be the default NAT from libvirt; or may be another DHCP server from outside, since you have a bridge). You can you can also run dhcpdump/tcpdump on the host where you have the DHCP server.

I hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.