API: Cannot add IPSet

7thSon

Active Member
Feb 26, 2018
13
3
43
38
I'm trying to add a subnet to an existing IPSet of an existing VM via the API. According to the docs (https://pve.proxmox.com/pve-docs/api-viewer/index.html) the correct command would be:

pvesh set /nodes/{node}/qemu/{vmid}/firewall/ipset/{name}/{cidr}

But this command doesn't work (node and vmid are correct and ipset with name "test" exists):

pvesh set /nodes/pbx-c1-n1/qemu/103/firewall/ipset/test/192.168.10.0/24
400 Parameter verification failed.
cidr: no such IP/Network
set nodes/pbx-c1-n1/qemu/103/firewall/ipset/test/212.25.0.0/24 [OPTIONS]


I've already tried to escape the slash in the CIDR notation (192.168.10.0\/24) but no luck. A few methods I tried:

pvesh set /nodes/pbx-c1-n1/qemu/103/firewall/ipset/test/192.168.10.0/24
pvesh set /nodes/pbx-c1-n1/qemu/103/firewall/ipset/test/192.168.10.0\/24
pvesh set /nodes/pbx-c1-n1/qemu/103/firewall/ipset/test/"192.168.10.0/24"
pvesh set /nodes/pbx-c1-n1/qemu/103/firewall/ipset/test/'192.168.10.0/24'


I already tried the same API request via HTTP (with and without url encoding of the CIDR address) instead of CLI and I'm getting the same error.

I'm on the latest 5.1 release of Proxmox VE.

Can anyone reproduce that behaviour? Does anyone knows what the correct API call would be?
Any help is appreciated :)
 
That worked, thank you Dietmar!
So is the documentation wrong or do I just not read it correctly?
 
Ah yeah, got it now. My set request would update an existing CIDR entry inside the the IPset instead of adding a new one.
 

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!