SymptomsCustom network interface settings specified in /etc/network/interfaces are not applied in Debian-based containers or virtual machines.
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.
ResolutionTo 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.
[firstname.lastname@example.org ~]# cat /etc/network/if-up.d/additional
[ "$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
2. Set correct permissions on the script:
chmod 755 /etc/network/if-up.d/additional