Since the ip is easy to change after Ubuntu restarts, the ip address can be fixed in the following way
1. Set ip address
vi /etc/network/interface
# The loopback network interfaceauto lo
iface lo inet loopback
# The primary network interfaceauto ens32
iface ens32 inet static
address 192.168.159.130
netmask 255.255.255.0
gateway 192.168.2.1
2. Set dns
vi /etc/resolvconf/resolv.conf.d/base
nameserver 8.8.8.8
nameserver 8.8.4.4
3. Refresh configuration file
resolvconf -u
4. Restart network service
/etc/init.d/networking restart
If the above command fails to restart the network card, you can manually turn off the network card, and then open the network card, this is the ip has been changed, it has become the fixed ip you set
to sum up
The above is the method of setting a fixed ip address for ubuntu16.0.4 introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message. The editor will reply to you in time. Thank you very much for your support to the ZaLou.Cn website!
Recommended Posts