Configure vlan using Proxmox API

tibby

New Member
Apr 3, 2018
4
0
1
35
Hello! I've been searching for an information how could I possibly configure VLAN using Proxmox API. I know how to check the network config using an API, but is it possible to add a VLAN using API?

Normally I would edit /etc/network/interfaces, but I need to do it in Python's code. Thanks.
 
Hi,

Do you like to configure VLAN for the host or for the Guests?
 
Both. Also, I would like to configure it like I do in /etc/network/interfaces. So basically, I would like to do the same thing like in /etc/network/interfaces but programatically using an API in Python.
 
We have no API VLAN configuration call for the host network.
 
I see. So how about the configuration for guest?
 
Last edited:
You can use the set command but you have to set all nic property again.

The workflow would
GET /api2/json/nodes/{node}/qemu/{vmid}/config to fetch the current vnic config
PUT /api2/json/nodes/{node}/qemu/{vmid}/config to update the new vnic config with vlan tag.

https://pve.proxmox.com/pve-docs/api-viewer/index.html
 
Ok but you gave me the VLAN configuration for the VM. However, I would like to create only a VLAN (I know how to set VLAN for VM).
 

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!