Ubuntu change the name of the card : ens3 => eth0
Step 1: First, switch to the root account and vi / etc / default / grub;
Step 2: Parameter GRUB_CMDLINE_LINUX added net.ifnames = 0 biosdevname = 0;
Step 3: Then save the file, execute the command update-grub
Step 4: Edit the file / etc / network / interface save and reboot ubuntu
Step 5: Finally verify whether the amendment is successful
NIC configuration file : / etc / network / interface
modifications:
1. to root modification
2. sudo command authorization
The default configuration file contents:
cheng@ubuntu:~$ sudo cat /etc/network/interfaces
# 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 eth0
iface eth0 inet dhcp
Modify, add static address :
cheng@ubuntu:~$ sudo vi /etc/network/interfaces
# 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 eth0
iface eth0 inet static
address 192.168.40.14
gateway 192.168.40.1
netmask 255.255.255.0
Restart the network :
cheng@ubuntu:~$ sudo /etc/init.d/networking --help
Usage: /etc/init.d/networking {start|stop|reload|restart|force-reload}
cheng@ubuntu:~$ sudo /etc/init.d/networking restart
[ ok ] Restarting networking (via systemctl): networking.service.
Add a card eth1
auto eth1
iface eth1 inet static
address 192.168.40.15
netmask 255.255.255.0
gateway 192.168.40.1