Routing Internet traffic through computer on another subnet

linux-networkingnetworkingroutingsubnet

Ubuntu box server has 2 network interfaces:

eth0 50.57.71.100
eth1 10.182.161.100

Ubuntu box client has 1 network interface:

eth0 10.177.30.100

server and client can already talk to each other just fine. Here is client's routing table:

10.176.0.0/12 via 10.177.0.1 dev eth0 
10.177.0.0/17 dev eth0  proto kernel  scope link  src 10.177.30.100
10.208.0.0/12 via 10.177.0.1 dev eth0 

I have enabled ipv4 forwarding on server's kernel. How can I set this up so any internet traffic from machine client gets routed through server? (like say, ping 8.8.8.8)

I tried adding a route on client but lost all network connectivity until I deleted it:

route add 10.182.161.100/32 dev eth0

I tried setting a client's default gateway to server but this fails:

# route add default gw 10.182.161.100
SIOCADDRT: No such process

Best Answer

If you want traffic from a network behind router 10.177.0.1 to go out through a different route (to server specifically), set the route up in 10.177.0.1 pointing to server.

This would direct all outgoing traffic that passes through 10.177.0.1 through server, and I am not sure that is what you want.

Related Topic