-
switch Internet
Hello everybody, can anybody tell me the script how can i switch internet from eth0 to eth1..i have Slackware Linux, and i have an integrated ethernet, and i puted an ethernet Cartela, but when i try to enable, immidiatly disable again..
With Respect AlterNAtiVi
-
The Internet is usually to be found behind the default gateway, which is defined in the routing table.
For example:
Code:
chris@angua:~$ route
Kernel IP routeing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
default router 0.0.0.0 UG 0 0 0 eth0
Destination default uses the eth0 interface on my computer. To switch them over (assuming everything else is set up correctly)
Code:
chris@angua:~$ sudo route del default gw router
chris@angua:~$ sudo route add default gw router eth1
chris@angua:~$ route
Kernel IP routeing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
192.168.1.0 * 255.255.255.0 U 0 0 0 eth0
default router 0.0.0.0 UG 0 0 0 eth1
Note the specification of eth1 on the 'route add' line. Also, my gateway is set up to be called 'router', you will need to replace instances of 'router' with the name or ip address of your gateway device.
The changes this makes will be lost at the next reboot. If you tell us which distribution you are using we can work out how to make it permanent.
Let us know how you get on,
Chris...