Ifup-ifdown

From Wiki

Jump to: navigation, search

ifup - ifdown

restart networking on a DHCP network.

ifdown eth0
ifup eth0

/etc/init.d/ifupdown eth0 :- this doesn't seem to properly deactivate and reactive the network with dhcp etc.

Manual restart of Networking eth0 etc.

As mentioned above, /etc/init.d/ifupdown doesn't fully deactive and reactive eth0, and instead just flushes it etc. In order to manually restart eth0, /etc/init.d/ifdown eth0 must be called. If this is done however and there is no physical access to the server - then, your network goes down and you cant reach your server. This is very very bad. A simple piped sleep ifdown ipup command can be called however. The command is:

sleep 90 | ifdown eth0 && ifup eth0

Check to see if a Network Link/Interface is up|down

ip link show eth0
//the iproute package is required. If there is no ip package, apt-get install iproute

If eth0 has a Network link, the following will be returned:
2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0c:29:26:57:4e brd ff:ff:ff:ff:ff:ff

If eth0 has no Network link, the following will be returned:
2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0c:29:26:57:4e brd ff:ff:ff:ff:ff:ff

The "UP" is the operative word.


More info at: http://learnlinux.tsf.org.za/courses/build/net-admin/ch05.html

Personal tools