VM unable to ping public ip's

mitron

New Member
May 24, 2018
13
0
1
44
Hi
Can anyone please suggest the issue with my config.

I am trying to do a setup where my host has a public and private ip.
All vm's are to have a private ip only.
Of cousre the vm's should be abe to connect to the internet.

I have the config below
My vm has ip 10.0.0.100.
My host has a public ip and private ip. The private ip is 10.0.0.254.
Host is able to ping the vm.
vm is able to ping the private ip of host.

Why can't the vm ping public ip's?

---------------------------------------------------
HOST

Contents of the file: /etc/network/interfaces

auto vmbr1
iface vmbr1 inet static
address 10.0.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 '10.0.0.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.0.0.0/24' -o vmbr0 -j MASQUERADE

Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         188.164.246.254 0.0.0.0         UG    0      0        0 eno1
0.0.0.0         188.164.246.254 0.0.0.0         UG    0      0        0 vmbr0
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 vmbr1
188.164.246.0   0.0.0.0         255.255.255.0   U     0      0        0 eno1
188.164.246.0   0.0.0.0         255.255.255.0   U     0      0        0 vmbr0

---------------------------------------------------

VM

Contents of the file: /etc/sysconfig/network-scripts/ifcfg-ens18
DEVICE=ens18
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
IPADDR=10.0.0.100
GATEWAY=10.0.0.254
NETMASK=255.255.255.0
ARP=yes

Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.254    0.0.0.0         UG    0      0        0 ens18
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 ens18

======================================================================================
 
So I'm guessing your aim is to be able to access your host over the internet via it's public IP? and that you want the VM's to be on your private network which is 10.0.0.0/24

I would think you need a router in the system. Do you have more one NIC on your host? If so, I would install pfSense as a VM on the host and use that to route traffic in and out of your network.
 

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 yours easily in our online shop.

Buy now!