Ubuntu Server set up static IP and DNS

Source: Internet
Author: User

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
addressIs the native IP address
netmaskSubnet mask
gatewayGateway

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

    • This article fixed link: http://piaoyun.cc/ubuntu-server-ip-dns.html

    • Reprint Please specify: Floating clouds


Ubuntu Server set up static IP and DNS

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.