3 outside networks
Hi,
I need some help with iptables and SNAT.
I have one inside net 172.16.0.0/24 and 3 outside nets 10.28.0.0/16 ,
172.18.0.0/24 and Internet.
The 3 nets are routed by one router that i do not have control.
I have valid internet Addresses and i want to use NAT with one of them but not for 10.28 and 172.18 networks.
i tried this:
iptables -t nat -I POSTROUTING -o eth1 -d ! 10.28.0.0/16 -j SNAT --to MY.VALID.ADDR
iptables -t nat -I POSTROUTING -o eth1 -d ! 172.18.0.0/24 -j SNAT --to MY.VALID.ADDR
I guess that i need something like : "-d ! 10.28.0.0/16 OR ! 172.18.0.0./24"
but i dont know how to do that.
Can someone helpme ?
Thanks
Quoted 10 lines · Srinath Mantripragada
I have one inside net 172.16.0.0/24 and 3 outside nets 10.28.0.0/16 ,
172.18.0.0/24 and Internet.
The 3 nets are routed by one router that i do not have control.I have valid internet Addresses and i want to use NAT with one of them but not for 10.28 and 172.18 networks.
I guess that i need something like : "-d ! 10.28.0.0/16 OR !
172.18.0.0./24"
but i dont know how to do that.
Try this:
iptables -A POSTROUTING -t nat -d 10.28.0.0/16 -j ACCEPT iptables -A POSTROUTING -t nat -d 172.18.0.0/24 -j ACCEPT iptables -A POSTROUTING -t nat -j SNAT --to a.b.c.d
Antony.
Quoted 12 lines · Antony Stone
Quoted 10 lines · Srinath Mantripragada
I have one inside net 172.16.0.0/24 and 3 outside nets 10.28.0.0/16 ,
172.18.0.0/24 and Internet.
The 3 nets are routed by one router that i do not have control.I have valid internet Addresses and i want to use NAT with one of them but not for 10.28 and 172.18 networks.
I guess that i need something like : "-d ! 10.28.0.0/16 OR !
172.18.0.0./24"
but i dont know how to do that.
Quoted 5 lines
Try this:
iptables -A POSTROUTING -t nat -d 10.28.0.0/16 -j ACCEPT iptables -A POSTROUTING -t nat -d 172.18.0.0/24 -j ACCEPT iptables -A POSTROUTING -t nat -j SNAT --to a.b.c.d
Ooops ! That last one should inlcude the interface name too:
iptables -A POSTROUTING -t nat -o eth1 -j SNAT --to a.b.c.d
Antony.