about hostname and FQDN differences and how to get and set

Source: Internet
Author: User

Many applications will involve FQDNs

What is the difference between a fqnd and a host that the salt gets to be different?


The FQDN

You can ' t change the FQDN (as returned by hostname--fqdn) or the DNS domain name (as returned by DnsDomainName) with this  Command. The FQDN of

The system is the name of the resolver (3) returns for the host name.


The Technically:the FQDN is the name of the gethostbyname (2) returns for the host, name returned by GetHostName (2). The DNS domain name is the

The first dot.


Therefore It depends on the configuration (usually in/etc/host.conf) how can I change it. Usually (if the hosts file is parsed before DNS or

NIS) You can change it in/etc/hosts.


If a machine had multiple network interfaces/addresses or is used in a mobile environment and then it could either have Multip Le fqdns/domain names or

None at all.  Therefore avoid using hostname--FQDN, hostname--domain and DnsDomainName. Hostname--ip-address is subject to the same limitations

So it should is avoided as well.



FQDN = short name + domain


For example: hostname Returns the result that the dev-qa001 domain is test.com and the FQDN is dev-qa001.test.com



command to return hostname

Hostname

command to return a field

DnsDomainName


command to return the FQDN

Hostname-f


Hostname-f-V

You can view detailed procedures for parsing




How to set the FQDN


Preferred method, method one set/etc/hosts

[Email protected] ~]# Cat/etc/hosts | Grep-i "Centos"

10.59.74.121 centos-6-121.test.com centos-6-121


First column IP second column fqnd third column host name (location not error, otherwise inconsistent results)

[[email protected] ~]# hostname centos-6-121[[email protected] ~]# Hostname-fcentos-6-121.test.com[[email protected] ~] # DnsDomainName test.com




Method Two: You configure DNS lookup through DNS

[Email protected] ~]# cat/etc/resolv.conf

Search a.pa.com



But your DNS must be able to parse your FQDN and return the invalidation (after you have removed the configuration in the hosts)

[Email protected] ~]# hostnamecentos-6-121[[email protected] ~]# dnsdomainname dnsdomainname:unknown host[[email Protected] ~]# hostname-fhostname:unknown host[[email protected] ~]#




If can parse, DnsDomainName for you to specify the search (can specify multiple, have a success can parse)




Three: Salt gets the FQDN when experience


The SALT-CALL-G is the most accurate through the Minion end.


Possible inconsistencies obtained through the master End Salt "dev-qa008" Grains.item FQDN


This article is from the "Tridewah operation and maintenance work Road" blog, please be sure to keep this source http://cuidehua.blog.51cto.com/5449828/1788240

about hostname and FQDN differences and how to get and set

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.