Single ip's - different subnets - 1nic - Hetzner

creamers

New Member
Jun 17, 2020
16
0
1
45
Hi Proxmox community!

I've been reading and found alot of examples but not the solution I'm looking for. (Or at least I was not able to solve my problem with the examples)

I ordered 1 ip at hetzner and a few days later another few. First one works but can't seem to get the second with different subnet to work in a vm on proxmox.

I would like to know how to setup the interface on a proxmox host at Hetzner having single ip's from different subnets.

This works:
Code:
### Hetzner Online GmbH installimage

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

auto enp0s31f6
iface enp0s31f6 inet static
  address 95.216.30.81
  netmask 255.255.255.192
  gateway 95.216.30.65
  pointopoint 95.216.30.65

# for single-IPs
auto vmbr0
iface vmbr0 inet static
  address 95.216.30.81
  netmask 255.255.255.255
  bridge_ports none
  bridge_stp off
  bridge_fd 0
  bridge_maxwait 0
  up ip route add 95.216.30.111/32 dev vmbr0

Now I would like to add this additional ip to above config so I can use that ip also for a vm:

ip 95.216.120.2
gw 95.216.120.1
mask 255.255.255.240
broadcast 95.216.120.15

( When just adding "up ip route..." will break the first one. )

Hope this example will help others to.

Thanks in advance!!
 
It shouldn't be a problem to add an additional "up ip route" statement for the second ip
 
As soon as I add an additional from that other subnet:

"up ip route add 95.216.120.2/32 dev vmbr0"

and ifdown vmbr0 && ifup vmbr0 then the first one will break and the added one will work.
( Does anybody have examples showing the complete interface setup with multiple single ip's from different subnets? )
 
@Vengance you were right. I rebooted the server and then they all work!

Howto add ip's to the host config interface without rebooting the whole host ? should ifdown ifup not be enough?
 
This works but is probably not the way. Also how to make this dynamically instead of manually adding lines.

if-up/autobridges
brctl addif vmbr0 tap102i0
brctl addif vmbr0 tap103i0
brctl addif vmbr0 tap104i0
brctl addif vmbr0 tap105i0

Can it be known in advance which names for devices are reserved? (like tap102i0)
(they end up here: ls -al /sys/class/net where I found the devices)
Hope someone has an better alternative to keep everything up and running when editing the interface and ifdown ifup......
 
Last edited:
@Vengance you were right. I rebooted the server and then they all work!

Howto add ip's to the host config interface without rebooting the whole host ? should ifdown ifup not be enough?

simply install ifupdown2 (apt install ifupdown2)

then use "apply" on network gui or use "ifreload -a" if you edit /etc/network/interfaces manually
 
Okay good to know but is this ifreload tool aware that it needs to recreate the virtual tab devices again like described above?
Now you still need to do it manually or like suggestion by a script after interface reload: "brctl addif vmbr0 tap102i0 "
 
Okay good to know but is this ifreload tool aware that it needs to recreate the virtual tab devices again like described above?
Now you still need to do it manually or like suggestion by a script after interface reload: "brctl addif vmbr0 tap102i0 "
the ifupdown2 version provided by proxmox repo (but carefull to have proxmox repo installed, don't install ifupdown2 from debian repo),
is patched to not remove tap interfaces from bridge on reload.
 
  • Like
Reactions: creamers

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!