I am trying to setup a CentOS with 3 NIC and static routes.
eth0 has IP address 192.168.10.2 and GW:192.168.10.1,
eth1 has IP address 192.168.20.2 and GW:192.168.20.1,
eth2 has IP address 192.168.10.3 and GW:192.168.10.1.
I want to accept traffic on eth1 from other machines (I have set eth1 of my server as gateway for those client machines) and send it over eth2 and further to router and vice-versa(reverse path).
Added route to system as
ip route add default via 192.168.10.3 dev eth1 proto static metric 1024
Now I am facing problem like traffic is receiving on eth1 but not going through eth2. It look like going through eth0.
I do not want to use NAT or IPTABLES for now, is it possible to route traffic of eth1 to eth2 and vice versa.
Best Answer
You can turn on IP forwarding with
But that's only half the truth. Not using NAT means, that all hosts need to know which router (gateway) is serving which network. As an example a machine in 192.168.10.0/24, say 192.168.10.25, wishes to connect with a machine in 192.168.20.0/24, say 192.168.20.25, using 192.168.10.3 in one network & 192.168.20.2 in the other. The machine 192.168.10.25 needs this route
and the machine 192.168.20.25 needs
Alternatively, you could use NAT & IPTables
This way you only have to configure (assuming routes are in place) the router.