Proxmox – Change and Apply Network Interface Configuration via Command Line Interface


When you need to change the network configuration of your Proxmox hosts you probably want to do that via the web interface. Most of the times. But then there are situations when you need to make changes directly to the /etc/network/interfaces file for example. Like when you need to add post-up iptable commands. Then you also need to apply these changes via command line. From what I experienced it is a good practice to align this procedure with the way Proxmox would do this when you use the web interface.


Create a script that uses Proxmox’ internal workflows to apply changed network configurations. Therefore the script copies /etc/network/interfaces file (where you made all your changes to the config) to /etc/network/ and restarts the networking service. Proxmox will then grab the /etc/network/ file and apply its content to the network infterfaces.

The script itself is created in a directory that is contained in the $PATH environment variable so one can call it from anywhere without remembering the complete path to the script.

Here are the steps to use the script:

# Create the script with the content from the section at the bottom of this page
$ sudo nano /usr/local/bin/apply_pve_network_config
# Make the script executable
$ sudo chmod +x /usr/local/bin/apply_pve_network_config
# Call the script
$ apply_pve_network_config

Here is the content of the script:


# Test for sufficient priviliges
if !  [ -w "/etc/network/interfaces" ]
        printf "[\e[31m-\e[0m] Please run this script as a privileged user (i.e. with the help of sudo)\n"
        exit 1
        printf "Restarting network ...\n"

# Use Proxmoxes toolchain to apply a changed configuration
cp /etc/network/interfaces /etc/network/
systemctl restart networking.service

printf "[\e[32m+\e[0m] Configuration updated.\n"

exit 0

Software Versions used

  • Proxmox: 7.1