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.
- 05-23-2012 #1Just Joined!
- Join Date
- May 2012
- Posts
- 2
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.
- 05-25-2012 #2Trusted Penguin
- Join Date
- May 2011
- Posts
- 3,673
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.:
Note: this change is not permanent across reboots, for that use system tools like sysctl.Code:echo 1 > /proc/sys/net/ipv4/ip_forward
then add a route forwarding traffic from one network to the other, e.g.:
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...Code:route add -net XXX.XXX.XXX.0 netmask 255.255.255.0 dev ethX
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.
- 05-25-2012 #3Just 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.


Reply With Quote
