ethX:0 equivalent in ensX
Matthew Barrera
I'm trying to configure a failover IP in a Ubuntu 16.04 but I have ens3 where it usually was eth0.
Previously I followed this guide and I added to /etc/network/interfaces:
post-up /sbin/ifconfig eth0:X IP.DE.FAIL.OVER netmask 255.255.255.255 broadcast IP.DE.FAIL.OVER post-down /sbin/ifconfig eth0:X downI tried doing in the terminal (to test):
ifconfig post-up ens3:0 94.23.76.87 netmask 255.255.255.255 broadcast 94.23.76.87but the result was:
ens3:0: Unknown hostI know this is the new naming but I can't find any documentation on it (even the man ifconfig still uses eth0...
My config file is:
auto lo
iface lo inet loopback
auto ens3
iface ens3 inet dhcpHow should I do this?
31 Answer
Try this:
The network card configuration file of Ubuntu system is /etc/network/interfaces.
In the terminal run:
exec sudo -i
cat /etc/network/interfacesSample output:
# 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 dhcpAs you see in the above output, the Interface is DHCP enabled.
To assign an additional address, for example 94.23.76.87/24
Edit file /etc/network/interfaces:
exec sudo -i
nano /etc/network/interfacesAdd additional IP address.
# 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 dhcp
iface ens3 inet static
address 94.23.76.87/24Save and close the file.
Run the following file to take effect the changes without rebooting:
exec sudo -i
ifdown ens3
ifup ens3 1