One, configure IP
Ubuntu Network configuration information is placed in the/etc/network/interfaces, if the configuration dynamically acquire IP, then add the following in the above file: auto eth0 iface eth0 inet DHCP as Configure static IP, add the following: Auto eth0 iface eth0 inet
StaticAddress 192.168.33.201 netmask 255.255.255.0 gateway 192.168.33.1 If the configuration takes effect, you need to restart the NIC: ifconfig eth0 down I Fconfig eth0 up is not root, the command is preceded by sudo and then with the Ifconfig command to see if the IP is configured successfully, the result of a successful configuration is as follows: If there is no successful configuration, you need to restart the network service /etc/init.d/networking Restart Configure DNS server (restart invalidation) for Ubuntu DNS server information, put it in/etc/resolv.conf, add DNS server address, such as 202.11 2.125.53, in the above file added nameserver 202.112.125.53 Three, resolv.conf restart the machine after the failure of the problem
1/etc/resolv.conf is actually a link
It's actually pointing to/run/resolvconf/resolv.conf.
2 Ubuntu has a resolvconf service, if you restart it, then/etc/resolv.conf content will be modified to the default appearance
So you can't modify/etc/resolv.conf directly.
3 If you want to define your own nameserver, there are 2 ways to do this:
A in the network card configuration file add:
Iface eth0 inet Static
Address 192.168.3.3
Netmask 255.255.255.0
Gateway 192.168.3.1
Dns-nameservers 192.168.3.45 192.168.8.10
Dns-search foo.org bar.com
B Modify the configuration file for the resolvconf service:/etc/resolvconf/resolv.conf.d/base
Add to:
NameServer 192.168.1.254
This ensures that the configuration will be written to/etc/resolv.conf in the case of a machine restart or a resolvconf service restart
In fact,/etc/resolv.conf inside has always been a hint:
"Do not EDIT this FILE by HAND--YOUR changes'll be overwritten" (There is a hint that this is true) Update DNS settings, sudo resolv.conf-u
Then restart NetworkManagersudo restart Network-manager
Static IP, DNS configuration under Ubuntu