There are a few files and commands:
Should at least have this:
If the machine is on a local area network, this too:
192.168.0.4 hostname.example.com hostname
The above entry states that your private network accessible ip address is 192.168.0.4, your short hostname is “hostname” and your domain name is example.com. Your “full” hostname is “hostname.example.com” and your domainname is “example.com”.
You can manually set your machine to use this with the following command:
This should make the file /etc/hostname contain “hostname.example.com”.
There are a few options, but we’ll cover search and nameserver. Search is for your domain name, in this case “example.com”, so if you have another host named “hostname2” and you ping “hostname2”, the first thing the name resolver will do is search the “example.com” domain. Nice.
The nameserver item is for public (or network specific) domain name servers. You want to use a provider you trust, like your ISP. Here’s a quick example:
search example.com nameserver 220.127.116.11
(18.104.22.168 is a dns server run by Verizon. It’s slow but easy to remember!)
Almost done! Just check with the following commands: