Public IP for VM in proxmox with the main IP in the same subnet

alexj1350

New Member
Sep 13, 2023
1
0
1
I have a server with a /27 IP allocation (100.100.100.128/27 for example). I'd like to setup proxmox for virtual environment. My network model should be like this:

  • Gateway: 100.100.100.129
  • Main IP for proxmox host: 100.100.100.130
  • IP for VMs: 100.100.100.131 ~ 100.100.100.158
After some researches, I found that the below configuration is mentioned a lot:

For proxmox host:
Code:
auto eno1
iface eno1 inet static
    address 100.100.100.130/27
    gateway 100.100.100.129
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up echo 1 > /proc/sys/net/ipv4/conf/eno1/proxy_arp

auto vmbr0
iface vmbr0 inet static
        address 100.100.100.128
    netmask 255.255.255.224
        bridge-ports none
        bridge-stp off
        bridge-fd 0
    ip up route add 100.100.100.128/27 dev vmbr1
    ip up route -A POSTROUTING -o vmbr0 -j MASQUERADE

And in the ubuntu I add IP like this :
Code:
network:
  ethernets:
    ens18:
      addresses:
        - 100.100.100.131/32
      routes:
        - to: default
          via: 100.100.100.129
          on-link: true
      nameservers:
        addresses: [8.8.8.8,4.2.2.4]
      dhcp4: false
  version: 2
But In VM Guest I can not ping gateway or reach internet
 
Last edited:
Configure the Proxmox network like this:

Code:
auto eno1
iface eno1 inet manual

auto vmbr0
iface vmbr0 inet static
    address 100.100.100.130/27
    gateway 100.100.100.129
    bridge-ports eno1
    bridge-stp off
    bridge-fd 0

You have been missing the bridge port. And your IP configuration was not correct.
As the VMs are bridged into the Ethernet there is no need for IP forwarding or proxy ARP.
 

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!