I'm currently coding a network configuration role used by Ansible to customize our fresh new virtual machine that came from our Debian 11 template.
I got a weird issue while I try to set up and configure 2 physical network interfaces.
When i deploy a new VM from my template, it has 2 separate vmnics, from a debian perspective it means it has only ens3 and ens4 (i don't use any bond or subinterfaces at all).
Here's the simple interfaces configuration file I setup:
# This file describes the network interfaces available on your system and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto ens3
iface ens3 inet static
address 10.0.0.1/24
gateway 10.0.0.254
dns-nameservers 10.230.100.1
dns-search mydomain.net
auto ens4
iface ens4 inet static
address 192.168.0.1/24
gateway 192.168.0.254
dns-nameservers 10.230.100.1
dns-search mydomain.net
Then, when i restart networking.service through systemctl or better, when i reboot the machine, configuration is well set from ip a
perspective but it has issues from journalctl perspective :
févr. 16 14:04:53 MY-HOST systemd[1]: Starting Raise network interfaces...
févr. 16 14:04:53 MY-HOST ifup[1100]: RTNETLINK answers: File exists
févr. 16 14:04:53 MY-HOST ifup[1078]: ifup: failed to bring up ens4
févr. 16 14:04:53 MY-HOST systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
févr. 16 14:04:53 MY-HOST systemd[1]: networking.service: Failed with result 'exit-code'.
févr. 16 14:04:53 MY-HOST systemd[1]: Failed to start Raise network interfaces.
Once i reboot the server, I still have a lot of these issues but configuration seems well set up
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 50:6b:8d:d0:c0:3d brd ff:ff:ff:ff:ff:ff
altname enp0s3
inet 10.0.0.1/24 brd 10.0.0.255 scope global dynamic ens3
valid_lft 2147483506sec preferred_lft 2147483506sec
3: ens4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 50:6b:8d:8a:24:94 brd ff:ff:ff:ff:ff:ff
altname enp0s4
inet 192.168.0.1/24 brd 192.168.0.255 scope global dynamic ens4
Moreover, if i manually sudo ifdown ens4
then sudo ifup ens4
i got the following error :
ifdown: interface ens4 not configured
RTNETLINK answers: File exists
ifup: failed to bring up ens4
I figure out that if I comment out auto ens4
in my interfaces file, i do not have any error but when i reboot, ens4 isn't up so that's not a solution for me...
My question is : How can i fix it ? do i miss something in my interfaces configuration ? or is there a mistake i didn't see ?
Thanks a lot !