[SOLVED] Assigned Public Ip to VM Private IP But cannot reach the VM using PublicIP.

Jul 22, 2021
33
2
8
24
I have three Public IPs:
202.65.xxx.0: Firewall Public IP
202.65.xxx.2: Assigned to Host PVE node(192.168.10.2)
202.65.xxx.1: Assigned to VM100 (192.168.0.3)

I am trying to access The VM100 by 202.65.xxx.1 Public IP(resulting in Unreachable).
202.65.xxx.2 is working (Can access the PVE node globally)

/etc/network/interfaces in PVE Node
Code:
auto lo
iface lo inet loopback

iface eno145 inet manual

iface eno146 inet manual

iface eno3 inet manual

iface eno4 inet manual

auto vmbr0
iface vmbr0 inet static
        address 192.168.10.2
        gateway 192.168.10.1
        bridge-ports eno145
        bridge-stp off
        bridge-fd 0

auto vmbr1
iface vmbr1 inet static
        address 192.168.0.254
        netmask 255.255.255.0
        bridge_ports none
        bridge_stp off
        bridge_fd 0

post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -s '192.168.0.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.0.0/24' -o vmbr0 -j MASQUERADE

post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 26656 -j DNAT --to 192.168.10.2:22
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 26656 -j DNAT --to 192.168.10.2:22

post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 26657 -j DNAT --to 192.168.0.3:22
post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 26657 -j DNAT --to 192.168.0.3:22

Network Details of VM100:
Code:
IPv4: static
Bridge: vmbr1
IPv4/CIDR: 192.168.0.3/24
Gateway(IPv4): 192.168.0.254

Please help me with this. It is pretty critical.

Regards.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!