currently I'm deploying a virtualized system and having a problem with forwarding of an udp port. I tried many tutorials, but something must be wrong and I don't know why the connection is refused all the time.
Firewall is disabled on all used machines.
My setup is the following:
I have a debian server with kvm, that hosts 2 VMs.
VM1 192.168.122.215/24 at enp1s0 (ubuntu 18.04)
VM2 192.168.122.104/24 at ens2 (ubuntu 16.04)
at VM1 a docker deployment is running with: 192.168.70.129/26 at docker-adp-1
The goal is to connect from VM2 to the docker deployment with UDP at port 2152 (from 192.168.122.104 to 192.168.70.129:2152).
The docker deployment consists of many microservices, that are running satisfying (VM2 can communicate with various services on VM1 docker deployment via TCP).
On VM2 I use the following route:
sudo ip route add 192.168.70.128/26 via 192.168.122.215 dev ens2
On VM1 I use the rules:
sudo sysctl net.ipv4.conf.all.forwarding=1
sudo iptables -P FORWARD ACCEPT
From the tutorials now I tried several PRE-/POSTROUTING on VM1 like (without success):
sudo iptables -t nat -A PREROUTING -p udp -i enp1s0 -d 192.168.122.215 --dport 2152 -j DNAT --to-destination 192.168.70.129:2152
sudo iptables -A FORWARD -i enp1s0 -p udp -d 192.168.122.215 --dport 2152 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A FORWARD -i demo-oai -p udp -d 192.168.70.129 --dport 2152 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
I hope anyone can help.
Best regards