At an office, a FreeBSD router is set up using ipfw and nat. This part works great and has for years.
We added an ipsec tunnel for a remote network. I have the tunnel up, and can ping from the internal interface (em1 172.31.0.200) to the remote IP 10.4.4.4, no problem.
For the nat, I set up a 'reverse nat' on the internal interface... I can't add NAT to the external interface as ipsec processes the packet first.
Problem is, that ipsec doesn't pass the packets back to ipfw after it processes the packet and finds out it is 'local' on em1. I can fire up tcpdump on enc0 and see the return packet (verifiing all the ipsec is OK), but I can't get the packet to hop back into divert
Am I messing up my NAT rule, or is there someway to push the packet into divert after ipsec? Thanks!
We added an ipsec tunnel for a remote network. I have the tunnel up, and can ping from the internal interface (em1 172.31.0.200) to the remote IP 10.4.4.4, no problem.
For the nat, I set up a 'reverse nat' on the internal interface... I can't add NAT to the external interface as ipsec processes the packet first.
Code:
ipfw nat 2 config ip 172.31.0.200 reverse
ipfw add 1198 nat 2 all from any to 10.4.4.0/24 in via em1
ipfw add 1199 nat 2 all from 10.4.4.0/24 to any out em1
Problem is, that ipsec doesn't pass the packets back to ipfw after it processes the packet and finds out it is 'local' on em1. I can fire up tcpdump on enc0 and see the return packet (verifiing all the ipsec is OK), but I can't get the packet to hop back into divert
Code:
# tcpdump -n -i enc0
13:25:06.775073 (authentic,confidential): SPI 0x008395b0: IP 172.31.0.200 > 10.4.4.4: ICMP echo request, id 46048, seq 1, length 64
13:25:06.775089 (authentic,confidential): SPI 0x008395b0: IP 5.4.3.211 > 93.184.216.34: IP 172.31.0.200 > 10.4.4.4: ICMP echo request, id 46048, seq 1, length 64 (ipip-proto-4)
13:25:06.799967 (authentic,confidential): SPI 0x0519c7cb: IP 93.184.216.34 > 5.4.3.211: IP 10.4.4.4 > 172.31.0.200: ICMP echo reply, id 46048, seq 1, length 64 (ipip-proto-4)
Am I messing up my NAT rule, or is there someway to push the packet into divert after ipsec? Thanks!