[TriLUG] Syntax checker for /etc/hosts ?

John Vaughters jvaughters04 at yahoo.com
Fri Oct 25 09:00:24 EDT 2013


Jeremy,

No judgement on the DNS, we use host files too for secure networks and reliability reasons. A DNS goes down and your critical systems fail?? We don't want that. Not to mention, it really is not always worth setting it up if it is a reasonably small network. I won't even bother to discuss how DNS gets wacked more often than host files if you have a stable network. One thing I thought about doing was to create a database that maintains the host file for each computer and builds the host file for a specific computer. That way, you could create an interface that allows people to enter info and filter during the entering process and then build the host file correctly and send it to the box with automation including back up of old files.

I never created the tool, because we just do not have enough problems to justify the time, but it really would not be a difficult tool to build. 

Just a thought,

John Vaughters



On Thursday, October 24, 2013 4:58 PM, Jeremy Portzer <jeremyp at pobox.com> wrote:
 
Hi TriLUG,

Is there any standard command to check the syntax and "sanity" in 
/etc/hosts?
While I could write a short script easily enough to do this, I thought 
it might be a common problem and there may be some other standard way to 
check it.

We have a lot of "junior" sysadmins and they are constantly making 
mistakes with /etc/hosts .  I'd really like to parlay this into the um, 
retraining of some of these people (perhaps to another job entirely!), 
but in the mean time we need to find their mistakes. Typical errors:
* Putting a hostname first followed by the IP address   [right below a 
list of other correct entries ... *sigh*]
* Listing the same IP more than once
* Listing the same host more than once
* Not listing the FQDN first after the IP address  (this is more of a 
site policy, but we want the format to be "IP FQDN aliases") .

And yes I know that we should be using DNS and/or configuration 
management tools, and we in fact do use both, but there are lots of 
one-offs and exceptions in our environment where manual hosts files will 
still be in use for a while.

Thanks,
Jeremy
-- 
This message was sent to: John Vaughters <jvaughters04 at yahoo.com>
To unsubscribe, send a blank message to trilug-leave at trilug.org from that address.
TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
Unsubscribe or edit options on the web    : http://www.trilug.org/mailman/options/trilug/jvaughters04%40yahoo.com
Welcome to TriLUG: http://trilug.org/welcome


More information about the TriLUG mailing list