[Bug 248474] NAT broken on IPsec/VTI [if_ipsec]
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Wed Aug 5 13:52:39 UTC 2020
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248474
Michael Muenz <m.muenz at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |m.muenz at gmail.com
--- Comment #8 from Michael Muenz <m.muenz at gmail.com> ---
Hi,
I just set up a test tunnel between two OPNsense 20.7 (12.1).
Site-A (10.10.12.0/2) - FW-A --- FW-B - Site-B (10.10.10.0/24)
Ping without NAT from A to B is no problem. When I set a nat rule (pf of
course) on interface ipsec4000 so source address should be 192.168.199.1
instead of 10.10.12.0, I can see the packet correctly translated in ipsec4000
and enc0, but no ESP packet going to WAN of FW-B, so there seem to be a missing
hook somewhere.
TCPDUMP on LAN FW-A:
root at PB-FW1-KARL:~ # tcpdump -n -i vtnet1 icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on vtnet1, link-type EN10MB (Ethernet), capture size 262144 bytes
15:32:22.768297 IP 10.10.12.51 > 10.10.10.1: ICMP echo request, id 18103, seq
26, length 64
15:32:23.840814 IP 10.10.12.51 > 10.10.10.1: ICMP echo request, id 18103, seq
27, length 64
15:32:24.913369 IP 10.10.12.51 > 10.10.10.1: ICMP echo request, id 18103, seq
28, length 64
TCPDUMP on ipsec4000 FW-A:
root at PB-FW1-KARL:~ # tcpdump -n icmp -i ipsec4000
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ipsec4000, link-type NULL (BSD loopback), capture size 262144
bytes
15:32:49.288388 IP 192.168.199.1 > 10.10.10.1: ICMP echo request, id 4355, seq
51, length 64
15:32:50.350974 IP 192.168.199.1 > 10.10.10.1: ICMP echo request, id 4355, seq
52, length 64
15:32:51.423561 IP 192.168.199.1 > 10.10.10.1: ICMP echo request, id 4355, seq
53, length 64
TCPDUMP on enc0 FW-A:
root at PB-FW1-KARL:~ # tcpdump -n icmp -i enc0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enc0, link-type ENC (OpenBSD encapsulated IP), capture size 262144
bytes
15:32:38.737241 (authentic,confidential): SPI 0xc520971a: IP 192.168.199.1 >
10.10.10.1: ICMP echo request, id 4355, seq 41, length 64
15:32:39.752371 (authentic,confidential): SPI 0xc520971a: IP 192.168.199.1 >
10.10.10.1: ICMP echo request, id 4355, seq 42, length 64
15:32:40.824808 (authentic,confidential): SPI 0xc520971a: IP 192.168.199.1 >
10.10.10.1: ICMP echo request, id 4355, seq 43, length 64
Also pf seems to work correctly:
root at PB-FW1-KARL:~ # pfctl -s all | grep 10.10.10.
nat on ipsec4000 inet proto icmp from any to 10.10.10.0/24 -> 192.168.199.1
port 1024:65535
all icmp 10.10.10.1:24247 <- 10.10.12.51:24247 0:0
all icmp 192.168.199.1:25905 (10.10.12.51:24247) -> 10.10.10.1:25905 0:0
Setting nat on enc0 will just be ignored:
root at PB-FW1-KARL:~ # pfctl -s all | grep 10.10.10.
nat on enc0 inet proto icmp from any to 10.10.10.0/24 -> 192.168.199.1 port
1024:65535
all icmp 10.10.10.1:26295 <- 10.10.12.51:26295 0:0
all icmp 10.10.12.51:26295 -> 10.10.10.1:26295 0:0
It seems Andrey (Hi, we were in touch about VTI and OPNsense around 2 years
ago) is right, I loaded ipfw and ipfw_nat in OPNsense and did:
ipfw nat 123 config ip 192.168.199.1
ipfw add 124 nat 123 ip4 from 10.10.12.0/24 to 10.10.10.0/24 out
After this I can see packets on Site-B coming from 192.168.199.1, but not
reply, but this seems just to be another missing ipfw rule.
So for OPNsense I don't see a quick fix, maybe we can try patch from Eugene if
it really has a chance to go in upstream :)
Best,
Michael
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-net
mailing list