Configure HostName and DNS for CentOS basic network

Source: Internet
Author: User
1. set the host name. for example, set the host name to local.domain.com and add or modify HOSTNAME = local.domain.com in the/etc/sysconfig/network file.

1. set the host name

For example, set the host name to local.domain.com.

Add or modify the/etc/sysconfig/network file

  HOSTNAME=local.domain.com

The modification of the above files does not take effect immediately and the system needs to be restarted. Therefore, enter

  hostname=local.domain.com

It will take effect without restarting the server;

 

II. set DNS service

Modify/etc/resolv. confg. common parameters are as follows:

nameservice dnsService1nameservice dnsService2search domain1.com domain2.com

For other configurations of this/etc/resolv. conf file, refer:

Http://man.chinaunix.net/linux/debian/debian_learning/ch11s13.html

 

3. local hosts file

Follow the following format in/etc/hosts:

1 ip_address host_name

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.