Ubuntu 16 set Fixed IP address and DNS
1. Set the IP address
Vi/etc/network/interfaces
Add the following content:
# The Primary network interface
# ens160 is a network card, do not know what kind of network card, you can use the command IP addr View
Auto ens160
Iface ens160 inet Static
# set a fixed IP address, example below
Address 10.0.0.2
# subnets and gateways can be viewed through route-n
Netmask 255.255.255.0
Gateway 10.0.0.1
2. Set up DNS
Vi/etc/resolvconf/resolv.conf.d/base
NameServer 10.0.0.200
NameServer 10.0.0.201
3. Refresh the configuration file
Resolvconf-u
4. Restart the Network Service
/etc/init.d/networking restart
5. Then restart the shutdown:
Using the IP addr command, you can see that the IP address is fixed.
This article is from the "brave" blog, make sure to keep this source http://brave8898.blog.51cto.com/289041/1965352
Ubuntu 16 Set fixed IP and DNS