Different private IP's to be SNAT'ed to different public IP's on different interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I have a NAT box which has one private interface (eth0) on which I
am running 2 different private IP ranges (192.168.2.0/24 and
192.168.3.0/24)

I have eth1 which is connected to an ADSL modem and I have eth2 which is
connected to a routable IP address

I would like to SNAT 192.168.2.0/24 to eth1 and 192.168.3.0/24 to eth2

I am able to SNAT 192.168.2.0/24 to the ADSL modem connected on eth1 but
I can't seem to get 192.168.3.0/24 to be SNAT to the routable IP address

I had the following iptables rules

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o ppp0 -j SNAT
--to-source $ADSL_IP

iptables -t nat -A POSTROUTING -s 192.168.3.0/24 -o eth2 -j SNAT
--to-source $ROUTABLE_ETHERNET_IP

The default route is set to go via the ADSL modem

Any suggestions, do I have to do some form of policy routing and marking
of packets prior to SNAT'ing them



[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux