How to make dhclient run when wlan0 is brought back up (but already has an old address)

With the following configuration on Devuan Chimaera Linux:


auto wlan0
iface wlan0 inet dhcp
        pre-up /sbin/wpa_supplicant -B -Dwext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
        post-down /usr/bin/killall -q wpa_supplicant



dhclient only runs when the interface first comes up.

If I use ifconfig wlan0 down, the IP address is retained while down and ifconfig wlan0 up brings the interface back up without running dhclient.

Unfortunately I have a custom /etc/dhcp/dhclient-exit-hooks.d/wlan0-routes which adds custom routes, calculated from the default route provided by dhclient.

When I bring wlan0 down, the custom routes are lost, as expected.

When I bring wlan0 up, dhclient does not run and so the custom routes are not re-added.


There seems to be a difference in the behaviour of ifconfig wlan0 down (which caused this) and ifdown wlan0.

root@demo:~# ifconfig wlan0 down
root@demo:~# ip addr show wlan0 
9: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 00:0e:8e:4c:f6:a3 brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic wlan0
       valid_lft 7130sec preferred_lft 7130sec

root@demo5:~# ifconfig wlan0 up
root@demo5:~# ifdown wlan0
root@demo5:~# ip addr show wlan0 
9: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 00:0e:8e:4c:f6:a3 brd ff:ff:ff:ff:ff:ff

When I use ifdown wlan0 instead of ifconfig wlan0 down dhclient is called when I bring the interface up, and everything works as it ought.

What is the difference between ifconfig wlan0 down and ifdown wlan0?

Asked By: fadedbee



What is the difference between ‘ifconfig up eth0’ and ‘ifup eth0’?


An "ifconfig" command and "ifup" or "ifdown" command can activate network interfaces. "ifconfig" directly controls network interfaces, however "ifup" or "ifdown" executes "/etc/sysconfig/network-scripts/ifup-" or "ifdown-" scripts. The scripts use an ip command.

"ifconfig" and "ip" commands use ioctl() to activate or deactivate network interfaces. "ifconfig" flags network interfaces ‘IFF_UP | IFF_RUNNING’, however "ip" flags that ‘IFF_UP’.

An "ifconfig up eth0" activates eth0 but does not setup IP addresses, however an "ifup eth0" setup IP addresses or other options based by an ifcfg-eth0, because the "ifup" uses an "ifup-eth*" script.

The ifup command will also configure any static routes that are configured in the network-scripts directory. The ifconfig command will not.

Answered By: fadedbee

quoting from man:

the ifup and ifdown commands may be used to configure (or, respec-
tively, deconfigure) network interfaces based on interface definitions
in the files /etc/sysconfig/network and


Ifconfig is used to configure the kernel-resident network
interfaces. It is used at boot time to set up interfaces as
necessary. After that, it is usually only needed when debugging
or when system tuning is needed.

ifconfig is part of the net-tools (networking utilities)

i think it’s kind of an obsolete and deprecated tool replaced by iproute2

Answered By: D'Arcy Nader