[SOLVED] Adding network device with API or Command lines

Thomesc

New Member
Jul 26, 2016
13
0
1
27
Hello,

I'm currently creating containers in NFS via a web interface, the thing is there is no network device when I create my containers.
I'd like to know if there's a way to add a network device (eth0 in bridge mode vmbr0) to my container using the API or the command line ?

Cheers
 
Do you mean you're using the API to create the containers or that you're using another web interface, because our interface has a network tab in the creation dialog.
As for the API: http://pve.proxmox.com/pve2-api-doc/ => 'PUT' request on /nodes/{node}/lxc/{vmid}/config
See pct.conf(5) for details about the netX entries (which can also be passed during creation).
 
Sorry I was not very clear, I have a custom web interface where I create and configure my containers.
I would like to reproduce the behavior of the add button I can found on the official proxmox interface.
Thank you for your answer i'm going to look to the API documentation you linked.

Cheers
 
Last edited:
After reading the documentation I couldn't find the option for the network device, could you help me figure it out ?
I've found this command line but didn't manage to make it work :
pct set 100 -net0 name=eth0,bridge=vmbr0,ip=192.168.15.147/24,gw=192.168.15.1

I'm using openvz containers so I tried with vzctl instead of pct but yeah maybe this is not how it works.

EDIT : Added command line
 
In vzctl --help I've found this :

vzctl set <ctid> [--devices b|c:major:minor|all:r|w|rw]

Is this what I'm looking for ? If yes how do I use it, I have to admit I don't understand how I'm supposed to use this command.
I've also found this, still don't know if this is relevant but here it goes :

[--netif_add <ifname[,mac,host_ifname,host_mac,bridge]]>]


Cheers

EDIT : Added netif command line
 
OK little update,

I managed to create the network interface with a bridge mode using the openvz command line

vzctl set ID --netif_add eth0,,,,vmbr0 --save

Cheers
 

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!