Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I have a CentOS Linux machine with two ethernet cards ( ipadddresses 192.168.1.1 and 192.168.1.2) . eth2 ip address is 192.168.1.1 eth3 ip adress is 192.168.1.2 Both the ports ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2012
    Posts
    2

    Exclamation Route traffic externally on two local interfaces


    Hi,
    I have a CentOS Linux machine with two ethernet cards ( ipadddresses 192.168.1.1 and 192.168.1.2) .

    eth2 ip address is 192.168.1.1
    eth3 ip adress is 192.168.1.2
    Both the ports are connected back to back using an ethernet cable.

    I want to route traffic externally( using an External Ethernet Cat5 cable) from one interface to another. Is it possible?

    I tried the following but that did not help

    >iproute add 192.168.1.2/32 dev eth2
    >iproute add 192.168.1.1/32 dev eth3
    >ping -I eth2 192.168.1.2

    This causes an ARP Request to go out from eth2. Eth3 receives this ARP Request but does not do anything with it . No ARP-REPLY ..

    Any help will be very highly appreciated.

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Do you mean you want to route traffic coming in from eth2 port out the eth3 port? if so, then the first thing i'd do is change one of the ip ranges to another private range, e.g.:

    eth2: 192.168.1.2
    eth3: 10.1.1.1

    then you'd have to enable IP forwarding in the kernel, e.g.:
    Code:
    echo 1 > /proc/sys/net/ipv4/ip_forward
    Note: this change is not permanent across reboots, for that use system tools like sysctl.

    then add a route forwarding traffic from one network to the other, e.g.:
    Code:
    route add -net  XXX.XXX.XXX.0 netmask 255.255.255.0 dev ethX
    substitute the right ip ranges and device name for whichever way you are routing. Note: i might have the syntax of that route command screwed up, it's been a while...

    then on a third machine you would need to make 192.168.1.2 or 10.1.1.1 your default router, and it should successfully be able to reach the network on the "other" side of your router.

  3. #3
    Just Joined!
    Join Date
    May 2012
    Posts
    2
    Thanks for your reply atreyu. No, I do not want to route/forward traffic from one interface to another. I want to send traffic from ETH1 <-> ETH2 but make sure it uses external wired connection instead of internal local interface ( 127.0.0.1) .
    In other words : I have to probe the traffic I am sending from ETH1 <-> ETH2 on an external router.

  4. $spacer_open
    $spacer_close

Posting Permissions

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