Find the answer to your Linux question:
Results 1 to 2 of 2
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2007
    Posts
    31

    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

  2. #2
    Linux Enthusiast
    Join Date
    Apr 2004
    Location
    UK
    Posts
    678
    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...
    To be good, you must first be bad. "Newbie" is a rank, not a slight.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •