Operating System - Linux
1819804 Members
3215 Online
109607 Solutions
New Discussion юеВ

Hosts file with 2 hostname or use an alias?

 
SOLVED
Go to solution
Ian Derringer
Regular Advisor

Hosts file with 2 hostname or use an alias?

Hi,
I would like to add another hostname to my hosts file to solve an my smtp issue. I also read something about an alias you can use in the hosts file as well. I am a newbie and still learning, and these servers just happen to be in production at the moment. I backed up my hosts file for safe keeping. Below, is an example what I have for my hosts file.

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost loopback
192.100.1.100 goose.mysite.corp goose loghost
#
192.168.1.101 geese
192.168.1.102 duck

** I would like to add a line in my hosts file such as this:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost loopback
192.100.1.100 goose.mysite.corp goose loghost
192.100.1.100 goose.mysiteinc.com goose
loghost
#
192.168.1.101 geese
192.168.1.102 duck

Or should I add an alias to my hosts file? If yes, please show me how I would do that?

Thank you in advance for helping.

Ian D.
3 REPLIES 3
Rick Garland
Honored Contributor
Solution

Re: Hosts file with 2 hostname or use an alias?

Add the awlias to the /etc/host file.

Can look something like this;
192.168.1.100 goose.mysite.corp goose.mysiteinc.com goose loghost
So what you have is this IP address being referenced bny 2 different FQDN. Will still have the same short name of goose.

As to the other entry you have in which you have 2 IPs and 2 host names, this would refer to 2 sepatate systems (2 different IPs).


Gopi Sekar
Honored Contributor

Re: Hosts file with 2 hostname or use an alias?

correct entry would be,

192.100.1.100 goose.mysite.corp goose.mysite.com goose loghost


Never Never Never Giveup
Ian Derringer
Regular Advisor

Re: Hosts file with 2 hostname or use an alias?

Wow!! That was quick!

Thanks, guys!!

Ian