- Unix Socket Tutorial
- Unix Socket - Home
- Unix Socket - What is a Socket?
- Unix Socket - Network Addresses
- Unix Socket - Network Host Names
- Unix Socket - Client Server Model
- Unix Socket - Structures
- Unix Socket - Ports and Services
- Unix Socket - Network Byte Orders
- Unix Socket - IP Address Functions
- Unix Socket - Core Functions
- Unix Socket - Helper Functions
- Unix Socket - Server Example
- Unix Socket - Client Example
- Unix Socket - Summary
- Unix Socket Useful Resources
- Unix Socket - Quick Guide
- Unix Socket - Useful Resources
- Unix Socket - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Unix Socket - Network Host Names
Host names in terms of numbers are difficult to remember and hence they are termed by ordinary names such as Takshila or Nalanda. We write software applications to find out the dotted IP address corresponding to a given name.
The process of finding out dotted IP address based on the given alphanumeric host name is known as hostname resolution.
A hostname resolution is done by special software residing on high-capacity systems. These systems are called Domain Name Systems (DNS), which keep the mapping of IP addresses and the corresponding ordinary names.
The /etc/hosts File
The correspondence between host names and IP addresses is maintained in a file called hosts. On most of the systems, this file is found in /etc directory.
Entries in this file look like the following −
# This represents a comments in /etc/hosts file. 127.0.0.1 localhost 22.214.171.124 nalanda metro 126.96.36.199 netserve 188.8.131.52 mainserver centeral 184.108.40.206 samsonite 220.127.116.11 ns3.secureserver.net 18.104.22.168 ns4.secureserver.net 22.214.171.124 www.google.com 126.96.36.199 services.amrood.com
Note that more than one name may be associated with a given IP address. This file is used while converting from IP address to host name and vice versa.
You would not have access to edit this file, so if you want to put any host name along with IP address, then you would need to have root permission.