Find the answer to your Linux question:
Results 1 to 2 of 2
hi, i have a system with 2 interfaces eth0, and eth1. eth0 is 192.168.0.250 and connected to gateway 192.168.0.2. eth1 is connected to 192.123.123.10 via a swtich. i am trying ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2011
    Posts
    13

    problem routing packets from one interface to another


    hi, i have a system with 2 interfaces eth0, and eth1. eth0 is 192.168.0.250 and connected to gateway 192.168.0.2.
    eth1 is connected to 192.123.123.10 via a swtich.

    i am trying to route packets from 192.123.123.10 to gateway 192.168.0.2, which means i need to route 192.123.123.x packets coming into eth1 interface out via eth0 interface.

    i set ip_forward file to 1.
    i ran this command:
    route add -net 192.123.0.0 netmask 255.255.255.0 dev eth0
    route add default gw 192.168.0.2

    i can ping from 129.123.123.10 to 192.168.0.250, but i can't ping to 192.168.0.2
    i think packets are not being forwarded to eth0.

    my routing table looks something like this:

    gteway Genmask Flags Ref Iface
    192.123.123.0 * 255.255.255.0 U eth1
    192.168.0.0 * 255.255.255.0 U eth0
    192.123.0.0 * 255.255.255.0 U eth0
    default 192.168.0.2 0.0.0.0 UG eth0

    can anyone tell me what is missing?
    thank you in advance.

  2. #2
    Just Joined!
    Join Date
    Apr 2005
    Posts
    5
    Hi markch,
    not totally sure what you are trying to do here.

    _eth0:192.168.0.250<------->Default:192.168.0.2 (assuming a router here).
    |
    PC
    |_eth1:192.123.123.10<----->Switch

    What is your switch connected to?

    From the pc you should be able to ping either interface and also the default gateway.
    Pinging the interfaces should always work as it never leaves the box itself.
    Pinging the default gateway will only work out of the eth0 as it is directly connected.
    If it is avaliable you should be able to ping it and see the arp address associated against eth0.
    using arping is a good way to verify.

    Code:
    arping -I eth0 192.168.0.2
    This should reply with something like reply from mac address xxx:xxx:xxx:xxx:xxx

    The route for the 192.123.0.0/16 out eith0 is not necessary unless you have another network in this range sitting behind the router.
    The connected more specific netowork 192.123.123.0/24 out eth1 is what will be used.

Posting Permissions

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