iptables and SPI...
Thx for trying to help me Harald :)
what i'm trying to do is to perform NAT based on IP_addresses/Ports/SPIs.
The situation would be different users NATted by a common local gateway (all the users are located on the same private network), making each one an IPsec tunnel (using ESP) to the same remote gateway.
The different tunnels start from each user, go through the local gateway (which NATts the users) and end at the remote gateway.
The problem for the local gateway is to NAT the different VPN, based on the private IP adresses of the users, the ports used (port 50 for ESP...) and the SPIs (in order to distinguish the different tunnels).
The problem is not for the chosen ipsec implementation since the local gateway only NATts and forwards the ispec packets. But with the current version of iptables, is it possible for the local gateway to perform NAT based on the SPIs (and @IP and ports...) ? (i saw that extracting the SPI from the ESP header is possible thx to last p-o-m... but NAT with it ?)
I hope this explanation is more understandable :-/ Thx very much for your help !!
Regards,
dimo
_________________________________________________________________
Trouvez l'âme soeur sur MSN Rencontres http://g.msn.fr/FR1000/9551
Quoted 1 line · dimitri borjac
what i'm trying to do is to perform NAT based on IP_addresses/Ports/SPIs.
Why not simply using a IP-Sec implementation supporting the NAT-Transversal standard?
IP-Sec is generally not very happy about being NAT:ed. For examle AH is totally incompatible with NAT (unless using the NAT-Transversal standard).
Regards
Henrik
Quoted 8 lines · dimitri borjac
what i'm trying to do is to perform NAT based on IP_addresses/Ports/SPIs.
The situation would be different users NATted by a common local gateway (all the users are located on the same private network), making each one an IPsec tunnel (using ESP) to the same remote gateway.
The different tunnels start from each user, go through the local gateway (which NATts the users) and end at the remote gateway.
ok, so we are talking about
- NAT'ing the IKE connection on port 500
and
- NAT'ing the AH/ESP connection that is proto AH or ESP and has no port but just the SPI.
Basically what you are asking for, is ip_conntrack_{proto,nat}_{ah,esp}.c
Quoted 3 lines
The problem for the local gateway is to NAT the different VPN, based on the private IP adresses of the users, the ports used (port 50 for ESP...) and the SPIs (in order to distinguish the different tunnels).
it's l4 protocol 50, not port 50.
Quoted 2 lines
The problem is not for the chosen ipsec implementation since the local gateway only NATts and forwards the ispec packets.
oh yes, with standard ipsec you will run into problems. IPsec does generally NOT work across NAT boxes, unless you use the UDP encapsulation mechanism. Please try to read some general information about IPsec and NAT.
Quoted 4 lines
But with the current version of iptables, is it possible for the local gateway to perform NAT based on the SPIs (and @IP and ports...) ? (i saw that extracting the SPI from the ESP header is possible thx to last p-o-m... but NAT with it ?)
no, however it is easy to implement. The problem is 'just' that it still wouldn't work because of IPsec's shortcomings wrt. NAT.
Quoted 2 lines
Regards,
dimo
Signature · 5 lines
- Harald Welte <[email protected]> http://www.netfilter.org/ ============================================================================ "Fragmentation is like classful addressing -- an interesting early architectural error that shows how much experimentation was going on while IP was being designed." -- Paul Vixie