[SOLVED] Adding network device with API or Command lines

Thomesc

New Member
Jul 26, 2016
13
1
1
28
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
 
  • Like
Reactions: prxmx2024