Requests from VM in subnet are forwarded to pve's gateway, but with subnet source IP.
My masquerading with iptables fails in this common use-case:
With
Hence request leave the host, but can't be responded to (as source not routable).
Further Infos:
Any help is very appreciated!
Kind regards,
Mathis
My
My masquerading with iptables fails in this common use-case:
Internet <-eth0-> pve host <-vmbr0-> VM (10.10.0.1)
With
sudo tcpdump -n -i enp0s31f6 icmp
I get:
Code:
17:26:35.506557 IP 10.0.0.2 > 94.130.yy.zz: ICMP echo request, id 601, seq 1151, length 64
Hence request leave the host, but can't be responded to (as source not routable).
Further Infos:
- Current Proxmox VE (ie 7.3-6), installed from ISO
- headless bare metal server (hetzner), on network card with one public IP
- VM: plain debian, static IP
10.0.0.2
, gateway:10.0.0.1
. - The usual NAT command (
post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/30' -o enp0s31f6 -j MASQUERADE
) seems to have no effect on the forewarding. If I delete the rule with iptable, the requests still appear ontcpdump
- En-/disabling the host's pve firewall has no effect.
- Using the recommended setup from wiki does not forward any requests (not on
eth0
, not onvmbr0
), so is this workinginterfaces
- suggested addition
post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
has no effect.
Any help is very appreciated!
Kind regards,
Mathis
My
/etc/network/interfaces
is a bit more complex, as my true intention (german source) is a VM net behind a pfsense. However, I think this should not make any difference:
Code:
auto lo
iface lo inet loopback
auto enp0s31f6
iface enp0s31f6 inet manual
#outside world
auto vmbr0
iface vmbr0 inet static
address 94.130.yy.xx/26
gateway 94.130.yy.zz
bridge-ports enp0s31f6
bridge-stp off
bridge-fd 0
#ip endpoint to outside world
auto vmbr1
iface vmbr1 inet static
address 10.0.0.1/30
bridge-ports none
bridge-stp off
bridge-fd 0
#in front of firewall
auto vmbr2
iface vmbr2 inet static
address 192.168.77.1/24
bridge-ports none
bridge-stp off
bridge-fd 0
#VMs behind firewall
# Natting
# 1. Allow traffic routing
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
# 2. Input to firewall
post-up iptables -t nat -A PREROUTING -i enp0s31f6 -p tcp -m multiport ! --dport 22767 -j DNAT --to 10.0.0.2
post-up iptables -t nat -A PREROUTING -i enp0s31f6 -p udp -j DNAT --to 10.0.0.2
# 3. Output Firewall -> outside
post-up iptables -t nat -A POSTROUTING -s '10.0.0.0/30' -o enp0s31f6 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/30' -o enp0s31f6 -j MASQUERADE
# 4. Conflict with proxmox firewall iptables chain PVEFW-FORWARD
post-up iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
Last edited: