Symptoms
Custom network interface settings specified in /etc/network/interfaces are not applied in Debian-based containers or virtual machines.Cause
Interface configuration in the file /etc/network/interfaces is automatically generated and all customizations are overwritten.
In virtual machines, the file is generated by Parallels Tools.
In containers, it is generated by scripts /etc/sysconfig/vz-scripts/dists/scripts/debian-add_ip.sh in routed mode and /etc/sysconfig/vz-scripts/dists/scripts/debian-add_netif.sh in bridged mode.
Resolution
To have those custom settings applied upon the interface's activation, the separate interface initialization script should be defined instead.1. Create /etc/network/if-up.d/additional and specify custom settings there.
Example:
[root@debian.ct ~]# cat /etc/network/if-up.d/additional
#!/bin/bash -x
[ "$MODE" = "stop" -o -z "$MODE" ] && exit 0
case "$IFACE" in
eth0) ## custom commands for eth0
ip route add mm.nn.245.0/24 via xx.yy.19.2 dev eth0
;;
esac
exit 0
[root@debian.ct ~]#2. Set correct permissions on the script:
chmod 755 /etc/network/if-up.d/additional
No
Yes