Open the Ubuntu terminal and enter:
sudo gedit/etc/network/interfaces
Indicates that the interfaces file is opened using the Gedit editor. In the open file, if there is content, delete all first. Then enter the following code:
Auto Lo
Iface Lo inet Loopback
Auto Ens33
Iface ens33 inet Static
Address 192.168.8.100
Netmask 255.255.255.0
Gateway 192.168.8.2
Configuration complete, restart Network service:
/etc/init.d/networking restart
After startup, it was found that only lo, viewing logs, found no eth0 device found.
The original Ubuntu 16.04 network card is no longer named Eth0, this and the Rhel series, this time need to see the real network card name is God horse:
Cd/proc/sys/net/ipv4/conf
As you can see in this directory, in addition to Lo, there are ens160, so the NIC name is ens160 instead of the traditional eth0, so you need to modify the name in the interface file above.
UBUNTU16 Network Settings