Add/Delete network to VM via Proxmox API

Egor

New Member
Nov 21, 2016
28
1
3
32
We can add network device to virtual machine via web interface:
upload_2017-3-28_22-47-24.png

How to do the same operation via Proxmox API?

Probably I should use the command
'pvesh set /nodes/{node}/qemu/{vmid}/config', but I am not sure how to use it to add or to delete a network adapter from a virtual machine.

Could someone, please, show 2 concrete examples of doing that?
1. Add: pvesh set /nodes/...
2. Delete: pvesh delete /nodes/...
 
Add:

# pvesh set /nodes/{node}/qemu/{vmid}/config --net1 'virtio,bridge=vmbr0'

Delete:

# pvesh set /nodes/{node}/qemu/{vmid}/config --delete net1
 

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!