[SOLVED] dhcp issue with KVM, LXC does not have the issue

RobFantini

Famous Member
May 24, 2012
2,037
107
133
Boston,Mass
Hello
we use pve enterprise repos all up to date.

dhcp server is isc-kea

we have fixed reservations set up at dhcp server based on mac address for some kvm's which are configured as dhcp clients in /etc/network/interfaces .
those kvms are not getting the reserved IP, instead they get an IP from the dhcp pool.

lxc does not have this issue.

I have been working on this for some hours . If anyone has a suggestion to fix or debug please send a communication .

Next I'll see if desktops have the same issue.
 
i have a kvm which does get the correct address from dhcp.

/etc/network/interfaces :
Code:
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback


here is what a kvm which does not get the correct address has:
Code:
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
 
allow-hotplug eth0
  iface eth0 inet dhcp
 
so I installed network-manager on the kvm and eliminated the eth0 part of interfaces. still not solved
both systems are running debian bookworm .
and on the same vlan.
 
The isc-dhcp-client is responsible on the Debian side to receive correct IP based on MAC. It is installed by default. But for some odd reason it is not:
apt install isc-dhcp-client

Tried to forcefully release and renew IP?:
dhclient -r <interface>
dhclient <interface>

Also check the content here to see if something is odd:
cat /var/lib/dhcp/dhclient.leases

With isc-dhcp-client, the interface simply receives the IP without fuss. It is as simple as it gets as you know.
 
Hello Wasim

Code:
# apt install isc-dhcp-client
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
isc-dhcp-client is already the newest version (4.4.3-P1-2).

Code:
# dhclient ens18
RTNETLINK answers: File exists

I think the issue is with kea-dhcp , or my configuration at kea-dhcp . It is strange that non debian systems do not have an issue.

Next I'll use this to try to see differences between centos and debian at the server using
Code:
sudo tcpdump -i eth0 port 67 or port 68 -e -n -vv
 
another question - is it possible to set the dhcp-relay for the pve vlans at the vmbr bridge or in network config? currently the relay is set at the switch which all the nodes are connected to.
 
this issue was caused by my deleting a couple of subnets from our network configuration system [ONA OpenNetAdmin IP Address Management (IPAM) system ] . after that the generated kea-dhcp4 configuration had some changes subnet id's ... so kea-dhcp say lease request coming in from a wrong network and rejected the request for a reservation. more detail is available at kea-users@lists.isc.org
 
another question - is it possible to set the dhcp-relay for the pve vlans at the vmbr bridge or in network config? currently the relay is set at the switch which all the nodes are connected to.
Yes, it is possible to setup dhcp-relay for vlans and offload it from the switch. The configuration is done at the Proxmox node itself. It does work, but I was never able to make it work without some glitches. The root cause was unknown. It was a specific environment with specific requirement.

It is done using isc-dhcp-relay package:
Code:
apt install isc-dhcp-relay

Configure DHCP relay using the config file in /etc/default/isc-dhcp-relay:
Code:
SERVERS="192.168.1.1"  # Replace with the IP of your DHCP server
INTERFACES="vmbr0.10 vmbr0.20"  # Replace with your VLAN interfaces
OPTIONS=""

Restart the relay:
Code:
systemctl restart isc-dhcp-relay

This works with both default Linux Bridge and openvswitch. The configuration of vlan in the /etc/network/interfaces remains the same. There is no specialty there. For default linux bridge (over simplified):
Code:
auto vmbr0
iface vmbr0 inet manual
    bridge-ports enp0s0
    bridge-stp off
    bridge-fd 0

# VLAN 10
auto vmbr0.10
iface vmbr0.10 inet manual
    vlan-raw-device vmbr0

# VLAN 20
auto vmbr0.20
iface vmbr0.20 inet manual
    vlan-raw-device vmbr0

For openvswitch (over simplified):
Code:
auto vmbr0
iface vmbr0 inet manual
    ovs_type OVSBridge
    ovs_ports enp0s0

auto enp0s0
iface enp0s0 inet manual
    ovs_bridge vmbr0
    ovs_type OVSPort

# VLAN 10
auto vmbr0.10
iface vmbr0.10 inet manual
    ovs_bridge vmbr0
    ovs_type OVSIntPort
    ovs_options tag=10

# VLAN 20
auto vmbr0.20
iface vmbr0.20 inet manual
    ovs_bridge vmbr0
    ovs_type OVSIntPort
    ovs_options tag=20


this issue was caused by my deleting a couple of subnets from our network configuration system [ONA OpenNetAdmin IP Address Management (IPAM) system ] . after that the generated kea-dhcp4 configuration had some changes subnet id's ... so kea-dhcp say lease request coming in from a wrong network and rejected the request for a reservation. more detail is available at kea-users@lists.isc.org
Glad it worked out!
 
Yes, it is possible to setup dhcp-relay for vlans and offload it from the switch. The configuration is done at the Proxmox node itself. It does work, but I was never able to make it work without some glitches. The root cause was unknown. It was a specific environment with specific requirement.

It is done using isc-dhcp-relay package:
Code:
apt install isc-dhcp-relay

Configure DHCP relay using the config file in /etc/default/isc-dhcp-relay:
Code:
SERVERS="192.168.1.1"  # Replace with the IP of your DHCP server
INTERFACES="vmbr0.10 vmbr0.20"  # Replace with your VLAN interfaces
OPTIONS=""

Restart the relay:
Code:
systemctl restart isc-dhcp-relay

This works with both default Linux Bridge and openvswitch. The configuration of vlan in the /etc/network/interfaces remains the same. There is no specialty there. For default linux bridge (over simplified):
Code:
auto vmbr0
iface vmbr0 inet manual
    bridge-ports enp0s0
    bridge-stp off
    bridge-fd 0

# VLAN 10
auto vmbr0.10
iface vmbr0.10 inet manual
    vlan-raw-device vmbr0

# VLAN 20
auto vmbr0.20
iface vmbr0.20 inet manual
    vlan-raw-device vmbr0

For openvswitch (over simplified):
Code:
auto vmbr0
iface vmbr0 inet manual
    ovs_type OVSBridge
    ovs_ports enp0s0

auto enp0s0
iface enp0s0 inet manual
    ovs_bridge vmbr0
    ovs_type OVSPort

# VLAN 10
auto vmbr0.10
iface vmbr0.10 inet manual
    ovs_bridge vmbr0
    ovs_type OVSIntPort
    ovs_options tag=10

# VLAN 20
auto vmbr0.20
iface vmbr0.20 inet manual
    ovs_bridge vmbr0
    ovs_type OVSIntPort
    ovs_options tag=20



Glad it worked out!

Hello Wasim.
currently in interfaces I do not have sections for each vlan. so no vmbr0.20 etc.
i do have this:
Code:
auto vmbr3
iface vmbr3 inet static
        address 10.1.10.2/24
        gateway 10.1.10.1
        bridge-ports bond3
        bridge-stp off
        bridge-fd 0
        bridge-vlan-aware yes
        bridge-vids 2-250
        mtu 9000

as I am using ' bridge-vids ' would I still need to put a vlan stanzas?

also do you recollect what the issues were using dhcp relay?

thanks for the assistance!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!