Because the company's computer every time the power-on reset assigned IP address is different, which leads to a lot of inconvenient things, so simply lock a fixed IP address, the following is the steps I lock the IP address:
1. Set the IP address
Vi/etc/network/interfaces
Add the following content:
# The Primary network interface
# ENP2S0 is your computer's network card, do not know what kind of network card, you can use the command ifconfig view
Auto Enp2s0
Iface Enp2s0 inet Static
# 192.168.2.83 is the IP address you want to fix
Address 192.168.2.83
# subnets and gateways can be viewed through route-n
Netmask 255.255.255.0
Gateway 192.168.2.1
2. Set up DNS
Vi/etc/resolvconf/resolv.conf.d/base
NameServer 114.114.114.114
NameServer 8.8.8.8
3. Refresh the configuration file
Resolvconf-u
4. Restart the Network Service
/etc/init.d/networking restart
5. Then restart the shutdown:
Using the Ifconfig command, you can see that the IP address is fixed.
ubuntu16.0.4 setting a fixed IP address and DNS