Find the answer to your Linux question:
Results 1 to 2 of 2
What am I doing wrong here... This is slackware 12. I'm trying to share my internet connection (on eth0) with a computer connected to eth1. eth0 is 192.168.0.101, eth1 is ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2010
    Posts
    16

    Can't set default gateway to different subnet


    What am I doing wrong here...
    This is slackware 12. I'm trying to share my internet connection (on eth0) with a computer connected to eth1.

    eth0 is 192.168.0.101, eth1 is 192.168.1.100 (different subnets).

    But when I try to make eth1's default gateway the same as eth0's, see the error I get:

    Code:
    # route add default gw 192.168.0.1 dev eth1
    SIOCADDRT: No such process
    This is supposed to work, per http colon slash slash lindesk.com/2007/04/internet-connection-sharing-using-iptables/

    more informational output follows....

    Code:
    # ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:07:E9:5C:77:81  
              inet addr:192.168.0.101  Bcast:192.168.0.255  Mask:255.255.255.0
              UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
    
    eth1      Link encap:Ethernet  HWaddr 00:08:C7:E6:F2:04  
              inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
              UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
    
    # route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    192.168.1.0     *               255.255.255.0   U     0      0        0 eth1
    192.168.0.0     *               255.255.255.0   U     0      0        0 eth0
    loopback        *               255.0.0.0       U     0      0        0 lo
    default         192.168.0.1     0.0.0.0         UG    0      0        0 eth0

  2. #2
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    As often google is really helpful:

    How to setup the PC as the Router ? - FedoraForum.org

    I blindly searched "howto configure computer as router". Your command above wouldn't work because it would add a second default route and one cannot have two default routes - think of it and you will understand why.

Posting Permissions

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