Results 1 to 5 of 5
Hi i'd like to know how to configure the /etc/hosts file for a server with 2 nics, 1 on LAN and 1 on WAN. from what i understand it should ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-14-2011 #1
- Join Date
- Nov 2011
i'd like to know how to configure the /etc/hosts file for a server with 2 nics, 1 on LAN and 1 on WAN.
from what i understand it should look like this :
127.0.0.1 localhost localhost.localdomain.local
192.168.0.1 lanserver lanserver.localdomain.local
is this the right way ?
i know it's very important to configure this correctly as many services depend on it.
Thx a lot for your answers
- 11-14-2011 #2
It all depends on what's in your resolv.conf file. If it says 'hosts' first, then yes it's quite important. Remember that this file is really there to allow quick, local name resolution without having to go talk to the DNS system. If DNS is working correctly, then any names it supplies don't need to be repeated in this file unless you have need to talk to them frequently.
For security purposes, you probably want to list in here any machines that your essential services use, perhaps machines where backups are run or where data is backed up to - then your services cannot be compromised by someone hijacking the DNS system.
Apart from that, the layout you've got here is fine.
Last edited by Roxoff; 11-14-2011 at 02:41 PM.Linux user #126863 - see http://linuxcounter.net/
- 11-14-2011 #3
In general I would have localhost defined in there, and nothing else.
Further DNS configuration should be done via a real DNServer,
because you want to have that information/configuration in a central place and not scattered (and probably inconsistent) over many.
There are two exceptions:
1) A DNServer like dnsmasq, which directly reads from /etc/hosts to serve that info
2) If you intentionally insert hosts in /etc/hosts to avoid dns lookups for performance reasons.
Note, that this needs some planning and tight control over all machines, with a system management tool like puppet or cfengine.
In your case, I would advise to use a DNServerYou must always face the curtain with a bow.
- 11-16-2011 #4
- Join Date
- Apr 2011
What if I just wanted to limit access to a site on my child's Computer
I hear what your saying I do make edit to the host file to block or redirect some site. At least until she finds out what I am doing
- 11-16-2011 #5
- Join Date
- Feb 2005
@jpro6363: The hosts file is a cumbersome method of implementing a content/parental filter. Have a search for "parental controls linux" or something along those lines.