Advertising disclosure

Hosting Canada is community-supported. We may earn a commission when you make a purchase through one of our links. Read Disclosure.

How to Add a Host Name “Alias” in the /etc/hosts

You can add the host name and aliases of the storage system in the /etc/hosts file. You can use the setup command to rewrite the /etc/hosts file.

This process was Updated for Data ONTAP 8.1.1 on 14 June 2012, via NetApp.com

How to do this:

During setup, if you enable IPv6 on the storage system and configure IPv6 addresses for your network interfaces, these IPv6 addresses are also added to the /etc/hosts file.

From a workstation that has access to your storage system, edit the /etc/hosts file. Add the following line to the /etc/hosts file:IP_address host_name aliases

IP_address is the IP address of the host.

host_name is the name of the host.

aliases are the alias names for the host.

Example:

To add a host name, myhost, with an IP address 192.0.2.16, add the following line in the /etc/hosts file:192.0.2.16 myhost newhost myhost-e0a

newhost and myhost-e0a are the alias names for myhost.

The following is a sample /etc/hosts file:

#Auto-generated by setup Tue Apr 21 17:41:40 IST 2009
127.0.0.1 localhost
192.0.2.16    	 myhost myhost-e0a
# 0.0.0.0       myhost-e0b
# 0.0.0.0       myhost-e0c
# 0.0.0.0       myhost-e0d

The following is a sample /etc/hosts file in which an IPv6 address is also configured for the interface e0a:

#Auto-generated by setup Tue Apr 21 17:41:40 IST 2009
127.0.0.1 localhost
192.0.2.16    	 myhost myhost-e0a
2001:0db8::95   myhost myhost-e0a
# 0.0.0.0       myhost-e0b
# 0.0.0.0       myhost-e0c
# 0.0.0.0       myhost-e0d

Additional aliases via the ‘hosts’ file

Here is another approach for adding aliases via the host file, adapted from Johan Jansson @ BeTips.net

If you find yourself writing an internet address often, you can alias it to a simpler name. For example, I telnet quite often to a server at my old university: mumrik.nada.kth.se. I have aliased this to “mumrik”, so instead of having to type “telnet mumrik.nada.kth.se”, I can now type “telnet mumrik”. This alias will work with any program using internet addresses, NetPositive too, though it may be easier to make a bookmark there. Here is how you do it:

Edit the file /boot/beos/etc/hosts, create it if it isn’t there already.
Add entries with this format:
111.111.111.111 machine.domain.top alias

For example, his mumrik alias looks like this:

130.237.226.10
mumrik.nada.kth.se mumrik

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *