which is better/more correct for /etc/hosts
C M Reinehr
cmr at amsent.com
Wed Dec 12 13:47:53 PST 2007
Your experience trumps my academics! ;-)
On Wednesday 12 December 2007 15:40, Vu Pham wrote:
> C M Reinehr wrote:
> > Doug,
> >
> > On Wednesday 12 December 2007 11:55, Douglas J Hunley wrote:
> >> is this better:
> >> 192.168.10.1 servera,serverb,serverc
> >> or this:
> >> 192.168.10.1 servera
> >> 192.168.10.1 serverb
> >> 192.168.10.1 serverc
> >>
> >> and why is it better?
> >
> > This probably is wasting bandwidth as I'm sure you've already read the
> > manual
> >
> > and are looking for something deeper, but it states clearly:
> >> This manual page describes the format of the /etc/hosts file. This file
> >> is a simple text file that associates IP addresses with hostnames, one
> >> line per IP address. For each host a single line should be present with
> >> the following information:
> >>
> >>
> >> IP_address canonical_hostname [aliases...]
> >
> > I interpret this to mean that each line should reference a unique ip
> > address rather than duplicate the ip addresses of previous lines. My fear
> > is that placing each alias on a separate line would result either in the
> > second & third alias being ignored, or in the first and second being
> > ignored/overwritten by the last entry.
>
> I think /etc/hosts is for finding an IP address for a given name
> therefore different names to one ip address should work.
>
> Below are three names in my /etc/hosts and the ping results.
>
> [root at o ~]# cat /etc/hosts
> [...]
> 192.168.249.1 router
> 192.168.249.1 routertoo
> 192.168.249.1 whocares
>
> [root at o ~]# ping router
> PING router (192.168.249.1) 56(84) bytes of data.
> 64 bytes from router (192.168.249.1): icmp_seq=1 ttl=255 time=0.330 ms
> 64 bytes from router (192.168.249.1): icmp_seq=2 ttl=255 time=0.317 ms
>
> --- router ping statistics ---
> 2 packets transmitted, 2 received, 0% packet loss, time 1000ms
> rtt min/avg/max/mdev = 0.317/0.323/0.330/0.019 ms
> [root at o ~]# ping routertoo
> PING routertoo (192.168.249.1) 56(84) bytes of data.
> 64 bytes from router (192.168.249.1): icmp_seq=1 ttl=255 time=0.314 ms
> 64 bytes from router (192.168.249.1): icmp_seq=2 ttl=255 time=0.312 ms
>
> --- routertoo ping statistics ---
> 2 packets transmitted, 2 received, 0% packet loss, time 999ms
> rtt min/avg/max/mdev = 0.312/0.313/0.314/0.001 ms
> [root at o ~]# ping whocares
> PING whocares (192.168.249.1) 56(84) bytes of data.
> 64 bytes from router (192.168.249.1): icmp_seq=1 ttl=255 time=0.319 ms
> 64 bytes from router (192.168.249.1): icmp_seq=2 ttl=255 time=0.311 ms
>
> --- whocares ping statistics ---
> 2 packets transmitted, 2 received, 0% packet loss, time 999ms
> rtt min/avg/max/mdev = 0.311/0.315/0.319/0.004 ms
> [root at o ~]#
>
> Vu
>
> _______________________________________________
> Linux-users mailing list ( Linux-users at linux-sxs.org )
> Unsub/Password/Etc:
> http://linux-sxs.org/mailman/listinfo/linux-users
>
> Need to chat further on this subject? Check out #linux-users on
> irc.linux-sxs.org !
--
Debian 'Etch' - Registered Linux User #241964
--------
"More laws, less justice." -- Marcus Tullius Ciceroca, 42 BC
More information about the Linux-users
mailing list