NetVM: never NAT host<->netvm traffic (fixes host->netns CDP)
This commit is contained in:
@@ -26,8 +26,11 @@ nsexec ip link set lo up
|
||||
|
||||
# host NAT + forwarding for the veth subnet
|
||||
sysctl -qw net.ipv4.ip_forward=1
|
||||
iptables -t nat -C POSTROUTING -s "$SUB" -j MASQUERADE 2>/dev/null || \
|
||||
iptables -t nat -A POSTROUTING -s "$SUB" -j MASQUERADE
|
||||
# NB: never NAT host<->netvm traffic — SNATing the host's own veth IP breaks
|
||||
# host->netns connections (e.g. CDP): the reply would route out the tunnel.
|
||||
iptables -t nat -D POSTROUTING -s "$SUB" -j MASQUERADE 2>/dev/null || true # migrate old broad rule
|
||||
iptables -t nat -C POSTROUTING -s "$SUB" ! -d 10.201.0.0/16 -j MASQUERADE 2>/dev/null || \
|
||||
iptables -t nat -A POSTROUTING -s "$SUB" ! -d 10.201.0.0/16 -j MASQUERADE
|
||||
|
||||
# endpoint bypasses the tunnel (else the handshake routes into itself)
|
||||
ENDPOINT=$(grep -oP '^\s*Endpoint\s*=\s*\K[^:;#]+' "$CONF" | head -1)
|
||||
|
||||
Reference in New Issue
Block a user