I have a linux machine which has two ethernet ports. One interface eth0 is connected to public interface. And, other interface eth1 is connected to Wireless AP with private IP.

eth0: ip: 202.x.x.2 and gw: 202.x.x.1 eth1: ip and no gw defined in /etc/network/interfaces

Wireless Access Point: ip: is connected to eth1 of linux machine, and the IP address of other linux machine connecting to Access point is

I did following configuration in my first linux machine:

echo 200 custom >> /etc/iproute2/rt_tables ip rule add from table custom ip route add default via 202.x.x.1 dev eth0 table custom

I expect to browse internet from second linux machine. But, it is not working. Please help me to sort out this issue.

  • There's no need for policy-based routing in your setup, with just one default gateway and no other gateways. You probably just need to setup SNAT and enable forwarding in the kernel. – wurtel Nov 5 '15 at 15:34

Your Answer

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

Browse other questions tagged or ask your own question.