You are not logged in.
I want to have dhcp to try to establish a network connection at boot time, but when there is no ethernet cable plugged in, or no wlan card, it takes up to 60 seconds before dhcp gives up.
So let's decrease the timeout.
Edit
/etc/dhcp/dhclient.conf
Search for the line
#timeout 60;
uncomment it and change it to the value (amount of amount of seconds) you like.
For example:
timeout 15;
That's it.
Note 1: If the dhcp server did not offer an ip address before the time out runs down. you wont get an established network connection!
Note 2: udhcpc can be a replacement for isc-dhcp-client and isc-dhcp-common. I noticed, that it times out very quickly by default, when it can not find any of the interfaces defined in /etc/network/interfaces
Thanks to ralph.ronnquist (rrq) for helping with the timeout issue and mentioning udhcpc in IRC.
Last edited by hacksenwerk (2025-03-16 14:55:41)
Offline
I want to have dhcp to try to establish a network connection at boot time, but when there is no ethernet cable plugged in, or no wlan card, it takes up to 60 seconds before dhcp gives up.
I use this with my laptop.
root@9600k:~# cat bin/lenovo_etc_network_interfaces
# This file describes the network interfaces available on your system
# 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
# The first card in the system added for devuan method of networking
# the pre-up is for stopping the annoying delay when the network cable is not connected.
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
pre-up ip link set eth0 up && sleep 1
pre-up [ $(cat /sys/class/net/eth0/carrier) -eq 1 ]
Forget where I got it when searching on the problem but it works perfectly every time it boots.
Offline
That's the important part I guess:
pre-up [ $(cat /sys/class/net/eth0/carrier) -eq 1 ]
But I don't understand it.
Where does the -eq option belongs to?
To the pre-up?
Last edited by hacksenwerk (2025-03-18 13:04:27)
Offline
[ $(cat /sys/class/net/eth0/carrier) -eq 1 ]
is a logical expression. True, if the ethernet-cable is connected.
Offline