I have a udp forwarding to a VM with the rule
iptables -t nat -A PREROUTING -i eth0 -p udp -m udp --dport 42000:42020 -j DNAT --to-destination 192.168.1.2
iptables -t nat -A POSTROUTING -s 192.168.1.2/32 -j MASQUERADE
iptables -A FORWARD -d 192.168.1.2 -p udp --dport 42000:42020 -j ACCEPT
iptables -A FORWARD -s 192.168.1.2 -j ACCEPT
In the VM is are openvpn servers listening on these ports.
Now I have a strange problem with the forwarding on the host: Some packets are routed between the interfaces and some are not, without a clear pattern why.
- One VPN connection is working just fine. tcpdump shows packets on
eth0
andvmnet
on the host and inside the VM. - Three VPN connections are getting peer packets on
eth0
which are not routed tovmnet
and vm packets onvmnet
which are not routed toeth0
. - UDP packets with the same sourceport and packet length as one of the failing connections sent via netcat are logged on
eth0
,vmnet
and inside the VM just fine.
What can I try to find why the packets are not routed to the other interface?