Having multiple ips on one nic

fxandrei

Renowned Member
Jan 10, 2013
154
12
83
So i just cant manage this.
I have just 2 nics. (eth0 and eth1)
On one i have my management network (vmbr0 bridge to eth0).
I want to have another ip for either vmbr0 or eth0.

vmbr0 has 192.168.20.11

What i can do now is execute this :

ip addr add 192.168.50.11/24 dev vmbr0 label vmbr0.0

And it works. But after i restart everything is gone.
I can also add this to the interfaces file :
Code:
auto vmbr0
iface vmbr0 inet static
        address  192.168.20.11
        netmask  255.255.255.0
        bridge_ports eno3
        bridge_stp off
        bridge_fd 0
        post-up ip addr add 192.168.50.11/24 dev vmbr0 label vmbr0.0
        post-down ip addr del 192.168.50.11/24 dev vmbr0 label vmbr0.0

But again, after the restart its gone.
So is there any way that i can make this king of config stick around after restart ?

It says this in the interfaces file :
# If you want to manage part of the network configuration manually,
# please utilize the 'source' or 'source-directory' directives to do
# so.

How do these directives work ? Any example ?
So is there a way i can have multiple ips on my nic ?
 
So let me correct myself. Those modifications on the interface file stand after a reboot. Just that if i edit something from the interface, and reboot, it overrides everything.
 
So i dont know what the heck i was doing before, but i did some more testing, and as it turns out those lines i added in the interfaces file remain there after i edit other interfaces.
So i guess this is the solution to having multiple ip's on the same interface.
 
Well ofcourse you can, but anything you add in the cmd line, or directly in the config file will get lost if you edit the network from the gui.
 
I tried that as well, and i did not manage to do it from the gui.
Did you have this case as well ?
 
I was using linux-bridge previously..

and i have installed: apt install openvswitch-switch

removed any linux bridge..
create a new ovs-bridge with port bridge to enp4s0

after I have create a new ovs-bridges without the port bridge to the physical ethernet.


px - Proxmox Virtual Environment (6).png
 
Im not sure, but in this setup isnt just the vmbr0 ovsbridge\switch connected to the physical port ?
I would actually need to be able to set multiple ips that can be "Accesed" on the same physycal interface. So in this config (yours) i would need to have vmbr1, 2 and 3 connected to port enp4s0 .

But i saw i cannot do that.

So what i would actually need is to be able to ping this host from another host, that has multiple ips on the same physical port.
 
You can try to set a virtual Ethernet card and create Linux Bridges or set a DHCP server with vmbr0 (wan) and vmbr1-2-3 as backend lan..
 
No. I tried all sorts of combinations and did not manage to set 2 ips from the gui. But i went some other way to solve my situation that does not involve 2 ips on the same nic.

Anyway, the this is i did not find a way to set multiple ips from the gui.
 
Currently it's not yet possible to do it through api or gui.
Some prelimary work has been done to manage cidr for "address ..." option.
So with ifupdown2, it's possible to define multiple "address" options by interfaces.

I'll try to implement multiple address by interface soon.
 

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!