Greetings, I suspect this is an easy fix but somehow I can't find it.... I just installed a Netgear RP114 DSL router and I'm letting it set my private IPs with DCHP. My problem is that I need to resolve the hostnames between the 3 Linux machines on my private lan and the router isn't doing that. When they are booted in Windows the DCHP table shows the IP and hostname of each PC, but when booted in Linux the router doesn't resolve the hostname to IP...so when I ping a hostname I get nothing. Any ideas? Thanks! -- Gary
Hi
I just installed a Netgear RP114 DSL router and I'm letting it set my private IPs with DCHP. My problem is that I need to resolve the hostnames between the 3 Linux machines on my private lan and the router isn't doing that.
When they are booted in Windows the DCHP table shows the IP and hostname of each PC, but when booted in Linux the router doesn't resolve the hostname to IP...so when I ping a hostname I get nothing.
The easiest way to do this is simply to add those three hosts to your /etc/hosts file (this is simplest since you have only three boxes to deal with) Just add lines like 192.168.1.5 box1.localdomain box1 192.168.1.32 box2.localdomain box2 to /etc/hosts doug -- Douglas R Waud, Professor Emeritus -- Pharmacology University of Massachusetts Medical School Mailing address: 17 Lantern Lane, Shrewsbury, MA 01545-2006
Sure, but the IPs are dynamic so the hosts file is out, right? -- Gary ----- Original Message ----- From: "doug waud" <douglas.waud@umassmed.edu> To: <wlug@mail.wlug.org> Sent: Saturday, November 10, 2001 11:49 AM Subject: Re: [Wlug] DCHP Private IP Hostname Resolution
Hi
I just installed a Netgear RP114 DSL router and I'm letting it set my private IPs with DCHP. My problem is that I need to resolve the hostnames between the 3 Linux machines on my private lan and the router isn't doing that.
When they are booted in Windows the DCHP table shows the IP and hostname of each PC, but when booted in Linux the router doesn't resolve the hostname to IP...so when I ping a hostname I get nothing.
The easiest way to do this is simply to add those three hosts to your /etc/hosts file (this is simplest since you have only three boxes to deal with)
Just add lines like 192.168.1.5 box1.localdomain box1 192.168.1.32 box2.localdomain box2 to /etc/hosts
doug
-- Douglas R Waud, Professor Emeritus -- Pharmacology University of Massachusetts Medical School Mailing address: 17 Lantern Lane, Shrewsbury, MA 01545-2006 _______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug
Hi again (with a red face!)
Sure, but the IPs are dynamic so the hosts file is out, right?
Missed that (another "senior moment")! :-( Now I remember one reason I have been using static IP addresses :-) One way to cheat a bit would be to assign addresses but tie them to the MAC address of the ethernet card of each box, i.e. add something like host box1 { hardware ethernet 00:A0:CC:E4:86:CD; fixed-address 192.168.1.222; } to /etc/dhcpd.conf Then you could use the /etc/hosts route. Not an elegant solution but, what the hell, this is a rear-guard action :-) Unfortunately I have no dhcpd server running so I cannot test the following, but include it as a potential more elegant solution [and also as an attempt at face-saving :-) ] I believe there should be a file /etc/dhcpd.leases with sections like lease 192.168.1.25 { starts 2 2001/07/31 15:23:47; ends 3 2001/08/01 03:23:47; hardware ethernet 00:a0:cc:e7:6a:b9; uid 00:A0:CC:E4:86:CD; client-hostname "box3"; } If so with some cat|awk|grep|sed piping you should be able automatically to extract the dotted quad which goes with each host and give the former to ping to chew on. As I say, I can't test this. However, if you are masochistic enough to want to continue this thread, feel free to send me a sample copy of that /etc/dhcpd.leases file and I'll see if I can get a short shell script you could try instead of ping. On the more positive side, at least you now know the dangers of posting a query :-) doug -- Douglas R Waud, Professor Emeritus -- Pharmacology University of Massachusetts Medical School Mailing address: 17 Lantern Lane, Shrewsbury, MA 01545-2006
Hi Doug, And thanks for your input. Unfortunately I can't modify any DCHP config settings in the router (that I know of anyway), so I have to find a way to either get the Linux PCs to report their host names to the router or have the router find the hostname from the PC. When booted in Windows they do that but in Linux they do not. Of course I can always go back to a static IP and I might just ultimately do that, but I'd like to know if there is a way to make this work. Thanks again! -- Gary ----- Original Message ----- From: "doug waud" <douglas.waud@umassmed.edu> To: <wlug@mail.wlug.org> Sent: Saturday, November 10, 2001 3:32 PM Subject: Re: [Wlug] DCHP Private IP Hostname Resolution
Hi again (with a red face!)
Sure, but the IPs are dynamic so the hosts file is out, right?
Missed that (another "senior moment")! :-( Now I remember one reason I have been using static IP addresses :-)
One way to cheat a bit would be to assign addresses but tie them to the MAC address of the ethernet card of each box, i.e. add something like
host box1 { hardware ethernet 00:A0:CC:E4:86:CD; fixed-address 192.168.1.222; }
to /etc/dhcpd.conf
Then you could use the /etc/hosts route. Not an elegant solution but, what the hell, this is a rear-guard action :-)
Unfortunately I have no dhcpd server running so I cannot test the following, but include it as a potential more elegant solution [and also as an attempt at face-saving :-) ]
I believe there should be a file /etc/dhcpd.leases with sections like
lease 192.168.1.25 { starts 2 2001/07/31 15:23:47; ends 3 2001/08/01 03:23:47; hardware ethernet 00:a0:cc:e7:6a:b9; uid 00:A0:CC:E4:86:CD; client-hostname "box3"; }
If so with some cat|awk|grep|sed piping you should be able automatically to extract the dotted quad which goes with each host and give the former to ping to chew on.
As I say, I can't test this. However, if you are masochistic enough to want to continue this thread, feel free to send me a sample copy of that /etc/dhcpd.leases file and I'll see if I can get a short shell script you could try instead of ping.
On the more positive side, at least you now know the dangers of posting a query :-)
doug -- Douglas R Waud, Professor Emeritus -- Pharmacology University of Massachusetts Medical School Mailing address: 17 Lantern Lane, Shrewsbury, MA 01545-2006 _______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug
Hi again I think we may be almost there! :-)
Unfortunately I can't modify any DCHP config settings in the router
To be honest, I had been having another "senior moment" and was picturing and old Linux box as the router! I really must learn how to read. :-)
so I have to find a way to either get the Linux PCs to report their host names to the router or have the router find the hostname from the PC.
When booted in Windows they do that but in Linux they do not.
It suddenly occurred to me that this must be the clue. So I went to the man page for dhcpcd (one dhcp client daemon) and found there is both a -H switch, which forces a hostname to that supplied by the server and a -h switch which sends the hostname to the server. I suspect the latter is what windows is already doing. (I mention the former as a reserve in case the -h does not turn out to work.) I also looked at my router (a Linux box) which happens to be using dhclient (another dhcp client daemon) and in its /etc/dhclient.conf there is a place where you can insert send host-name "box1.localdomain" which, it would appear, would do the same thing as above. (I should warn you that I am using SuSE so my /etc/dhclient.conf file may have a lot of stuff in it which is not usually there (SuSE is very good this way; they put it all in and then all you have to do is remove a comment and/or change some text. But the basic behavior of dhclient should be the same.) I'll stop here since I don't know what dhcp client you are using, but I think we are actually knocking on the door!
Of course I can always go back to a static IP and I might just ultimately do that, but I'd like to know if there is a way to make this work.
That is what has got me hooked! doug
participants (2)
-
doug waud
-
Gary J. Hanley