Quantcast
Channel: NAT a specific IP to go to ppp0 and others to go to eth0 coming from internal wifi interface - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 3

Answer by AlterX for NAT a specific IP to go to ppp0 and others to go to eth0 coming from internal wifi interface

$
0
0

I have resolved all. First the required iptables' rules are (these give access to the remote VPN's machines):

-A FORWARD -i wlan0 -o ppp0 -j ACCEPT
-A POSTROUTING -o ppp0 -j MASQUERADE

Then, to indicate which IP or range of IPs have to have a different route, you need policy rules:

  • open /etc/iproute2/rt_tables and put your entry (ID tablename):

    100   my_custom_table
    
  • ip rule add from 172.24.1.114/24 table my_custom_table (tells to go to another table other than the main one for the source IP 172.x.x.x)

  • ip route add 172.24.1.0/24 dev wlan0 table my_custom_table (required to receive packets back from ppp0)

  • ip route add default via 10.10.10.1 dev ppp0 table my_custom_table (routes packet to the VPN's gateway)

Make sure the firewall on the VPN server allows incoming traffic from VPN IPs.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>