Switching a Network Interface on and off

Jonathan Hutchins hutchins at opus1.com
Thu Apr 4 21:05:53 CST 2002


Is there a "best practice" way of switching a network interface on and off?
I'd like to be able to manually switch off, say, the interface to a given
subnet.

I have tried doing this using

# /sbin/ifconfig eth1 down

I can do that, and of course traffic from that card stops.  When I do

# /sbin/ifconfig eth1 up

everything comes back just fine - UNLESS I wait too long.

I haven't defined "too long" yet, but it appears to be somewhere between a
few minutes and half an hour or so.  If I wait too long, then while

# /sbin/ifconfig eth1 up

makes eth1 show up in both the output of  # /sbin/ifconfig and of  #
netstat -i, but the routing table entry shown by # netstat -r never recovers
the route to that network, and attempts to add it manually with the route
command yield "SIOCADDRT: No such device".

Basically, I have to restart the machine if I want the network back up.  Oh,
and "/etc/rc.d/init.d/network restart doesn't seem to work, it hangs on pump
trying to get an address for the gateway interface.

This is a fairly stock RedHat 6.2 box with the 2.2.14-5.0 kernel.




More information about the Kclug mailing list