Static hostnames are locally defined hostname-to-IP mappings located in the file /etc/hosts.
Entries in the hosts file will have precedence over DNS by default. This means that if your system
tries to resolve a hostname and it matches an entry in /etc/hosts, it will not attempt to look up the
record in DNS. In some configurations, especially when Internet access is not required, servers that
communicate with a limited number of resources can be conveniently set to use static hostnames
instead of DNS.
The following is an example of a hosts file where a number of local servers have been identified by
simple hostnames, aliases and their equivalent Fully Qualified Domain Names (FQDN's).
127.0.0.1 localhost
127.0.1.1 ubuntu-server
10.0.0.11 server1 vpn server1.example.com
10.0.0.12 server2 mail server2.example.com
10.0.0.13 server3 www server3.example.com
10.0.0.14 server4 file server4.example.com
In the above example, notice that each of the servers have been given aliases in addition
to their proper names and FQDN's. Server1 has been mapped to the name vpn, server2 is
referred to as mail, server3 as www, and server4 as file.
Entries in the hosts file will have precedence over DNS by default. This means that if your system
tries to resolve a hostname and it matches an entry in /etc/hosts, it will not attempt to look up the
record in DNS. In some configurations, especially when Internet access is not required, servers that
communicate with a limited number of resources can be conveniently set to use static hostnames
instead of DNS.
The following is an example of a hosts file where a number of local servers have been identified by
simple hostnames, aliases and their equivalent Fully Qualified Domain Names (FQDN's).
127.0.0.1 localhost
127.0.1.1 ubuntu-server
10.0.0.11 server1 vpn server1.example.com
10.0.0.12 server2 mail server2.example.com
10.0.0.13 server3 www server3.example.com
10.0.0.14 server4 file server4.example.com
In the above example, notice that each of the servers have been given aliases in addition
to their proper names and FQDN's. Server1 has been mapped to the name vpn, server2 is
referred to as mail, server3 as www, and server4 as file.
Comments
Post a Comment
https://gengwg.blogspot.com/