Resolving Hostnames

The last bit of configuration for a simple network connection is hostname resolution. Simply put, your computer needs to know how to translate a name such as www.example.com to an IP address. Without this capability, your Internet connection is practically worthless—no one in their right mind advertises IP addresses for Web sites and email addresses, partly because a host's IP address is subject to change, but also because it's not easy to remember a bunch of numbers.

The most basic way to do this mapping is with the /etc/hosts file, which looks like this:

127.0.0.1       localhost
10.1.1.3        atlantic.aem7.net       atlantic
10.1.1.4        pacific.aem7.net        pacific

In the bad old days, there was one central hosts file that everyone repeatedly copied ...

Get How Linux Works now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.