Can you have more than one address associated with a single host name
in the /etc/hosts file? Will it cause any problems?
For example, if lets say that hostA has multiple interfaces, and
therefore
multiple addresses:
1.1.1.1 hostA
2.2.2.2 hostB
3.3.3.3 hostA
4.4.4.4 hostC
Will that cause a problem?
TIA,
-Tennis
I would assume if I do anything using hostA, ssh, rlogin, ping,
ftp,...., host lookup will fetch 1.1.1.1.
I'm not sure but i think yes
It is possible to have more than one IP on one interface (you create
virtual interface) and there should be no problem also with more
interfaces
> Can you have more than one address associated with a single host name
> in the /etc/hosts file? Will it cause any problems?
On Solaris you must put the IPs for any individual host on adjacent
lines in hosts. Your original hosts would only let a resolver
discover 1.1.1.1 for hostA, whereas:
1.1.1.1 hostA
3.3.3.3 hostA
2.2.2.2 hostB
4.4.4.4 hostC
would mean a resolver will find 1.1.1.1, 3.3.3.3 for hostA. It's a
subtle difference and can make/break your applications.
The man page says:
The hosts file has one entry for each IP address of each host. If
a host has more than one IP address, it will have one entry for
each, on consecutive lines.
Cheers,
Ian
Sure, no problem.
> For example, if lets say that hostA has multiple interfaces, and
> therefore multiple addresses:
>
> 1.1.1.1 hostA
> 2.2.2.2 hostB
> 3.3.3.3 hostA
> 4.4.4.4 hostC
No, that's four different hosts. You're aware that a string comparison
of "hostA" and "hostB" will come out different, right? Also forget case:
1.1.1.1 hosta host
2.2.2.2 hostb host
...