localhost or LAN addresses in /etc/hosts
Bart Silverstrim
bsilver at chrononomicon.com
Mon Dec 15 17:36:36 UTC 2008
Chris G wrote:
> On Mon, Dec 15, 2008 at 09:54:13AM -0400, Derek Broughton wrote:
>> Chris G wrote:
>>
>>> The whole point is to make things easy to configure, my router
>>> certainly *doesn't* know the names/addresses of machines on my LAN and
>>> I don't really see how it could.
>> The usual way is by the machine asking for DHCP to send its name, and
>> the router sends back an IP - and updates its local DNS. This is not
>> implemented in every router, but it's _really_ common.
>>
> So the *router* decides what the machine's name is?
The DNS server ties a name to an IP. On simple router multifunction
devices, if the DHCP and DNS server are tied together, they can be the
one to determine the name giving to the IP address.
You can have a device call itself whatever it wants...as far as the
network is concerned, other devices will consult the DNS server to find
the name, just like you can call yourself Huggybears but Uncle Sam calls
you by whatever you have on your birth certificate.
Okay, silly example, but you get the gist of it.
>>>>> No, I have static addresses assigned so it's correct. Apart from
>>>>> anything else how, otherwise, would one access things such as
>>>>> printers (my 192.168.1.44 hp7310 for example), they have to be
>>>>> fixed addresses.
>>>> No they don't, they just have to not change as long as they're on the
>>>> network.
>>>>
>>> ?? So what's the difference? :-) ...
>> Logically, none. But you can get this effect with the DHCP on any router
>> I've used.
>>
> I really don't understand this. I have two printers on my network,
> one is an HP7310 which has its own network interface the other is a
> laser printer which is accessed via an Axis print server. So, if the
> router is providing DHCP and DNS services how does it get to know
> about the printers? Presumably when I turn the Axis print server on
> it gets an IP address from the router but how does the router know
> that it's a printer and/or give it a useful name that I will know
> about and be able to use?
If I'm reading what you're being explained in the thread correctly...
If you have devices looking for your printer *by name*, then it doesn't
matter what their name is if assigned reliably via DHCP and updated in
DNS. You can name it Print-1 and no matter what the IP, if the DNS is
updated correctly each time the printer gets the IP from the DHCP server
you have the ability to find it by asking the network for Print-1.
I personally don't do this. I have network printers on a static IP and
set them up on the my systems with a static IP, so I don't need to worry
about DNS records or DHCP working properly for devices I don't move around.
My printers are set to an IP block that isn't handed out by the DHCP
server...I set aside a small number of IP's for printers that are
excluded from DHCP and then keep them as you sound like you did, static
on the printing device.
The only things on my network DHCP'd are computers.
If we're talking home routers, those SOHO devices from
Staples/newegg/whatever, chances are the @#$% things will die in less
than a year or two anyway so the less I rely on them for configuring my
network the less hassle I have replacing it.
> How is setting up MAC addresses to match devices in the router any
> easier than editing /etc/hosts? That's where I really don't follow
> what you're advising. As it is all I do is:-
Because you'd have to edit /etc/hosts on multiple machines if you have
multiple machines to administer, or if you have a mixed environment in
your home. It's a lot easier to not worry about editing files every time
you have a visitor or new computer and centralize management when you
can, but you have to balance it for your environment and preferences. I
also balance this out with the experiences where if this isn't a
thousand-dollar Cisco device we're talking about then I've had them
periodically fail on me for giggles.
I got to the point where I bought a separate switch and WAP because the
combo devices failed on me often enough to @#$!@ #!@#$#$%%%
-Bart
-Bart
More information about the ubuntu-users
mailing list