Set IP:
Vim/etc/network/interfaces
The following will be included:
Auto Eth0
Iface eth0 inet DHCP
Modified to:
Auto Eth0
#iface eth0 inet DHCP
Iface eth0 inet Static
Address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
Gateway xxx.xxx.xxx.xxx
Set the xxx.xxx.xxx to the information you want to be personalized, which
auto eth0
#开机自动连接网络
iface eth0 inet static
# static
indicates use of a fixed IP, dhcp
stating that using dynamic IP
address
Is the native IP address
netmask
Subnet mask
gateway
Gateway
If you use nano
editing,
Ctrl+o #保存配置
Ctrl+x #退出
Set up DNS
The DNS information of the Linux system is saved in/etc/resolv.conf, but in Ubuntu you will find hints with the following text when you open this file with vim
DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
So can not directly personality this file, this content may be overwritten
In Ubuntu the DNS information is placed in the/etc/resolvconf/resolv.conf.d/directory
In general, this directory has base and head two folders
Vim/etc/resolvconf/resolv.conf.d/base
NameServer 8.8.8.8
NameServer 114.114.114.114
Save after execution
Resolvconf-u
Use the following command to make the network settings effective
Service Networking Restart
sudo/etc/init.d/networking restart
Ubuntu Server set up static IP and DNS