Set a dynamic address to PVE

Something is not right, the cluster services all fail on boot.
not sure if this is because im running pve on vmware player - that said the bridge is working fine as I can access the gui and otherwise use it as expected.

going to revisit this with fresh eyes in the morning.

thank you

No worries, you can post journalctl -u pve-cluster.service here then. Goodnight!

Also your hostname must resolve, this is why there's the avahi in the simple tutorial to avoid having to keep fixing it in static files. You can post /etc/hosts, /etc/nsswitch.conf here as well.
 
Last edited:
Hello,

here is how I switch my proxmox server to dhcp
I run this immediately after creating a new server


1. switch vmbr0 from static to dhcp with this oneliner
Code:
sed -i '/iface vmbr0 inet /s/static/dhcp/' /etc/network/interfaces

2. remove static address declaration and static gateway declaration with these two oneliners
Code:
sed -i '/^[[:space:]]*address[[:space:]]\+/d' /etc/network/interfaces
sed -i '/^[[:space:]]*gateway[[:space:]]\+/d' /etc/network/interfaces


3. remove the static entry in /etc/hosts with the following oneliner (replace with your old static IP address)

Code:
REMOVE_HOST="192.168.1.7"; sed -i "/^${REMOVE_HOST//./\\.}[[:space:]]/d" /etc/hosts

4. If you wish to have a up-to-date console banner message with the current ip address when you boot while on dhcp.
I made this oneliner command to create a service unit and have it oneshot start at boot

Code:
bash -c 'echo "[Unit]"; echo "Description=Update /etc/issue with current IP"; echo "After=network-online.target"; echo "Wants=network-online.target"; echo ""; echo "[Service]"; echo "Type=oneshot"; echo "ExecStart=/bin/bash -c '\''ip=\$(ip -4 addr show vmbr0 | grep -oP \"(?<=inet\\\\s)\\\\d+(\\\\.\\\\d+){3}\"); if [[ -n \$ip ]]; then echo \"------------------------------------------------------------------------------\" > /etc/issue; echo \"\" >> /etc/issue; echo \"Welcome to the Proxmox Virtual Environment. Please use your web browser to\" >> /etc/issue; echo \"configure this server - connect to:\" >> /etc/issue; echo \"\" >> /etc/issue; echo \"  https://\$ip:8006/\" >> /etc/issue; echo \"\" >> /etc/issue; echo \"------------------------------------------------------------------------------\" >> /etc/issue; fi'\''"; echo ""; echo "[Install]"; echo "WantedBy=multi-user.target";' > /etc/systemd/system/update-issue.service && systemctl daemon-reexec && systemctl daemon-reload && systemctl enable update-issue.service

Result, the banner now has the dhcp address on it and everything works

1751564555599.png

I suspect the cluster function might not like that ?
Perhaps it will work as long as your dhcp server has static leases for your proxmox server ? I am not sure
 
Here is a few other things I do to a fresh proxmox

https://pastebin.com/MJuhcJSc
plus install webmin is really good complement to proxmox
nagbuster is currently broken :(
also running an openwrt as bridge+reverse proxy for some VM & LXC
also setting default scaling method to local scaling (my settings-> novnc scaling)
also make the console mode "shell" by default for LXCs