localhost or LAN addresses in /etc/hosts

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
55 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Derek Broughton-2
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?

No, "the machine asking for DHCP" (ie, your computer) "sends"  its own
name to the DHCP server.

>> > ?? So what's the difference?  :-)  ...
[between "fixed" DHCP and static IP addresses]
>>
>> 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?

Anything connecting to the network should be capable of getting a DHCP
assigned address.

> 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?

The print server should send its own name.  Just like your computer
does.

>> > and, if they did change when,
>> > for example, a printer was turned off and then on again (as it
>> > might when using DHCP) how would the rest of the system know the
>> > printer's IP address?
>>
>> That's the point - it can't change, but that doesn't mean you need to
>> go
>> to this trouble with static addresses.  Use the DHCP on your router,
>> tell it to always assign 192.168.1.44 to the MAC address of your
>> hp7310 printer, and then even if you disconnect and reconnect, your
>> printer will always have the same address - and it _should_ be in
>> your router's DNS, too.
>>
> How is that any easier than simply giving the printer a static IP?  I
> have to faff about in the router's configuration to tell it to
> associate the MAC addres with the printer, that's just *another* place
> I have to do things.

No, that's just the ONE place you have to do things.  In the time you've
been asking us how to do this with a piece of software that you had to
add to your system, I could have done the setup dozens of times on a
router.

> I'm using dnsmasq to try and minimise that sort of hassle.

How much hassle do you think you've minimized so far?

> 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:-

You HAVEN'T got it to work with /etc/hosts - specifically because you're
trying to do something you can't do.  
 
>     Set the printer (for example) to have a fixed IP of 192.168.1.40
>
>     Put "192.168.1.40  printer" in /etc/hosts on *one* system which
>     runs dnsmasq.

Same on the router.  You don't even _have_ to have the MAC address.
 
> The printer never changes once its IP address is set, computers may
> come and computers may go but that only needs doing once.  Similarly
> if I change the computer where dnsmasq is running all I need to do is
> copy /etc/hosts and everything is done.

So do things the hard way, then, but you'd rather argue with everybody
who's telling you you simply _can't_ do it the way you want to.  Your
/etc/hosts can only have ONE (working) IP address for a single host.  
And whether dnsmasq can handle hostnames without domains or not, you
can't _treat_ "isbd" in a dns lookup from a client with no search
domains set, the same as a hostname lookup in the local /etc/hosts.  
They're doing different things, that just happen to resolve to the same
address when isbd _is_ your local host (and then only because local dns
lookup generally checks your /etc/hosts first).
--
derek


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Bart Silverstrim
Derek Broughton wrote:

> 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?
>
> No, "the machine asking for DHCP" (ie, your computer) "sends"  its own
> name to the DHCP server.

Sorry, this also can be a way to name a device.

I was thinking of situations where you can update the DNS records to a
fixed name for a given IP.


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Derek Broughton-2
In reply to this post by Bart Silverstrim
Bart Silverstrim wrote:

> 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.

My Linksys wrt54Gs have been running 3 years non-stop without any
significant problems (and I can back up their configuration easily).
 
>> 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,

Well, that's why he's using dnsmasq, and there's no real problem with
that, but he can't have it both ways - he wants to maintain everything
in one /etc/hosts, but he doesn't want to separate the "local"
information from the "LAN" information, and so he's getting conflicts.
--
derek


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Derek Broughton-2
In reply to this post by Chris Green
Chris G wrote:

> Er, no, this is where we came in!  I'm using dnsmasq on *one* machine
> in the LAN and that means I only have to edit *one* /etc/hosts and
> dnsmasq tells other machines on the network the contents of that one
> /etc/hosts via DNS.

Er, no.  That's not what dnsmasq does.  It uses your /etc/hosts (or
similar file) to prime its DNS cache.
--
derek


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Karl Larsen-2
In reply to this post by Bart Silverstrim
Bart Silverstrim wrote:

> Derek Broughton wrote:
>  
>> 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?
>>>      
>> No, "the machine asking for DHCP" (ie, your computer) "sends"  its own
>> name to the DHCP server.
>>    
>
> Sorry, this also can be a way to name a device.
>
> I was thinking of situations where you can update the DNS records to a
> fixed name for a given IP.
>
>
>  
    The reason someone invented networking was because his/her network
got too large to guess were things are. Now if you let a Router set your
ip numbers it will do it but not the same way all the time. You add
another item and ALL ip numbers can change.

    Enter networking simple. Let's say you have a computer and a printer
and several other things. Call the Router from the Internet 192.168.0.1
and set the computer as
192.168.0.2 and make the printer 192.168.0.3 and set them manually not
DHCP. Now in your /etc/resolv.conf which might look like this:

karl@karl-hardy:/etc$ more resolv.conf
### BEGIN INFO
#
# Modified_by:  NetworkManager
# Process:      /usr/bin/NetworkManager
# Process_id:   5067
#
### END INFO



nameserver 216.234.192.92
nameserver 216.234.213.130


You will want to add things the computer needs to know. It might look
like this:

192.168.0.3     prnt   printer
192.168.0.2     comp


It looks about like this but the main thing to know is that DHCP can not
be trusted! You must give each item connected by the Internet an IP
number. And you must be able to ping everything from the computer.


Karl


--

        Karl F. Larsen, AKA K5DI
        Linux User
        #450462   http://counter.li.org.
   PGP 4208 4D6E 595F 22B9 FF1C  ECB6 4A3C 2C54 FE23 53A7


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

H.S.
In reply to this post by Chris Green
Chris G wrote:

>>
> How is that any easier than simply giving the printer a static IP?  I
> have to faff about in the router's configuration to tell it to
> associate the MAC addres with the printer, that's just *another* place
> I have to do things.  I'm using dnsmasq to try and minimise that sort
> of hassle.

dnsmasq has exactly similar functionality. I specify the mac addresses
in dnsmasq and their associated names. I can additionally tell dnsmasq
what IP to give to a specific mac. dnsmasq.conf is the only place I have
to do this, one line per machine. I used to have the IP addresses and
hostnames in /etc/hosts. Not anymore, dnsmasq has solved that problem
quite nicely.

BTW, I am using an old computer running Debian as my router. But I
supposed the usual consumer routers also include functionality. In any
case, I just wanted to say that if you have dnsmasq running, that is the
only place where you should need to describe your network.

Good luck.




--

Please reply to this list only. I read this list on its corresponding
newsgroup on gmane.org. Replies sent to my email address are just
filtered to a folder in my mailbox and get periodically deleted without
ever having been read.


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

H.S.
In reply to this post by Chris Green
Chris G wrote:

> Where/what do I tell that the printer is called Print-1, this is the
> bit that's not clear to me.  Are you saying that I should give it this
> name in teh router configuration?

If you have dnsmasq installed, read its conf file, here is what you are
looking for:
"# Always give the host with ethernet address 11:22:33:44:55:66
# the name fred and IP address 192.168.0.60 and lease time 45 minutes
#dhcp-host=11:22:33:44:55:66,fred,192.168.0.60,45m
"


--

Please reply to this list only. I read this list on its corresponding
newsgroup on gmane.org. Replies sent to my email address are just
filtered to a folder in my mailbox and get periodically deleted without
ever having been read.


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Bart Silverstrim
In reply to this post by Karl Larsen-2
Karl F. Larsen wrote:

> Bart Silverstrim wrote:
>> Derek Broughton wrote:
>>  
>>> 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?
>>>>      
>>> No, "the machine asking for DHCP" (ie, your computer) "sends"  its own
>>> name to the DHCP server.
>>>    
>> Sorry, this also can be a way to name a device.
>>
>> I was thinking of situations where you can update the DNS records to a
>> fixed name for a given IP.
>>
>>
>>  
>     The reason someone invented networking was because his/her network
> got too large to guess were things are.

How does a network get too large before networking was invented?

>Now if you let a Router set your
> ip numbers it will do it but not the same way all the time. You add
> another item and ALL ip numbers can change.

Depends on the router. The part that differentiates how it works is the
DHCP server software. You CAN tell your DHCP server, if it supports it,
to always give a specific MAC address a specific IP address just like
you can configure it to hand out an address for a specified period of
time, and DNS servers are able to tie a specific record to a specific IP.

If your router is bargain basement then yeah, it'll seem random if it
lacks features. But it can most certainly be done, and in many cases if
the feature is there the user just never bothered to configure it so
they're using the defaults.


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Bart Silverstrim
In reply to this post by Derek Broughton-2
Derek Broughton wrote:
> Bart Silverstrim wrote:
>
>> 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.
>
> My Linksys wrt54Gs have been running 3 years non-stop without any
> significant problems (and I can back up their configuration easily).

Exceptions to every rule :-)

I've had several die, or I've had them half-die (for example, wireless
dies or goes wonky but switch works fine).

>>> 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,
>
> Well, that's why he's using dnsmasq, and there's no real problem with
> that, but he can't have it both ways - he wants to maintain everything
> in one /etc/hosts, but he doesn't want to separate the "local"
> information from the "LAN" information, and so he's getting conflicts.

I was just giving one reason to consider it :-) You probably already saw
my previous response about it by now though.

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Chris Green
In reply to this post by Derek Broughton-2
On Mon, Dec 15, 2008 at 02:44:28PM -0400, Derek Broughton wrote:

> > How is that any easier than simply giving the printer a static IP?  I
> > have to faff about in the router's configuration to tell it to
> > associate the MAC addres with the printer, that's just *another* place
> > I have to do things.
>
> No, that's just the ONE place you have to do things.  In the time you've
> been asking us how to do this with a piece of software that you had to
> add to your system, I could have done the setup dozens of times on a
> router.
>
... and, similarly, I could have done it by editing /etc/hosts.


> > I'm using dnsmasq to try and minimise that sort of hassle.
>
> How much hassle do you think you've minimized so far?
>
Lots!  The *only* thing I need to change ever is /etc/hosts on one
machine.  Just as easy (easier IMHO) as doing things via the web
(presumably) on a router *and* it gets backed up when I back up my
system.


> > 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:-
>
> You HAVEN'T got it to work with /etc/hosts - specifically because you're
> trying to do something you can't do.  
>  
Who says - I seem to have it working fine now using dnsmasq and simple
names.  I just guessed that I *could* remove the entries I was
originally asking about and it all works OK.  It's what dnsmasq is
specifically designed to do as far as I understand it.


> >     Set the printer (for example) to have a fixed IP of 192.168.1.40
> >
> >     Put "192.168.1.40  printer" in /etc/hosts on *one* system which
> >     runs dnsmasq.
>
> Same on the router.  You don't even _have_ to have the MAC address.
>  
> > The printer never changes once its IP address is set, computers may
> > come and computers may go but that only needs doing once.  Similarly
> > if I change the computer where dnsmasq is running all I need to do is
> > copy /etc/hosts and everything is done.
>
> So do things the hard way, then, but you'd rather argue with everybody
> who's telling you you simply _can't_ do it the way you want to.  Your
> /etc/hosts can only have ONE (working) IP address for a single host.  

That's what my original question was about.  All I wanted to know was
whether I could remove the local host name from the 127.0.0.1 and
127.0.1.1 entries and leave it against the 192.168.1.4 entry.  It
turns out that I *can* do this and everything works well with dnsmasq.

> And whether dnsmasq can handle hostnames without domains or not, you
> can't _treat_ "isbd" in a dns lookup from a client with no search
> domains set, the same as a hostname lookup in the local /etc/hosts.  
> They're doing different things, that just happen to resolve to the same
> address when isbd _is_ your local host (and then only because local dns
> lookup generally checks your /etc/hosts first).

My /etc/hosts now has:-

    127.0.0.1       localhost.localdomain   localhost

    192.168.1.1 vigor 2820n
    192.168.1.4 home.isbd.net isbd 84-45-228-40.no-dns-yet.enta.net chris.isbd.net
    192.168.1.5 home
    192.168.1.6 maxine
    192.168.1.7 garage
    ... plus more lines.


If I say 'host isbd' on the garage system see what happens:-

    chris@garage:~$ host isbd
    isbd has address 192.168.1.4
    chris@garage:~$

The garage system has a default /etc/hosts, I've added nothing to it.


So it seems to me I'm getting exactly what I need, a DNS system that
gives me valid LAN addresses for local names.




--
Chris Green

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Chris Green
In reply to this post by Derek Broughton-2
On Mon, Dec 15, 2008 at 02:50:58PM -0400, Derek Broughton wrote:
> Chris G wrote:
>
> > Er, no, this is where we came in!  I'm using dnsmasq on *one* machine
> > in the LAN and that means I only have to edit *one* /etc/hosts and
> > dnsmasq tells other machines on the network the contents of that one
> > /etc/hosts via DNS.
>
> Er, no.  That's not what dnsmasq does.  It uses your /etc/hosts (or
> similar file) to prime its DNS cache.

OK, technically true, but the effect is what I said.  When one of the
other systems asks dnsmasq for the address of something it gets the
address that is in /etc/hosts - unless of course it's not there in
which case dnsmasq passes the request on the the outside world
(hopefully).

--
Chris Green

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

NoOp-4
In reply to this post by Chris Green
On 12/15/2008 11:50 AM, Chris G wrote:

>
> My /etc/hosts now has:-
>
>     127.0.0.1       localhost.localdomain   localhost
>
>     192.168.1.1 vigor 2820n
>     192.168.1.4 home.isbd.net isbd 84-45-228-40.no-dns-yet.enta.net chris.isbd.net
>     192.168.1.5 home
>     192.168.1.6 maxine
>     192.168.1.7 garage
>     ... plus more lines.
>
>
> If I say 'host isbd' on the garage system see what happens:-
>
>     chris@garage:~$ host isbd
>     isbd has address 192.168.1.4
>     chris@garage:~$
>
> The garage system has a default /etc/hosts, I've added nothing to it.
>
>
> So it seems to me I'm getting exactly what I need, a DNS system that
> gives me valid LAN addresses for local names.

Question: what happens when the single machine with dnsmasq is
down/off-line etc? Wouldn't you be better off putting the IP's in the
/etc/hosts files of each machine (adjusted accordingly of course)?



--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Chris Green
On Mon, Dec 15, 2008 at 01:57:50PM -0800, NoOp wrote:

> On 12/15/2008 11:50 AM, Chris G wrote:
>
> >
> > My /etc/hosts now has:-
> >
> >     127.0.0.1       localhost.localdomain   localhost
> >
> >     192.168.1.1 vigor 2820n
> >     192.168.1.4 home.isbd.net isbd 84-45-228-40.no-dns-yet.enta.net chris.isbd.net
> >     192.168.1.5 home
> >     192.168.1.6 maxine
> >     192.168.1.7 garage
> >     ... plus more lines.
> >
> >
> > If I say 'host isbd' on the garage system see what happens:-
> >
> >     chris@garage:~$ host isbd
> >     isbd has address 192.168.1.4
> >     chris@garage:~$
> >
> > The garage system has a default /etc/hosts, I've added nothing to it.
> >
> >
> > So it seems to me I'm getting exactly what I need, a DNS system that
> > gives me valid LAN addresses for local names.
>
> Question: what happens when the single machine with dnsmasq is
> down/off-line etc? Wouldn't you be better off putting the IP's in the
> /etc/hosts files of each machine (adjusted accordingly of course)?
>
Er, the same as happens when the router is down - not much!  :-)

--
Chris Green

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

NoOp-4
On 12/15/2008 04:30 PM, Chris G wrote:

> On Mon, Dec 15, 2008 at 01:57:50PM -0800, NoOp wrote:
>> On 12/15/2008 11:50 AM, Chris G wrote:
>>
>> >
>> > My /etc/hosts now has:-
>> >
>> >     127.0.0.1       localhost.localdomain   localhost
>> >
>> >     192.168.1.1 vigor 2820n
>> >     192.168.1.4 home.isbd.net isbd 84-45-228-40.no-dns-yet.enta.net chris.isbd.net
>> >     192.168.1.5 home
>> >     192.168.1.6 maxine
>> >     192.168.1.7 garage
>> >     ... plus more lines.
>> >
>> >
>> > If I say 'host isbd' on the garage system see what happens:-
>> >
>> >     chris@garage:~$ host isbd
>> >     isbd has address 192.168.1.4
>> >     chris@garage:~$
>> >
>> > The garage system has a default /etc/hosts, I've added nothing to it.
>> >
>> >
>> > So it seems to me I'm getting exactly what I need, a DNS system that
>> > gives me valid LAN addresses for local names.
>>
>> Question: what happens when the single machine with dnsmasq is
>> down/off-line etc? Wouldn't you be better off putting the IP's in the
>> /etc/hosts files of each machine (adjusted accordingly of course)?
>>
> Er, the same as happens when the router is down - not much!  :-)
>

Yes, but then you must keep the dnsmasq machine up at all times - what
ever happend to 'green'... :-)

However if the router is still up but the dnsmasq machine is down you
will still have the ability to ping by name if you configure each
/etc/host file to include the appropriate IP addresses and name for each
device. For example with 'garage':

127.0.0.1       localhost
127.0.1.1 garage

192.168.1.1 vigor 2820n
192.168.1.4 home.isbd.net isbd 84-45-228-40.no-dns-yet.enta.net
chris.isbd.net
192.168.1.5 home
192.168.1.6 maxine

garage would still be able to easily find 'home' or maxine' (I'm not
sure about the isbd.net stuff).

Or maxine:

127.0.0.1       localhost
127.0.1.1 maxine

192.168.1.1 vigor 2820n
192.168.1.4 home.isbd.net isbd 84-45-228-40.no-dns-yet.enta.net
chris.isbd.net
192.168.1.5 home
192.168.1.7 garage

maxine would still be able to easily find 'garage'.

You may have the luxury of being able to keep a machine fully powered on
all of the time just for dnsmasq purposes, but I'm not sure that doing
so is the best option IMO. I'd just leave the current static IP settings
(this is what I do for my local networks), populate the few /etc/hosts
files that you have for each machine, isolate those addresses in the
router as static, and let anything else connect via DHCP on the
addresses I allow for DHCP on the router.

It's pretty simple (Karl has it right this time). The only
pain-in-the-ass (PITA) is that you need to check/modify the /etc/hosts
settings on each machine each time you add a new static IP device. But
for 5 or 6 (I have 10) devices it's not that difficult. It's certainly
easier than fiddling with the router to add MAC addresses for 'fixed'
DHCP addresses IMO.

For others that advocate DHCP on a small local network:

The advantages of static IP's in a small local network are even more
evident when you use VPN's, VNC, or a central printer - particularly if
you use IPP to connect to the printer.

  Case in point: I have a central printer that can be used from both a
wired and wireless router. All of the Ubuntu wired and wireles
connections are _very_ easy to connect as they just use ipp://IPADDRESS
etc. Enter a DHCP Vista laptop on the wireless... couldn't find the
printer; however once I told it the IP address I was able to have it
print to the printer without any difficulty.

BTW: the printer doesn't just come up and provide a 'printer name' on
the network, it's not possible. I'm sure that someone will come along
and show me wrong and how to do it with DHCP & that's quite OK, but
using static IP's on a small local lan shouldn't require dnsmasq or any
other special requirements other than defining the host names in /etc/hosts.

 Another case in point: I VPN into a remote network that has maybe 5 or
6 machines on site. If the machines are DHCP I need to find a way to
find out what their current IP's are so that I can connect to them for
updates etc. In nearly all cases this is simply impossible with a
standard VNC or VPN link; unless I've taken the trouble to define their
MAC addresses in the remote router to assign those machines the same IP
address each time. In that case I need to rely on a dns discover utility
that may or may not be working on the remote end.
  So why even bother? Just reserve a block of IP's on the router to be
static, reserve a block to be DHCP, and leave it at that. You have your
machines/printers/etc on static, friends visit & connect and get a DHCP
address and can access the necessary services (including your printer if
you give them the IP address) and off you go. Basically Karl was/is
correct for the most part on this one. Oh *please* Karl don't blog about
your network settings on the list just because I commented that you are
*basically* right on this...





--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Neil Cherry-3
NoOp wrote:

> On 12/15/2008 04:30 PM, Chris G wrote:
>> On Mon, Dec 15, 2008 at 01:57:50PM -0800, NoOp wrote:
>>> On 12/15/2008 11:50 AM, Chris G wrote:
>>>
>>>> My /etc/hosts now has:-
>>>>
>>>>     127.0.0.1       localhost.localdomain   localhost
>>>>
>>>>     192.168.1.1 vigor 2820n
>>>>     192.168.1.4 home.isbd.net isbd 84-45-228-40.no-dns-yet.enta.net chris.isbd.net
>>>>     192.168.1.5 home
>>>>     192.168.1.6 maxine
>>>>     192.168.1.7 garage
>>>>     ... plus more lines.
>>>>
>>>>
>>>> If I say 'host isbd' on the garage system see what happens:-
>>>>
>>>>     chris@garage:~$ host isbd
>>>>     isbd has address 192.168.1.4
>>>>     chris@garage:~$
>>>>
>>>> The garage system has a default /etc/hosts, I've added nothing to it.
>>>>
>>>>
>>>> So it seems to me I'm getting exactly what I need, a DNS system that
>>>> gives me valid LAN addresses for local names.
>>> Question: what happens when the single machine with dnsmasq is
>>> down/off-line etc? Wouldn't you be better off putting the IP's in the
>>> /etc/hosts files of each machine (adjusted accordingly of course)?
>>>
>> Er, the same as happens when the router is down - not much!  :-)
>>
>
> Yes, but then you must keep the dnsmasq machine up at all times - what
> ever happend to 'green'... :-)

Well my central server is running my home automation (and everything
else). My DHCP and DNS/Cache runs off the same machine. When it fails
the network is mostly down. I can kick the wrt54g into duty (using
dnsmasq). My current DNS is tinydns. When I admin a new address
I have a few files to update but then again I have a lot more devices
than your average home (I've reserved some 50 addresses). I also use
tinydns/dnscache to block access to certain IP addresses, domains
and/or hosts.

--
Linux Home Automation         Neil Cherry       [hidden email]
http://www.linuxha.com/                         Main site
http://linuxha.blogspot.com/                    My HA Blog
Author of:     Linux Smart Homes For Dummies

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Chris Green
In reply to this post by NoOp-4
On Mon, Dec 15, 2008 at 07:58:21PM -0800, NoOp wrote:

> On 12/15/2008 04:30 PM, Chris G wrote:
> > On Mon, Dec 15, 2008 at 01:57:50PM -0800, NoOp wrote:
> >> On 12/15/2008 11:50 AM, Chris G wrote:
> >>
> >> >
> >> > My /etc/hosts now has:-
> >> >
> >> >     127.0.0.1       localhost.localdomain   localhost
> >> >
> >> >     192.168.1.1 vigor 2820n
> >> >     192.168.1.4 home.isbd.net isbd 84-45-228-40.no-dns-yet.enta.net chris.isbd.net
> >> >     192.168.1.5 home
> >> >     192.168.1.6 maxine
> >> >     192.168.1.7 garage
> >> >     ... plus more lines.
> >> >
> >> >
> >> > If I say 'host isbd' on the garage system see what happens:-
> >> >
> >> >     chris@garage:~$ host isbd
> >> >     isbd has address 192.168.1.4
> >> >     chris@garage:~$
> >> >
> >> > The garage system has a default /etc/hosts, I've added nothing to it.
> >> >
> >> >
> >> > So it seems to me I'm getting exactly what I need, a DNS system that
> >> > gives me valid LAN addresses for local names.
> >>
> >> Question: what happens when the single machine with dnsmasq is
> >> down/off-line etc? Wouldn't you be better off putting the IP's in the
> >> /etc/hosts files of each machine (adjusted accordingly of course)?
> >>
> > Er, the same as happens when the router is down - not much!  :-)
> >
>
> Yes, but then you must keep the dnsmasq machine up at all times - what
> ever happend to 'green'... :-)
>
It's a green machine - I specifically bought components to keep its
power consumption to a minimum.  It also provides samba services to
other machines on the network, and local web pages.


> will still have the ability to ping by name if you configure each
> /etc/host file to include the appropriate IP addresses and name for each
> device. For example with 'garage':
>
> 127.0.0.1       localhost
> 127.0.1.1 garage
>
> 192.168.1.1 vigor 2820n
> 192.168.1.4 home.isbd.net isbd 84-45-228-40.no-dns-yet.enta.net
> chris.isbd.net
> 192.168.1.5 home
> 192.168.1.6 maxine
>
> garage would still be able to easily find 'home' or maxine' (I'm not
> sure about the isbd.net stuff).
>
Yes, I know that, but it requires that I keep all the /etc/hosts files
up to date and in step.  In reality the garage machine is purely a
backup machine so it doesn't *need* to be able to see anything much.


> Or maxine:
>
> 127.0.0.1       localhost
> 127.0.1.1 maxine
>
> 192.168.1.1 vigor 2820n
> 192.168.1.4 home.isbd.net isbd 84-45-228-40.no-dns-yet.enta.net
> chris.isbd.net
> 192.168.1.5 home
> 192.168.1.7 garage
>
> maxine would still be able to easily find 'garage'.
>
The machine maxine is a WIndows machine, doesn't need to see garage,
just the printers really.

--
Chris Green

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Derek Broughton-2
In reply to this post by Bart Silverstrim
Bart Silverstrim wrote:

>>Now if you let a Router set your
>> ip numbers it will do it but not the same way all the time. You add
>> another item and ALL ip numbers can change.
>
> Depends on the router. The part that differentiates how it works is
> the DHCP server software. You CAN tell your DHCP server, if it
> supports it, to always give a specific MAC address a specific IP
> address just like you can configure it to hand out an address for a
> specified period of time, and DNS servers are able to tie a specific
> record to a specific IP.
>
> If your router is bargain basement then yeah, it'll seem random if it
> lacks features. But it can most certainly be done, and in many cases
> if the feature is there the user just never bothered to configure it
> so they're using the defaults.

Not to mention, most DHCP servers will reassign exactly the same address
to a device every time it asks, provided the address pool is large
enough that it doesn't need to recycle them.  This isn't guaranteed, but
it is extremely likely.
--
derek


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Derek Broughton-2
In reply to this post by H.S.
H.S. wrote:

> Chris G wrote:
>
>>>
>> How is that any easier than simply giving the printer a static IP?  I
>> have to faff about in the router's configuration to tell it to
>> associate the MAC addres with the printer, that's just *another*
>> place
>> I have to do things.  I'm using dnsmasq to try and minimise that sort
>> of hassle.
>
> dnsmasq has exactly similar functionality. I specify the mac addresses
> in dnsmasq and their associated names. I can additionally tell dnsmasq
> what IP to give to a specific mac. dnsmasq.conf is the only place I
> have to do this, one line per machine.

I thought as much, but it's a _very_ long time since I had a dnsmasq
installation.  All the more reason not to rely on using /etc/hosts on
the dnsmasq machine.
--  
derek


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Derek Broughton-2
In reply to this post by Chris Green
Chris G wrote:

> On Mon, Dec 15, 2008 at 02:44:28PM -0400, Derek Broughton wrote:

>> No, that's just the ONE place you have to do things.  In the time
>> you've been asking us how to do this with a piece of software that
>> you had to add to your system, I could have done the setup dozens of
>> times on a router.
>>
> ... and, similarly, I could have done it by editing /etc/hosts.

If you _could_ you wouldn't have  been asking here.

> Who says - I seem to have it working fine now using dnsmasq and simple
> names.  I just guessed that I *could* remove the entries I was
> originally asking about and it all works OK.  It's what dnsmasq is
> specifically designed to do as far as I understand it.

Except  that you have now broken your /etc/hosts.  Why do you think it
is set up with your local host on the 127.*.*.* subnet?

> That's what my original question was about.  All I wanted to know was
> whether I could remove the local host name from the 127.0.0.1 and
> 127.0.1.1 entries and leave it against the 192.168.1.4 entry.  It
> turns out that I *can* do this and everything works well with dnsmasq.

Of course you _can_ do that - but now you can't address your machine
except by going out over the network.
--
derek


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: localhost or LAN addresses in /etc/hosts

Bart Silverstrim
In reply to this post by NoOp-4
NoOp wrote:

> For others that advocate DHCP on a small local network:
>
> The advantages of static IP's in a small local network are even more
> evident when you use VPN's, VNC, or a central printer - particularly if
> you use IPP to connect to the printer.

I don't suppose the network-manager bugs have been fixed yet, have they?
On my machine after upgrading to 8.10 I could no longer use a static IP!

THAT is a PITA!

> BTW: the printer doesn't just come up and provide a 'printer name' on
> the network, it's not possible. I'm sure that someone will come along
> and show me wrong and how to do it with DHCP & that's quite OK, but
> using static IP's on a small local lan shouldn't require dnsmasq or any
> other special requirements other than defining the host names in /etc/hosts.

I don't know if it's that simple (well, yes, you can do it with a /hosts
file not arguing that) but in today's networking a lot of printers do
advertise themselves so they're discoverable. I just opened "networks"
on this Ubuntu machine and there are four networked laser printers
showing, and Macs with Rendezvous love discovering printers for breakfast.

I really think it won't be much longer before Rendezvous and
autodiscovery (same service, isn't it?) and IPv6 will make networking
three times more magical for users and four times more frustrating to
troubleshoot.

>  Another case in point: I VPN into a remote network that has maybe 5 or
> 6 machines on site. If the machines are DHCP I need to find a way to
> find out what their current IP's are so that I can connect to them for
> updates etc. In nearly all cases this is simply impossible with a
> standard VNC or VPN link; unless I've taken the trouble to define their
> MAC addresses in the remote router to assign those machines the same IP
> address each time. In that case I need to rely on a dns discover utility
> that may or may not be working on the remote end.

Or open the management page to your DHCP server and it'll tell you
what's connected :-)

>   So why even bother? Just reserve a block of IP's on the router to be
> static, reserve a block to be DHCP, and leave it at that.

That's how mine was set up...well, until Network Manager crapped the
bed. Lost my webcams, lost my network, miffed more than a little I am,
just not *quite* enough to revert to 8.04.

Almost though.

>You have your
> machines/printers/etc on static, friends visit & connect and get a DHCP
> address and can access the necessary services (including your printer if
> you give them the IP address) and off you go. Basically Karl was/is
> correct for the most part on this one. Oh *please* Karl don't blog about
> your network settings on the list just because I commented that you are
> *basically* right on this...

I think he was right and wrong at the time in what he said can and can't
be done with it, but I don't feel like digging through archives at the
moment just to prove a point. I'm not in the mood to drop trou just to
prove my geekness.

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
123