How do I setup my routing tables to allow traffic between two subnets

I have a gateway box with two NIC's

1st NIC [eth0] is connected to my outgoing network side and DSL modem and has subnet

2nd NIC [eth2] is connected to internal LAN and is on subnet

Obviously from the gateway box I can connect to everything but how do I allow machines from the 192.168.124 subnet connect to the 192.168.0 subnet?

Current tables are (obscured real world IPs):

[root@eagle:~]# ip route
***.***.***.151 dev ppp0  proto kernel  scope link  src ***.****.***.120 dev eth0  proto kernel  scope link  src  metric 1 dev eth2  proto kernel  scope link  src  metric 1
default dev ppp0  scope link
[root@eagle:~]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
***.***.***.151 UH    0      0        0 ppp0   U     1      0        0 eth0   U     1      0        0 eth2         U     0      0        0 ppp0
  • This is a gateway and I have forwarding already set. What I want is a box on 192.168.124 to bet able to get to 192.168.0 which the gateway knows about. I guess I need rules on GW that most goes to inet except 192.168.0 – Adrian Cornish Mar 20 '15 at 3:54

Assuming ipv4 only: 1) as root,

echo 1 > /proc/sys/net/ipv4/ip_forward

2) as root add the line


to the file /etc/sysctl.conf

3) advice: setup a firewall. Firestarter is a good start.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.