1

Problem: (No Internet & No DHCP)

I cannot seem to get my VM's to connect to the internet nor am I able to setup a DHCP server to automatically assign IPs to them.

Introduction/PSA for dupes: I've seen several articles, videos and questions here on exchange with regards to network best practices with Proxmox. However, over a few days, 11 server reinstalls and frustration I'm unable to get results with my setup, through perhaps outdated articles and/or lack of knowledge. It's also important to mention that I have only ever used Proxmox on a home network, behind a router.

An issue I'm facing is that the configuration OOB from OVH seems slightly different compared to the documentation and articles I've been reading. Here's an example of the networking, unmodified from installation. (vmbr0 comes OOB with the public IP/gateway attached, rather than the network device)

Proxmox Network Tab OOB

And in /etc/network/interface

Proxmox Network Config VIM

Setup:

  • Proxmox Version: Virtual Environment 7.4-3
  • Public IPs: 1
  • Dedicated, cloud hosted server with OVH

Goal/s:

  • To use a single public IP for all traffic
  • Any VM will have internet access (if assigned bridge)
  • Any VM will be automatically assigned a local IP using DHCP (Low Priority) (if assigned bridge)
  • Use dnsmasq/other on either a VM or Proxmox itself for DHCP (Low Priority) (if assigned bridge)
  • To understand the network and rationale

What I've Tried:

Part 1

Masquerading (NAT) with iptables (https://pve.proxmox.com/wiki/Network_Configuration)

I'm confident that this is the correct approach to what I'm trying to achieve, based on it's description in the docs.

Firstly I added a new Linux bridge, with no gateway or IP assigned.

Added Linux Bridge

Then I applied the configuration which added this new iface to the /etc/network/interfaces configuration file, then added the address, post-up, post-down lines to it using vmbr0 bridge, since that's where my gateway is. IP's can range from: 10.10.10.1 - 10.10.10.254.

My assumption here is that 10.10.10.1 will be the IP assigned to the Linux bridge (acting as a managed switch?)

(address= does not have = in prod, this was a screenshot example typo)

Updated Configuration

I then rebooted the entire server to ensure that the network configuration has been applied. I do this rather than restart the service to eliminate any red-herrings because I noticed some randomness in applying them in some of my earlier attempts at this.

Upon successful start-up, I re-checked the network tab in Proxmox and the /etc/network/interface configuration file. Everything was present and 'correct' according to what I'd changed so far.

The next step was to create a virtual machine. I chose ubuntu-22.04.2-live-server and applied the vmbr1 network interface to it and started the vm. Once I reached the network connections configuration I selected manual IPV4 setup and entered the following details:

enter image description here

Following a save of this dialogue, the proceed button, Continue without network, was changed to Done. So I believe my config here to be correct (at least for LAN). Jumping ahead slightly, Checking for installer update & Featured Server Snaps fails to load, but I decided to continue with the installation. After this was all completed, I ran apt-get update, ping 1.1.1.1, ping 10.10.10.1 and ping 10.10.10.0 which showed no signs of life.

enter image description here

Running ip a, shows the following, which seems correct?:

enter image description here

These results tell me that my bridge configuration in /etc/network/interfaces is wrong.....

Part 2

Using the previous steps in Part 1, I'd followed them exactly, however I re-assigned my IP/gateway to the network device and used vmbr0 instead of vmbr1 as seen in the screenshots.

Part 3

I went on to think that this could also be an issue with how I was setting up the network on the VM so I'd attempted to setup a DHCP server using dnsmasq and dnsutils in the Proxmox host shell. Followed by re-tracing my steps afterwards as seen in Part 1. No IP was automatically assigned to the VM upon installation however.... (Ideally I'd setup a DHCP server within a separate VM anyway).

Part 4

Attempted to install Pfsense however, I realised that if I could not fix my bridge configuration this would never work either.

Any help/knowledge/advice is greatly appreciated on this, I usually work best by trial and error, but this time it's not worked!

Thanks for reading my monologue.

References/Articles:

Proxmox VE - problems in setting private network

How accessing a NATed, virtualized (LXC) server over public IP from client itself on a bridged network?

Proxmox: 1 NIC, 1 Public IP, unable to get WAN interface working in VMs

https://forum.proxmox.com/threads/how-can-i-connect-a-bridge-to-another-bridge.98510/ (Interesting? Maybe Part 1 wont work at all anyway?)

https://bobcares.com/blog/dnsmasq-dhcp-server-in-proxmox/

https://forum.proxmox.com/threads/1-public-ip-two-bridges-port-forwarding.110820/

https://unix.stackexchange.com/questions/633668/how-to-set-up-a-bridge-interface-add-eth0-to-it-and-have-internet-connection

Ballard
  • 121
  • 5

2 Answers2

1

Issue resolved (updated to use 192.168.1.1)

Steps:

  1. Install Proxmox & Load Interface
  2. From the shell vim /etc/network/interfaces
  3. Add vmbr1 iface to bottom of file:

auto vmbr1

iface vmbr1 inet static

address 192.168.1.1

netmask 255.255.255.0

bridge_ports none

bridge_stp off

bridge_fd 0

  1. From the shell apt-get install dnsmasq
  2. From the shell vim /etc/dnsmasq.conf
  3. Add configuration:

interface=vmbr1

dhcp-range=192.168.1.100,192.168.1.200,infinite

dhcp-option=option:router,192.168.1.1

dhcp-option=option:dns-server,192.168.1.1

  1. From shell: vim /etc/sysctl.conf. Add net.ipv4.ip_forward=1

  2. From the shell: sudo sysctl -p

  3. Run this in SHELL: sudo iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o vmbr0 -j MASQUERADE

  4. From the shell: sudo apt-get install iptables-persistent

  5. From the shell: sudo systemctl restart networking

  6. From the shell: sudo systemctl restart dnsmasq

  7. From the shell: sudo netfilter-persistent save

  8. Build VM with vmbr1 network and an IP will be automatically assigned using DHCP and will have internet.

Ballard
  • 121
  • 5
  • 1
    If you want to use the DHCP server in a VM rather than on host, skip the DHCP steps, configure a VM on vmbr1, assign it a static IP manually, then run the dhcp steps there. – Ballard Jun 05 '23 at 12:13
0

Thanks for the guide, I managed to set vmbr1 with internet connection for my VMs on Proxmox on OVH if I set a fixed IP.

What doesn't work is the DHCP, even if I followed your steps (I'm using 10.10.10.1 instead of 192.168.1.1):

etc/network/interfaces

auto lo
iface lo inet loopback

iface enp1s0f0 inet manual

iface enp1s0f1 inet manual

auto vmbr0
iface vmbr0 inet static
        address MYSERVERIP/24
        gateway MYSERVERGATEWAY.254
        bridge-ports enp1s0f0
        bridge-stp off
        bridge-fd 0
        hwaddress HWADDRESS

iface vmbr0 inet6 static
        address ADDRESS
        gateway GATEWAY

auto vmbr1
       iface vmbr1 inet static
       address 10.10.10.1/24
       bridge_ports none
       bridge_stp off
       bridge_fd 0


post-up   echo 1 > /proc/sys/net/ipv4/ip_forward
post-up   iptables -t raw -I PREROUTING -i fwbr+ -j CT --zone 1
post-down iptables -t raw -D PREROUTING -i fwbr+ -j CT --zone 1
post-up   iptables -t nat -A POSTROUTING -s '10.10.10.0/24' -o vmbr0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '10.10.10.0/24' -o vmbr0 -j MASQUERADE

/etc/dnsmasq.conf

interface=vmbr1
dhcp-range=10.10.10.101,10.10.10.200,infinite
dhcp-option=option:router,10.10.10.1
dhcp-option=option:dns-server,10.10.10.1

Is there something else I should set to get an IP when I start/create a VM?

Thanks

Alessandro

ale.ttone
  • 1
  • 2