Switching a Network Interface on and off

Gerald Combs gerald at ethereal.com
Fri Apr 5 15:14:53 CST 2002


On Red Hat systems, /sbin/ifdown and /sbin/ifup are probably preferable to
ifconfig - they're shell scripts that call the approprate 'ifconfig',
'route', and other commands for the specified interface.

On other more "standard" systems ifconfig is the "best practice" way of
fooling with your interface.

On Thu, 4 Apr 2002, Jonathan Hutchins wrote:

> 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