Static IP, DNS configuration under Ubuntu

Source: Internet
Author: User
Tags nameserver

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.