Commit 162fb24e authored by Alessandro Rubini's avatar Alessandro Rubini

userspace: run dhcpc in background forever, not through auto means

Running "ifup eth0" if eth0 is configured for dhcp would make the
client try a little while and then give up. Thus, if the dhcp server
is currently down we end up without IP address. This happens after a
power failure, if the switch reboots faster than the dhcp server.

Also, avoid ifplugd, that won't help in this case (the link is up,
so no "link up" will happen later.

This new configuration works in all cases:
     - eth0 is configured with a static address in /etc/network/interfaces
     - dhcp-driven, and link goes down and then up
     - dhcp-driven, and server not ready at boot time
     - dhcp-driven and all fine since boot time
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <>
parent bb1c0bad
......@@ -19,6 +19,7 @@
set -e
## NOTE: wr-switch-sw doesn't run ifplugd by default any more
if [ -z "$1" ] || [ -z "$2" ] ; then
echo "Wrong arguments" > /dev/stderr
exit 1
......@@ -3,17 +3,15 @@
# Start the network....
#echo "Management port MAC address: $MAC"
#ifconfig eth0 hw ether $MAC
#ifplugd -i eth0
#udhcpc -n
if grep -q '/ nfs' /proc/mounts; then
echo "Running via NFS, no ifplugd."
echo "Running via NFS: leaving eth0 config alone"
exit 0
if grep -v '#' /etc/network/interfaces | grep -q 'eth0.*dhcp'; then
# run dhcp client in background, as ifup would run in one-shot mode
udhcpc -b -i eth0
echo "Starting ifplugd..."
/usr/sbin/ifplugd -I -f -i eth0
#Pull up the interface (check static/dynamic config in /etc/network/interfaces)
ifup eth0
# ifup to use static parameters from /etc/netwrok/interfaces
ifup eth0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment