ipsec and iptables
Marco,
I see your response to Andreas regarding ipsec and tables.
I have a similar problem/question.
I replaced RH9 with FC4 for my firewalls. Setting up the ipsec tunnel went fine. I can send packets between two private networks. However, when I enable NAT so that the internal nets can get to the internet, then the ipsec VPN fails.
Here is the configuration:
192.168.20.0/24(net)-->[192.168.20.2(gw)-->$PUBLICIP1 <firewall # 1>] .... internet
.... internet [<firewall # 2> $PUBLICIP2<--192.168.30.100(gw)<--192.168.30.0/24(net)
Without NAT, all packets can reach every destination internally. When I add the following to allow NAT to allow the internal machines access to the internet, packets are no longer routed to the opposite local net;
iptables -t nat -A POSTROUTING -d ! 192.168.30.0/24 -j SNAT --to-source $PUBLICIP1
How can I route outgoing packets going to 192.168.30.0/24 (opposite internal net) differently than packets going to other addresses????
TIA,
Mark
Mark L. Wise, President
Alpha II Service, Inc.
1312 Epworth Ave
Reynoldsburg, Ohio 43068-2116
614 868-5033 (Phone)
614 868-1060 (Fax)
Quoted 7 lines · Mark L. Wise
Here is the configuration:
192.168.20.0/24(net)-->[192.168.20.2(gw)-->$PUBLICIP1 <firewall # 1>] .... internet
.... internet [<firewall # 2> $PUBLICIP2<--192.168.30.100(gw)<--192.168.30.0/24(net)
Quoted 6 lines
Without NAT, all packets can reach every destination internally. When I add the following to allow NAT to allow the internal machines access to the internet, packets are no longer routed to the opposite local net;
iptables -t nat -A POSTROUTING -d ! 192.168.30.0/24 -j SNAT --to-source $PUBLICIP1
mhhh... what linux kernel version are you using? There are some know issue when you try to snat esp packet with linux < 2.6.15-git8
Quoted 2 lines
How can I route outgoing packets going to 192.168.30.0/24 (opposite internal net) differently than packets going to other addresses????
Try these rule:
iptables -t nat -A POSTROUTING -s 192.168.20.0/24 -d 192.168.30.0/24 -j ACCEPT iptables -t nat -A POSTROUTING --protocol esp -j ACCEPT (don't snat ipsec packets)
iptables -t nat -A POSTROUTING --protocol tcp -j SNAT --to-source $PUBLICIP1 iptables -t nat -A POSTROUTING --protocol udp -j SNAT --to-source $PUBLICIP1
Ciao