LXC unplug/disconnect network interface

Figo

Member
Oct 27, 2018
4
0
6
52
Hi all!

In order to achieve migrating a running server to a new LXC container (Debian Buster), I'm searching how to unplug/disconnect the network interface from host as it is possible for QEMU VMs.

It's because I need to have a network interface with correct MAC address inside LXC, but the MAC already exists over our local network, and the current server must stay online as much as possible.

I haven't found any option in GUI or command line...

Any ideas ?

Thanks !

Proxmox 6.0.7
 
Hi,

there is no GUI option for this.
You have to do this with the ip tool.
see "man ip".
 
Hi, do you use the ip tool from inside the container or on the host?
Maybe a short example command would be helpful.
 
hi,
Hi, do you use the ip tool from inside the container or on the host?
Maybe a short example command would be helpful.

i'm not sure what exactly the OP was asking about here:
I'm searching how to unplug/disconnect the network interface from host as it is possible for QEMU VMs.

so if you can explain what you need we can give you some examples.

from the title LXC unplug/disconnect network interface what i understand is they have an interface on the LXC which they want to disable...
that can be done by removing the network interface: pct set CTID -delete net0 (if it's the only interface. otherwise it might be net1 or 2 and so forth).

if you mean something else please explain
 
Hi thanks for your reply,

in GUI in the "VM-Hardware config" i can simply check "Disconnect" to temporary disconnect a network interface

I want to do the same in LXC. In the GUI i only can delete it. So i have to remember IP and MAC-Addr when I want to restore the same connection later.

Is there a way in LXC to "unplug the virtual network cable" instead of deleting the network?
 
in GUI in the "VM-Hardware config" i can simply check "Disconnect" to temporary disconnect a network interface

I want to do the same in LXC. In the GUI i only can delete it. So i have to remember IP and MAC-Addr when I want to restore the same connection later.

Is there a way in LXC to "unplug the virtual network cable" instead of deleting the network?
ah i see. this isn't possible yet on the GUI. you can make a feature request on our bugtracker :) [0]

as a workaround you can run on your PVE host, f.e. set net0 down for CT 123 by running ip link set veth123i0 down nomaster or generally veth[ID]i[interface index]

[0]: https://bugzilla.proxmox.com
 
Last edited:
  • Like
Reactions: Kyle
Prior to installing ifupdown2 package which normally handles things much more gracefully and non-disruptively...

I had an issue after some networking maintenance whereby I needed to ifdown ifup my vmbr0 and the enslaved tap and veth interfaces lost their master - this caused a network outage for all kvms and lxc containers.

For the lxc I was able to re-enslave the veth with the following example:

Code:
ip link set veth100i0 master vmbr0

Post #6 was helpful in giving me this insight. I already knew I could do this for tap interfaces, and this post helped me learn that it applies for veth interfaces too.

Example for tap interfaces:

Code:
ip link set tap103i0 master vmbr
 

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!