Settings for Linux DNS

Source: Internet
Author: User
Tags nameserver

Production server: CentOS 6.8

Task: Set the public IP address, including DNS and host settings.

Overview:

Public IP: The Internet computer gets an IP address that is not a reserved address on the Internet, and the public computer and other computers on the Internet are free to access each other.

Dns:dns, also known as the domain Name System, the Internet as a domain name and IP address mapping of a distributed database, can make users more convenient access to the Internet, rather than to remember the machine can be directly read the number of IP strings.

Host:hosts is a system file with no extension, its basic function is to set some commonly used URL domain name and its corresponding IP address to establish an association "database", when the user enters a browser in a need to log in the URL, the system will first automatically from the Hosts file to find the corresponding IP address, Once found, the system will immediately open the corresponding webpage, if not found, then the system will submit the URL to the DNS domain name resolution server for IP address resolution, if found to be blocked IP or domain name, will prohibit the opening of this page!

Host has 3 functions:

1. speed up Domain name resolution

2. Blocking Websites

3. convenient for local area network users

Operation Steps:

1. public IP and configuring DNS

[[Email protected]/]# cd/etc/sysconfig/network-scripts/

[Email protected] network-scripts]# VI ifcfg-eth0

Device=eth0

Bootproto=static #设置为静态IP

Ipaddr=117.40.*.* #设置公网IP地址

netmask=255.255.240.0

gaeway=117.40.239.* #设置网关

Hwaddr=00:21:97:68:f2:70

Type=ethernet

uuid=480c82ca-d673-466d-902a-9f31eaeb897c

Onboot=yes #系统启动时自动启动网络

You can also add DNS in this step:

[Email protected] network-scripts]# VI ifcfg-eth0

Device=eth0

Bootproto=static #设置为静态IP

Ipaddr=117.40.*.* #设置公网IP地址

netmask=255.255.240.0

gaeway=117.40.239.* #设置网关

Dns=202.101.*.* #设置DNS

Hwaddr=00:21:97:68:f2:70

Type=ethernet

uuid=480c82ca-d673-466d-902a-9f31eaeb897c

Onboot=yes #系统启动时自动启动网络

There is a dedicated "resolv.conf" file in Linux that is responsible for DNS server address configuration

[Email protected]/]# cd/etc/

[Email protected] etc]# VI resolv.conf

NameServer 202.101.224.68 #首先DNS

NameServer 8.8.8.8 #其次DNS

NameServer 8.8.4.4


2. Host settings

[[Email protected]/]# cd/etc

[Email protected]]# VI Hosts

117.40.*.* bbs.jxatei.net Bbs.jxatei.net/forum

#公网IP对应域名, the resolution is faster.


This article is from the "Linux~dba~mba~eie" blog, make sure to keep this source http://sky9896.blog.51cto.com/2330653/1787503

Settings for Linux 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.