[SOLVED] Setting up additional IPs on one NIC in VMs

networkingnoob

New Member
Sep 24, 2023
3
0
1
Hey there,

Apologies if this is the one of the stupidest questions asked here, but I've been struggling for a couple of days, and a lot of the other threads I've found haven't been too helpful, so I thought I'd just ask.

From looking at the docs, and other threads on this forum, I found this, and I'm in a similar situation, but the answer hasn't seemed to work for me. I rent a dedicated server from a hosting company, and have Proxmox VE installed on it, which I access with the IP xx.xx.xx.170. I bought 2 additional IPv4s but can't seem to work out how to assign them to VMs. From what I have read on other threads, I don't need to create any bridges to achieve this, but when I assign them within the VMs they don't seem to be able to access the internet.

Additional IPs Info:
Address: xx.xx.xx.7 (netmask 255.255.255.0)
Gateway: xx.xx.xx.1

Address: xx.xx.xx.214 (netmask 255.255.255.128)
Gateway xx.xx.xx.129

How I'm setting up network in Ubuntu Server 22.04:
Imgur Link

My /etc/network/interfaces File:
(When a VM is given vmbr1 as an adapter, it can reach the internet, but for what I need the VMs for they need an external IP address)
Code:
auto lo
iface lo inet loopback

auto enp5s0
iface enp5s0 inet static

auto vmbr0
iface vmbr0 inet manual
        address xx.xx.xx.170/24
        gateway xx.xx.xx.1
        bridge-ports enp5s0
        bridge-stp off
        bridge-fd 0

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

Whenever I go to the next page in the Ubuntu Server installer, it can't reach the mirror server, despite me triple checking it's online.

Any help is appreciated, and apologies again if this is a simple fix that I've missed. Thanks! :)
 
In your setup, the vmbr1 is configured as a NAT through vmbr0. With this setup, you will not be able to access the VMs with the public IP.

If you have a separate phy on your host – something like enp6s0 – you can assign vmbr1 to the 2nd phy.
set bridge-port and remove the iptables calls

If you have a single phy, you can pass the vmbr0 directly to the VMs. They will be accessible on the network, and you can directly assign the public IP.

Further information on Network configuration in Proxmox VE can be found here: https://pve.proxmox.com/wiki/Network_Configuration
 
In your setup, the vmbr1 is configured as a NAT through vmbr0. With this setup, you will not be able to access the VMs with the public IP.

If you have a separate phy on your host – something like enp6s0 – you can assign vmbr1 to the 2nd phy.
set bridge-port and remove the iptables calls

If you have a single phy, you can pass the vmbr0 directly to the VMs. They will be accessible on the network, and you can directly assign the public IP.

Further information on Network configuration in Proxmox VE can be found here: https://pve.proxmox.com/wiki/Network_Configuration

Thanks for the reply, after trying your solution and a couple of other tutorials I have found online, I'm still struggling with this. Here's my current /etc/network/interfaces file:

Code:
auto lo
iface lo inet loopback

iface enp5s0 inet static

auto vmbr0
iface vmbr0 inet static
        address xx.xx.xx.170/24
        gateway xx.xx.xx.1
        bridge-ports enp5s0
        bridge-stp off
        bridge-fd 1
        pointopoint xx.xx.xx.1
        bridge_hello 2
        bridge_maxage 12

The VM is assigned vmbr0, with the MAC address given to me by my host. Here (Imgur link) is how I am assigning my additional IP in the guest OS, but I'm still not able to reach the outside world in the VM. To clarify, I only have have a single phy, and the host machine can access the internet. I also checked that the host machine has the correct IP by curling checkip.amazonaws.com, and it did. Thanks for your help :)
 
Does your hosting provider support using a bridge? From the providers' perspective, you are sending packets from a single interface with multiple MAC addresses, which often times is flagged as suspicious and may be filtered or blocked.
Please confirm with your provider that it supports this configuration.

Otherwise please configure your network with routed configuration:
https://pve.proxmox.com/wiki/Network_Configuration#sysadmin_network_routed
 
Found the issue! My configuration was all fine, but the MAC address that I was using which was shown on the control panel of my host was wrong, and so I had to reset it to get a new one in order for the traffic to not be blocked. All is working perfectly now, thanks for the help!
 

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!