SimpleZones not working after changing via cli

jsterr

Renowned Member
Jul 24, 2020
784
220
68
32
I created 10 simplezones, each with its own vnet and subnet, I manually edited the files in /etc/pve/sdn and pressed apply via web-ui.

This worked well, but I did some changes on /etc/pve/sdn/subnets.cfgand pressed applyagain, since then I cant get a ip adress on any of the zones (although there are no current dhcp-reservations).

How can I troubleshoot this? Maybe should have used pvesh instead of manually editing the files, might this be the issue?

Error:

Bash:
net0: hotplug problem - can't find any free ip in zone sz06 for IPv4 at /usr/share/perl5/PVE/Network/SDN/Vnets.pm line 143.

I tried, but it did not help.

Bash:
service networking restart
systemctl restart dnsmasq@sz06.service

Edit 1: The strange thing, If I create a vm from scratch and use the vnet pvej for example it works, and there is no error. But if I have a VM that and its net0 Adapter gets changed via web-ui, it does not work and bringup the message from above.

Edit: Can be reproduced with: create a vm with vnet01, change vnet01 to vnet02, get a error. Creating a vm with vnet02 from scratch does not bring up that error.
 
Last edited:
Can you post the contents of the SDN configuration files? (/etc/pve/sdn/*.cfg)
 
Can you post the contents of the SDN configuration files? (/etc/pve/sdn/*.cfg)

Thanks! Here you are.

Edit 1: It might be a issue, that I edited the files, seems like creating a new sz a new vnet and new subnet via webui, does not lead to that issue.
 

Attachments

  • subnets.cfg.txt
    1.7 KB · Views: 2
  • vnets.cfg.txt
    366 bytes · Views: 0
  • zones.cfg.txt
    596 bytes · Views: 2
Last edited:
Ok thanks, Ill delete everything and will use pvesh

Seems like this is the right direction:
Code:
delete sdn subnet object failed: zone 'sz10' doesn't exist in IPAM DB (500)
 
Last edited:
yes, this is the way if you want to do with cli or automate it.
Thanks! Do you know howto use --dhcp-range on pvesh? I looked at the api-viewer online but I dont get howto put in the range here.

Code:
root@PMX7:~# pvesh create cluster/sdn/vnets/pveb/subnets/ --subnet 192.168.30.0/24 --type subnet --gateway 192.168.30.1 --snat 1 --dhcp-range [192.168.30.10-192.168.30.30]

dhcp-range[0]: invalid format - value without key, but schema does not define a default key
 
Thanks! Do you know howto use --dhcp-range on pvesh? I looked at the api-viewer online but I dont get howto put in the range here.

Code:
root@PMX7:~# pvesh create cluster/sdn/vnets/pveb/subnets/ --subnet 192.168.30.0/24 --type subnet --gateway 192.168.30.1 --snat 1 --dhcp-range [192.168.30.10-192.168.30.30]
Should work like this:

Code:
-dhcp-range start-address=10.0.1.100,end-address=10.0.1.200
 
  • Like
Reactions: jsterr
I somehow broke IPAM and dnsmasq i guess. I deleted everything and recreated all with pvesh, the prev error is gone, but I still dont get IP-Adresses on any of the zones, although they have autodns-enabled and correctly defined subnet.

Seems like I broke the ipam database or location where the information is store. Is there a way to recreate ipam (pve) database or check if its ok? IPAM in Web-UI also does not show a single item.

1724244785228.png
 
Does /etc/pve/priv/ipam.db exist?
Are there any JS errors in the browser console?
 
Does /etc/pve/priv/ipam.db exist?
Are there any JS errors in the browser console?

Yes this file exists.

Code:
root@PMX7:/etc/pve/priv# ls -lisah | grep ipam
191246 512 -rw------- 1 root www-data  740 Aug 21 13:54 ipam.db

There are no errors in the logs, neither the node nor the cluster-log. vms come up with 0.0.0.0/24 as a ip-address
Not sure bout the js-errors. anything i should look for specificly or can you explain howto check for the errors that might be relevant?

Edit: this is the log, when I start a vm, that should get a ip from dnsmasq:

Code:
GET https://10.2.1.135:8006/api2/json/nodes/PMX7/qemu/201/agent/network-get-interfaces 500 (QEMU guest agent is not running)

no other messages unfortunatly. I also created a new zone,vnet and subnet while having the browser-console open, no errors.
 
Last edited:
Found some errors in the dnsmasq service, could be "no file" as It might only get created when dhcp offerd a ip.


Code:
 dnsmasq@zpvea.service - dnsmasq (zpvea) - A lightweight DHCP and caching DNS server
     Loaded: loaded (/lib/systemd/system/dnsmasq@.service; enabled; preset: enabled)
    Drop-In: /usr/lib/systemd/system/dnsmasq@.service.d
             └─00-dnsmasq-after-networking.conf
     Active: active (running) since Wed 2024-08-21 15:11:31 CEST; 2min 46s ago
   Main PID: 52760 (dnsmasq)
      Tasks: 1 (limit: 309237)
     Memory: 760.0K
        CPU: 44ms
     CGroup: /system.slice/system-dnsmasq.slice/dnsmasq@zpvea.service
             └─52760 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.zpvea.pid -u dnsmasq -7 "/etc/dnsmasq.d/zpvea,*.conf" --conf-fi>

Aug 21 15:11:31 PMX7 dnsmasq[52760]: compile time options: IPv6 GNU-getopt DBus no-UBus i18n IDN2 DHCP DHCPv6 no-Lua TFTP conn>
Aug 21 15:11:31 PMX7 dnsmasq[52760]: DBus support enabled: connected to system bus
Aug 21 15:11:31 PMX7 dnsmasq-dhcp[52760]: DHCP, static leases only on 192.168.20.0, lease time infinite
Aug 21 15:11:31 PMX7 dnsmasq-dhcp[52760]: IPv6 router advertisement enabled
Aug 21 15:11:31 PMX7 dnsmasq-dhcp[52760]: DHCP, sockets bound exclusively to interface pvea
Aug 21 15:11:31 PMX7 dnsmasq[52760]: reading /etc/resolv.conf
Aug 21 15:11:31 PMX7 dnsmasq[52760]: using nameserver 192.168.110.61#53
Aug 21 15:11:31 PMX7 dnsmasq[52760]: cleared cache
Aug 21 15:11:31 PMX7 dnsmasq[52760]: cannot read /etc/dnsmasq.d/zpvea/ethers: No such file or directory
Aug 21 15:11:31 PMX7 systemd[1]: Started dnsmasq@zpvea.service - dnsmasq (zpvea) - A lightweight DHCP and caching DNS server.
 
Last edited:
Code:
Aug 21 15:11:31 PMX7 dnsmasq[52760]: cannot read /etc/dnsmasq.d/zpvea/ethers: No such file or directory

This shouldn't be an issue, it gets created as soon as there are IPAM entries and until then dnsmasq just chugs along...


How does the ipam.db file look like?
Is the firewall active?
Have you restarted the VMs (via the Proxmox Web UI)?
 
Code:
Aug 21 15:11:31 PMX7 dnsmasq[52760]: cannot read /etc/dnsmasq.d/zpvea/ethers: No such file or directory

This shouldn't be an issue, it gets created as soon as there are IPAM entries and until then dnsmasq just chugs along...


How does the ipam.db file look like?


Code:
root@PMX7:/etc/pve/priv# cat ipam.db
{"zones":{"sz02":{"subnets":{"192.168.199.0/24":{"ips":{"192.168.199.1":{"gateway":1},"192.168.199.10":{"hostname":"pve-1","vmid":"301","mac":"BC:24:11:3C:F2:D9"},"192.168.199.12":{"mac":"BC:24:11:1C:4E:7E","vmid":"303","hostname":"pve-3"},"192.168.199.11":{"hostname":"pve-2","vmid":"302","mac":"BC:24:11:EF:7B:2D"}}}}},"sz01":{"subnets":{"192.168.199.0/24":{"ips":{"192.168.199.13":{"hostname":"pve-3","vmid":"203","mac":"BC:24:11:0D:47:E4"},"192.168.199.10":{"vmid":"201","mac":"BC:24:11:36:66:3E","hostname":"pve-1"},"192.168.199.11":{"hostname":"js-autopve-01","mac":"BC:24:11:D4:C0:22","vmid":"116"},"192.168.199.12":{"hostname":"pve-2","mac":"BC:24:11:09:CF:B8","vmid":"202"},"192.168.199.1":{"gateway":1}}}}},"sz11":{"subnets":{}},"zpvek":{"subnets":{"192.168.120.0/24":{"ips":{"192.168.120.10":{"hostname":"pve-3","mac":"BC:24:11:1B:64:C9","vmid":"203"},"192.168.120.1":{"gateway"

Seems like ohly zpvek worked. this was one zone I created via web-ui. Web-UI only shows zpvek, the other entries from the .db-file are not visible, all other zones neither zpvej zpvei etc.

The others are the ones I created with pvesh, do not work. Can you explain why? This is what I used:

Code:
pvesh create cluster/sdn/zones --type simple --zone zpvea --dhcp dnsmasq
pvesh create cluster/sdn/vnets --vnet pvea --zone zpvea
pvesh create cluster/sdn/vnets/pvea/subnets/ --subnet 192.168.20.0/24 --type subnet --gateway 192.168.20.1 --snat 1 --dhcp-range start-address=192.168.20.10,end-address=192.168.20.20
pvesh set cluster/sdn


Edit: I might have found the error, because ipam is not referenced in my command-set. Im sorry, will try again! pve-ipam is defaulted on web-ui and not optional.
 
Last edited:
It does work now! Thanks for your help, should I delete the old entries in the .db-file? There is content in it, which is not represented in the web-ui
 

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!