localhost or LAN addresses in /etc/hosts

Bart Silverstrim bsilver at chrononomicon.com
Tue Dec 16 15:43:05 UTC 2008


Chris G wrote:
> On Tue, Dec 16, 2008 at 08:58:43AM -0500, Bart Silverstrim wrote:

>> I think the important thing at this particular point is to have everyone 
>> just stop and review what the actual question is and what the options 
>> are and then go from there. It sounds almost like now Chris (you're the 
>> original poster, yes?) wanted a setup on a small network for DHCP 
>> and...what? Making sure particular machines had the same IP every time? 
>> Making sure they have particular DNS names? What is it exactly you're 
>> trying to do on your network?
>>
> I'm trying to use it!  :-)  I don't mind in the slightest whether it
> uses/needs a DHCP server, or dnsmasq, or does clever things in the
> router.  I want whichever of these various approaches will give me the
> simplest network to set up and maintain.

Okay,...what isn't working?

The *simplest* would be static IP's across the board and you'd 
memorize...believe me if you use them it won't take long...the IP 
address of the device(s) you use, especially if it's a small network.

Do you require simplified names for things? If you have a few specific 
systems you use like that,...are you accessing them from Linux, or 
another OS? And how many systems are we talking about here?

>> There are twelve ways to do things on any given network and if you 
>> really want to do it the old fashioned way, give every device you will 
>> constantly use a static IP, set up your Linux box as a DNS caching 
>> server with your internal records authoritative for your internal IP's 
>> and forwarding non-internal requests to your external DNS, and you'll 
>> speed up your DNS searches in addition to having network names set up. 
>> Set up DHCP for whatever block you want visitors to use, document your 
>> network map, and you should be good to go. Would that work?
>>
> Probably, but it will need more configuration and management than is
> strictly necessary surely.

Only in the beginning. Once set up the record keeping should be pretty 
robust. Most implementations you just set up one file and restart the 
service to refresh the records.

>> I'm sure I'm missing what additional functionality you're looking for, 
>> but this is a simple way to add the services that have been being hashed 
>> in the thread for awhile here...
>>
> When I started this thread I was just asking if *removing* the
> 127.0.0.x entries in /etc/hosts which have the name of the local
> machine in them would break anything.  

It can, yes. There are some programs that will have troubles, but I 
can't remember specifically. It's one of those things you normally do 
not tinker with, entries for localhost.

>If I do that then dnsmasq
> provides all I need on the local network with *very simple*
> configuration.  To me it seems much simpler to do things this way than
> other approaches that have been suggested here, it may not be for
> everyone but that's not really the issue.

For small networks (how many do you have again, devices?) I've never run 
into anyone running dnsmasq. Most people have one or two computers they 
primarily use and more than that, they're techies, and they end up 
memorizing IP's anyway. What functionality are you looking for out of 
dnsmasq in particular that you're lacking now?

A number of people have shared their configs, and in my experience 
techies are lazy with their technology, going with the simplest setups 
for them that keep them from pulling their hair out. Generally speaking 
it sounds like the consensus is assign static IPs to devices you use 
habitually on the network, edit your hosts files on primary systems, and 
DHCP your friends and transients and don't worry about hostnames for them.

That would be the simplest bet.

If you want something more complicated, the previously mentioned DNS 
server combined with a DHCP server would be a good bet.

If there's particular functionality you need maybe someone can share how 
they do it, but a list of static IP's is probably the simplest to 
maintain on small networks.




More information about the ubuntu-users mailing list