The course is part of this learning path
With this fifth course in our Linux Server Professional LPIC-1 certification series, you will learn about network configuration and management, including the basics of TCP/IP, effective IP addressing, network protocols, and ports. You will also learn about how to properly set up DNS client services, aliases and hosts, and network interfaces using the ifconfig tool and its replacement, ip. Perhaps most important of all, you will discover some of Linux's powerful network troubleshooting tools, like netstat, netcat, and traceroute.
If you have thoughts or suggestions for this course, please contact Cloud Academy at email@example.com.
Domain Name Service (DNS): mapping IP addresses to domain names
As part of the last video we briefly discussed configuring a host name for your system. As we mentioned, host names make it possible to refer to individual computers by name without having to remember their IP addresses. If this is useful for your local system, it's a thousand times more true for network resources. If you want to be able to use google.com in your browser or in scripts rather than having to remember its IP address, then you'll need access to a good DNS server to perform your address translation for you. The first place we'll have to visit is the /etc/resolv.conf file, resolv by the way is spelled without an E. This version contains only one of the two kinds of entries that are normally found. In our case it identifies two possible system name servers as 10.0.3.1 and 10.0.0.1, this means the DNS translation request will be sent to DNS servers on either of those two hosts.
In addition however you will often find a search entry which defines search domains to use for queries that don't include their own fully qualified domain names. If for example there's an entry search myplace.com in resolv.com, then searching for a simple text stream will return all matches from myplace.com. On Debian systems you can enter their DNS values in the appropriate entry from the /etc/network/interfaces files. In this example we're going to use 188.8.131.52 and 184.108.40.206, which are OpenDNS's name servers. Host is a DNS lookup tool for converting domain names to IP addresses and IP addresses to domain names. We'll use it to find out the IP address for gmail.com and the host name from my own systems IP address. DIG, which stands for domain information groper, will return much more information than host. The answer section in this dig operation shows us Gmail's a record.
If there was an authority section in this response, it would contain the DNS name server with authority over this name. DIG also shows us some stats associated with this particular request. In case DIG is not installed by default on your system you can, at least on Debian systems, download it as part of the DNS Utils package. On first glance the getent tool might seem a bit redundant, running getent with passwd for instance, will return all the entries found in the local /etc/passwd file, but then running cat /etc/passwd would do exactly the same thing.
Why do we need a separate command like getent? I believe the real value of getent is in the fact that it will even return entries available only through network sources. Such as LDAP set ups.
About the Author
David taught high school for twenty years, worked as a Linux system administrator for five years, and has been writing since he could hold a crayon between his fingers. His childhood bedroom wall has since been repainted.
Having worked directly with all kinds of technology, David derives great pleasure from completing projects that draw on as many tools from his toolkit as possible.
Besides being a Linux system administrator with a strong focus on virtualization and security tools, David writes technical documentation and user guides, and creates technology training videos.
His favorite technology tool is the one that should be just about ready for release tomorrow. Or Thursday.