Modify network without restarting

ronsrussell

Renowned Member
Mar 9, 2011
51
0
71
In past versions (pre 3.4) I found it possible to modify network settings via cli by editing file /etc/network/interfaces and then restarting network services. But when I tried doing this on a new cluster (with community support license) running version 3.4-6 it did not work. This was useful when we needed to activate an unused nic port without restarting the node and associated vm's. For instance - On this cluster I have three unused nic ports and I need to activate two of them. Each of the two nic ports will be connected to a different switch port configured with new vlan's.


root@pmc1:~# pveversion -v
proxmox-ve-2.6.32: 3.4-157 (running kernel: 2.6.32-39-pve)
pve-manager: 3.4-6 (running version: 3.4-6/102d4547)
pve-kernel-2.6.32-39-pve: 2.6.32-157
pve-kernel-2.6.32-37-pve: 2.6.32-150
lvm2: 2.02.98-pve4
clvm: 2.02.98-pve4
corosync-pve: 1.4.7-1
openais-pve: 1.1.4-3
libqb0: 0.11.1-2
redhat-cluster-pve: 3.2.0-2
resource-agents-pve: 3.9.2-4
fence-agents-pve: 4.0.10-2
pve-cluster: 3.0-18
qemu-server: 3.4-6
pve-firmware: 1.1-4
libpve-common-perl: 3.0-24
libpve-access-control: 3.0-16
libpve-storage-perl: 3.0-33
pve-libspice-server1: 0.12.4-3
vncterm: 1.1-8
vzctl: 4.0-1pve6
vzprocps: 2.0.11-2
vzquota: 3.1-2
pve-qemu-kvm: 2.2-10
ksm-control-daemon: 1.1-1
glusterfs-client: 3.5.2-1



root@pmc1:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback

iface eth0 inet manual

iface eth1 inet manual

iface eth2 inet manual

iface eth3 inet manual

iface eth4 inet manual

iface eth5 inet manual

iface eth6 inet manual

iface eth7 inet manual

auto vmbr0
iface vmbr0 inet static
address 192.168.35.231
netmask 255.255.255.0
gateway 192.168.35.7
bridge_ports eth7
bridge_stp off
bridge_fd 0

auto eth6
iface eth6 inet static
address 10.10.10.1
netmask 255.255.255.0
mtu 9126

auto vmbr1
iface vmbr1 inet static
address 192.168.34.231
netmask 255.255.255.0
bridge_ports eth1
bridge_stp off
bridge_fd 0

auto vmbr2
iface vmbr2 inet static
address 192.168.37.231
netmask 255.255.255.0
bridge_ports eth2
bridge_stp off
bridge_fd 0

auto vmbr3
iface vmbr3 inet static
address 192.168.0.231
netmask 255.255.255.0
bridge_ports eth3
bridge_stp off
bridge_fd 0

root@pmc1:~#

Thanks for any assistance - Ron
 
A dirtier but "easier" way would be to use ifdown on the interfaces that will be removed or changed, then move the interfaces.new file over the interfaces file and use ifup on the interfaces. This can of course influence running VMs, containers and programs.
If you replicate the exact state the new interface file would produce then, too, you can move the new file over the old one if you don't need the old info anymore.
 

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!