0
Good day,
I have 2 VMs running with libvirt.
Machine 1 : PostgreSQL on port 5432
Machine 2 : Attempting to use psql to connect to a PostgreSQL server on the internet.
I forwarded port 5432 so that I can access the PostgreSQL on Machine 1 from outside/as a service.
The problem I have: Machine 2 tries to connect to a PostgreSQL server on the internet, but when the packets come back they are forwarded to Machine 1 which then responds to Machine 2. So I never establish a proper connection to the outside PostgreSQL.
How do I change my port forward rules to accomodate for this?
(I used to use nat-networking on VirtualBox that took care of that for me, but KVM is cooler right :-)
Current rules Machine 1:
/sbin/iptables -I FORWARD -o virbr66 -d 192.168.223.115 -j ACCEPT
/sbin/iptables -t nat -I PREROUTING -p tcp --dport 5432 -j DNAT --to 192.168.223.115:5432