debiandhcpproxmox

isc-dhcp-server soooo slow at startup


I've setup a Debian12 lxc container in my brand new proxmox instance, based on the base CT template given by proxmox (debian-12-standard_12.0-1_amd64.tar.zst). This container has two networks :

  1. eth0 : dhcp, attached to vmbr0 ; this is the default linux bridge to my realnetwork card which let me ssh into this container and give evasion to Internet (ip_forward=1)
  2. net1 : static IP 192.168.2.254/24, attached to vmbr1 ; it's a bridge with nothing (isolation) on which a vLan tag is applied. Modifying this point seems to have no impact on behaviour.

I've installed atftpd and isc-dhcp-server but dhcpd is soooo slow to startup :

real 2m50,345s
user 0m0,002s
sys 0m0,002s

Here's my dhcpd.conf :

option domain-name "homelab.lan";  
option domain-name-servers 193.110.81.0, 185.253.5.0;  
default-lease-time 600;  
max-lease-time 7200;  
ddns-update-style none;  
subnet 192.168.2.0 netmask 255.255.255.0 {  
    range 192.168.2.100 192.168.2.110;  
    option domain-name "homelab.lan";  
    option domain-name-servers 193.110.81.0, 185.253.5.0;  
    option routers 192.168.2.254;  
    option broadcast-address 192.168.2.255;  
    
    next-server 192.168.2.254;  # Serveur TFTP/PXE  
    filename "pxelinux.0";  
} 

When manually starting it (systemctl start), it works (dhcp gives an IP to another lxc container) but it's sooo slow. When rebooting, the service don't start (status : "Active: inactive (dead)")

Logs seems to be very clear : it tries at 22:27 to ifup net1 but fails and then wait for something before continuing at 22:29 :

==> /var/log/daemon.log <==
Aug 2 22:27:11 pxe systemd[1]: Starting Raise network interfaces...
Aug 2 22:27:11 pxe ifup[669]: RTNETLINK answers: File exists
Aug 2 22:27:11 pxe ifup[662]: ifup: failed to bring up net1
Aug 2 22:27:11 pxe systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Aug 2 22:27:11 pxe systemd[1]: networking.service: Failed with result 'exit-code'.
Aug 2 22:27:11 pxe systemd[1]: Failed to start Raise network interfaces.
Aug 2 22:29:44 pxe systemd[1]: ifupdown-wait-online.service: Main process exited, code=exited, status=1/FAILURE
Aug 2 22:29:44 pxe systemd[1]: ifupdown-wait-online.service: Failed with result 'exit-code'.
Aug 2 22:29:44 pxe systemd[1]: Failed to start Wait for network to be configured by ifupdown.
Aug 2 22:29:44 pxe systemd[1]: Reached target Network is Online.
Aug 2 22:29:44 pxe systemd[1]: Starting LSB: Launch atftpd server...
Aug 2 22:29:44 pxe systemd[1]: Starting LSB: DHCP server...
Aug 2 22:29:44 pxe systemd[1]: Starting Postfix Mail Transport Agent (instance -)...
Aug 2 22:29:44 pxe systemd[1]: Starting LSB: Start/stop rlinetd server...
Aug 2 22:29:44 pxe systemd[1]: Started LSB: Launch atftpd server.
Aug 2 22:29:44 pxe rlinetd[1139]: Starting internet superserver: rlinetd.
Aug 2 22:29:44 pxe systemd[1]: Started LSB: Start/stop rlinetd server.
Aug 2 22:29:44 pxe rlinetd[1152]: service tftp_udp enabled
Aug 2 22:29:44 pxe rlinetd[1152]: rlinetd configuration (re)loaded, 36320 bytes used
Aug 2 22:29:44 pxe isc-dhcp-server[1137]: Launching IPv4 server only.
Aug 2 22:29:44 pxe dhcpd[1173]: Wrote 1 leases to leases file.
Aug 2 22:29:44 pxe dhcpd[1173]: Server starting service.

Here's what's in /etc/network/interfaces

auto lo iface lo inet loopback

auto eth0 iface eth0 inet dhcp

auto net1 iface net1 inet static address 192.168.2.254/24 gateway 192.168.2.254

What the hell am I doing wrong ??

Thanks for your help :)


Solution

  • Not sure if this will solve all your problems but the default gateway is used when a destination IP is not in any of your subnets, normally you should only have one default gateway.

    The correct default gateway is probably provided by dhcp through eth0.

    You don't need another default gateway so remove the gateway setting for net1 in the interfaces file.