When you flip VLAN-aware on the bridge in node->system->network ?

shodan

Active Member
Sep 1, 2022
343
79
48
Hi,

I run dhcp client on proxmox web interface
and I found one of the few problem this causes is that
if you flip the vlan aware flag in node->system->network
then it will revert networking to manual (with no settings)
which renders the server unreachable

So I'm trying to find, exactly what happens and what executes when you change those settings ?

1794103175661.png

And a related issue, is that, even after resolving the issue (restoring dhcp to the bridge) then none of the VMs had networking until I rebooted them.

So I figure while making this dialog less disruptive, it seems there's also a bug in the networking system that causes bridge reconfiguration to break networking on the VMs and that is probably something that can be fixed as well.
 
Hi,

I run dhcp client on proxmox web interface
Using DHCP on the host is not supported. That's also why changing any settings in the web UI will automatically set it to static again.
If you really want to use DHCP, it can work, but means editing files by hand and it may break spontaneously since the Proxmox VE stack does not consider this.

So I figure while making this dialog less disruptive, it seems there's also a bug in the networking system that causes bridge reconfiguration to break networking on the VMs and that is probably something that can be fixed as well.
What do you mean exactly here? For this, a lot more information would be needed (/etc/network/interfaces, VM configurations, etc.) - but might also be caused by the DHCP setup.
 
Yes, I know it is not supported, I am trying to resolve the issues related to it.

I've been living with dhcp on the webui for a while, I didn't find any real issues until now, when I tried to flip vlan awareness on the bridge.
And the problem was simply that the script that changes those variables, switched the bridge the manual with empty static values, so the server became unreachable.

This is an easy fix, the script that control this should not rewrite the bridge protocol when asked to switch vlan awareness, it should only touch the vlan awareness lines

Code:
auto vmbr0
iface vmbr0 inet dhcp
        bridge-ports enp10s0
        bridge-stp off
        bridge-fd 0
        bridge-vlan-aware yes
        bridge-vids 2-4094

That is an easy fix, I am just asking what is the script that runs after the dialog "Edit: Linux bridge"


But also, I uncovered another issue.

When I ran

systemctl restart networking

Networking on all VMs and all CT containers broke.
And the only way I found to resolve that, was to restart each of them

There is probably a way to repair them without a reboot.
But also the change in bridge configuration should not leave the VMs and CTs in a broken networking state

Also my testing here is on Proxmox 8, this might have been resolved but I doubt it.

Anyway, regardless of whether this is supported or not, I think both of these things should be looked into as I do think they are minor and easy fixes to make these settings less dangerous.
 
When I ran

systemctl restart networking

Networking on all VMs and all CT containers broke.


[0] https://pve.proxmox.com/pve-docs/chapter-sysadmin.html#_live_reload_network_with_ifupdown2
 
  • Like
Reactions: fba and cheiss
For your question about which code runs, the PVE 8 network editor is in proxmox-widget-toolkit/src/node/NetworkEdit.js. Editing an existing bridge sends PUT /api2/extjs/nodes/{node}/network/{iface}. On the PVE 8 branch, update_network recalculates the IPv4 method from the submitted address field. It sets static when that field has an address and manual when it does not. That is where the edit can rewrite an existing inet dhcp stanza even when you only toggle VLAN awareness. PVE 8 network editor · PVE 8 network API handler

On a lab node, check the pending diff right after saving the edit. If /etc/network/interfaces.new already says inet manual, you have isolated the rewrite before applying anything. Apply Configuration is a separate operation that activates the pending file and runs ifreload -a. This gives you a reproducible report without testing on the live management bridge. PVE 8 Apply handler

OpenAI Codex assisted with drafting this reply.
 

[0] https://pve.proxmox.com/pve-docs/chapter-sysadmin.html#_live_reload_network_with_ifupdown2
Yes, using ifreload -a in my case worked to reset the interface without disrupting the VM's network.
In my case I was only switching the bridge from static to dhcp.
I wonder if it would be possible to restart networking but then also restore the networking for VMs and CTs. Restarting networking shouldn't disrupt so much that it requires a reboot !

For your question about which code runs, the PVE 8 network editor is in proxmox-widget-toolkit/src/node/NetworkEdit.js. Editing an existing bridge sends PUT /api2/extjs/nodes/{node}/network/{iface}. On the PVE 8 branch, update_network recalculates the IPv4 method from the submitted address field. It sets static when that field has an address and manual when it does not. That is where the edit can rewrite an existing inet dhcp stanza even when you only toggle VLAN awareness. PVE 8 network editor · PVE 8 network API handler

On a lab node, check the pending diff right after saving the edit. If /etc/network/interfaces.new already says inet manual, you have isolated the rewrite before applying anything. Apply Configuration is a separate operation that activates the pending file and runs ifreload -a. This gives you a reproducible report without testing on the live management bridge. PVE 8 Apply handler

OpenAI Codex assisted with drafting this reply.

Yes, I also used an LLM to trace the request through the code.

That seems to be the main difficulty in making Proxmox support dhcp for the web interface, the dialog, the API call, the perl backend all need to be modified to add dhcp support.

But the code already mostly exists for CT containers, I suspect 95% of that code could be reused to change the edit bridge code.

1794508747711.png

Here is the analysis

1794508757231.png

RepositoryFileRole
proxmox-widget-toolkitsrc/node/NetworkEdit.jsEdit dialog
proxmox-widget-toolkitsrc/window/Edit.jsOK / submit
proxmox-widget-toolkitsrc/Utils.js API2Request
pve-managerPVE/Service/pveproxy.pmHTTPS service
pve-http-serversrc/PVE/APIServer/AnyEvent.pmHTTP server and API dispatch
pve-managerPVE/API2/Nodes.pmRoute registration
pve-managerPVE/API2/Network.pm Network update API
pve-commonsrc/PVE/INotify.pm Config file read/write

And this is close up of the interface write sequence

1794508834100.png

API receives edited settingspve-managerPVE/API2/Network.pm
Staged file selection and temporary-file renamepve-commonsrc/PVE/INotify.pm
Conversion from network data structure into textpve-commonsrc/PVE/Network/Interfaces.pm
Promotion of .new to active filepve-managerPVE/API2/Network.pm
Applying configuration to Linuxifupdown2ifreload implementation