Instance with two NICs to route traffic
Hi ,
Need help setting up Ubuntu server as a router with two NICs to route traffic between two private subnets. Need to ping/connect from client1 to client2 via router instance.
Ex: Ubuntu Router Instance: nic1 10.2.1.8 nic2 192.168.1.4
Client1 nic1 10.2.1.6 gateway 10.2.1.8
Client2 nic1 192.168.1.6 gateway 192.168.1.4
Router Instance info:
sudo sysctl -p net.ipv4.ip_forward = 1
ubuntu@router-1:~$ ifconfig
eth0 Link encap:Ethernet HWaddr fa:16:3e:aa:c4:05
inet addr:10.2.1.8 Bcast:10.2.1.255 Mask:255.255.255.0
inet6 addr: fe80::f816:3eff:feaa:c405/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1454 Metric:1
RX packets:11466 errors:0 dropped:0 overruns:0 frame:0
TX packets:11410 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1121494 (1.1 MB) TX bytes:1317588 (1.3 MB)
eth1 Link encap:Ethernet HWaddr fa:16:3e:49:08:03
inet addr:192.168.1.4 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::f816:3eff:fe49:803/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4381 errors:0 dropped:0 overruns:0 frame:0
TX packets:4130 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:426279 (426.2 KB) TX bytes:381393 (381.3 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:17 errors:0 dropped:0 overruns:0 frame:0
TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1680 (1.6 KB) TX bytes:1680 (1.6 KB)
ubuntu@router-1:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.2.1.1 0.0.0.0 UG 0 0 0 eth0
10.2.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1