Changing net devices & routing problem

Robert Storey y2kbug at ms25.hinet.net
Mon Jan 31 00:24:53 UTC 2005


On Sat, 29 Jan 2005 23:31:26 -0500
Steve Snyder <swsnyder at insightbb.com> wrote:

> I want to switch on the fly between several network interfaces: eth0, 
> wlan0, and ppp0.  It is easy enough to take down one interface and
> bring up another.  The problem is that the routing table is not set
> correctly for the new interface.
> 
> If I specify "GATEWAY=192.168.0.1" in /etc/sysconfig/network then
> traffic is routed correctly for eth0 (my usual interface).  However
> that is innappropiate for either wlan0 or ppp0, and no packets are
> routed with this config in place.  If I do not specify the gateway,
> then it is eth0 that fails to route packets correctly.
> 
> How can I specify the default route on a per-interface basis?

Couldn't you do this with /sbin/ifconfig. Something like this will bring
up an interface:

/sbin/ifconfig eth0 192.168.0.2 netmask 255.255.255.0 gateway
192.168.0.1 up

You could then use the "route" command to reset the route. Once you get
it perfected, put it all in a script file so that you don't need to type
all this each time.

regards,
Robert




More information about the fedora-list mailing list