Find the answer to your Linux question:
Results 1 to 4 of 4
Hey everyone, here is my problem. My server is running Ubuntu, and has 2 working network interface cards. One of them is the wireless card I have connected to my ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Location
    Murder Mitten.
    Posts
    57

    Help creating a static route


    Hey everyone, here is my problem. My server is running Ubuntu, and has 2 working network interface cards. One of them is the wireless card I have connected to my internet connection (through router) to ISP. The other is going to an experimental cable modem I'm working on. My problem is this, once I activate eth0 (the cable modem interface), my computer seems to route ALL packets to that interface (eth0). For instance, with the eth0 interface up... the only page I am able to access is the modem config page http://192.168.100.1. If i disable my eth0 interface and restart however, my routes are back fine and I can access my normal areas.
    So what I believe I need is an IPTABLES rule firstly that specifies if the destination address is anywhere on the 192.168.100.0/24 subnet, it goes out eth0, anything destined anyplace else needs to go out eth1. If any IPTABLES guru's are out there and can help you would be much appreciated!
    Thanks

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,763
    Unless you are filtering something, you don't need any iptables rules at all.

    If your eth0 is on one subnet and eth1 is on another subnet and the default gateway is only reachable via eth0, that is the NIC that will be used.

    I suspect your issue is that eth0 and eth1 are not on different subnets. Fix that and you'll have no problems.

    With both NIC's up:

    Address info:
    > ifconfig -a

    Route info:
    > netstat -nr

  3. #3
    Just Joined!
    Join Date
    Nov 2007
    Location
    Murder Mitten.
    Posts
    57
    Well I keep my LAN on a different local subnet by default (255.255.255.12 and it's not possible for me to adjust my cable modem's Internal IP or Subnet info (eth0). However they are already different so I am having some other problem. To further shed light on this problem... from another compuer on my network (with a 192.x.x.x address) I am able to SSH to my server. When I try to SSH into the server from an external network it fails. Also any URL's I try to visit on the server fail. I posted my interface information below if it helps at all..

    After running netstat -nr and viewing the kernel routes (I keep forgetting about this command in linux lol doh) I think the problem is ovbious

    nimda@nimda-server:~$ netstat -nr
    Kernel IP routing table
    Destination Gateway Genmask Flags MSS Window irtt Iface
    192.168.1.0 0.0.0.0 255.255.255.128 U 0 0 0 eth1
    192.168.100.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    172.16.207.0 0.0.0.0 255.255.255.0 U 0 0 0 vmnet8
    169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
    0.0.0.0 192.168.100.1 0.0.0.0 UG 0 0 0 eth0

    It is using the 192.168.100.1 address for its default route! Thank you for reminding me that the kernel routing tables is different than IP tables. <3 I am going to try and switch the 0.0.0.0 to 192.168.1.1 and hopefully that will do me. If I have any more problems I will repost. Thanks again!!


    eth0 Link encap:Ethernet HWaddr 00:13:72:0E:0C:8F
    inet addr:192.168.100.11 Bcast:192.168.100.255 Mask:255.255.255.0
    inet6 addr: fe80::213:72ff:fe0e:c8f/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:13640 errors:0 dropped:0 overruns:0 frame:0
    TX packets:34620 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:100
    RX bytes:5634613 (5.3 MB) TX bytes:6650185 (6.3 MB)
    Base address:0xcce0 Memory:fe3e0000-fe400000

    eth1 Link encap:Ethernet HWaddr 00:17:3F:FE:B9:73
    inet addr:192.168.1.2 Bcast:192.168.1.127 Mask:255.255.255.128
    inet6 addr: fe80::217:3fff:fefe:b973/64 Scope:Link
    UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
    RX packets:265918 errors:29333 dropped:2621 overruns:0 frame:29101
    TX packets:393511 errors:604 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:46215691 (44.0 MB) TX bytes:369439494 (352.3 MB)

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Nov 2007
    Location
    Murder Mitten.
    Posts
    57
    Success, my problem has been fixed! The commands I used to do it were as follows...

    sudo route del default gateway 192.168.100.1 netmask 0.0.0.0 eth0
    sudo route add default gateway 192.168.1.1 netmask 0.0.0.0 eth1

    made my new routing table look like...
    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.1.0 * 255.255.255.128 U 0 0 0 eth1
    192.168.100.0 * 255.255.255.0 U 0 0 0 eth0
    172.16.207.0 * 255.255.255.0 U 0 0 0 vmnet8
    link-local * 255.255.0.0 U 1000 0 0 eth0
    default 192.168.100.1 0.0.0.0 UG 0 0 0 eth0

    NOW IT ALL WORKS!!! Hope if someone else has this problem they can learn from my mistakes. Thanks HROAdmin for your input and advice.

Posting Permissions

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