Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Windows, the c:\windows\system32\drivers\etc\hosts file lets you add aliases to IPs so you can remember those computers with a familiar name.

Here's the header of the HOSTS file, for example
=====================

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server

=======================

What is the equivalent mechanism in Linux ? (RHEL 6.3, to be specific) ? What file do I need to modify/configure to get aliases for IPs ?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

The equivalent is /etc/hosts and the format is the same:

$ cat /etc/hosts
## '#' denote comments
## host IP       host alias
102.54.94.97     rhino.acme.com

You can read about the hosts file in its manual page, accessible through man hosts.

share|improve this answer
    
The little diffrence is that you may add as many aliases as you want in Linux's /etc/hosts –  Kwaio Sep 2 '13 at 15:20
    
@Kwaio And what makes you think you can't do that on Windows? –  Bob Sep 2 '13 at 15:29
    
Oh well it's just not mentionned in the aforementionned commented lines –  Kwaio Sep 3 '13 at 8:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.