LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-09-2003, 11:53 AM   #1
billlee
Member
 
Registered: Jun 2003
Location: East Texas
Distribution: Fedora (24)
Posts: 47

Rep: Reputation: 16
/etc/hosts (or: getting DHCP clients)


I have a home network served by a DHCP server running in the router (first box past the ISP modem). I would like to make it possible to update the /etc/hosts file on each of the systems with actual host names and IP addresses as they are assigned by the DHCP server.

Is there some established way to do this? Is there any DHCP interface that says "Return to me the list of clients and their IP addresses."? Is there some other way that a system joining the local subnet can determine the other hosts on the subnet by name and IP? Or perhaps to broadcast his own name and newly-found IP address?

Thanks.

Bill Lee
 
Old 06-09-2003, 01:05 PM   #2
manthram
Member
 
Registered: Feb 2002
Location: Fairfax, VA
Distribution: RedHat 8, Mandrake9.1, Slack9
Posts: 456

Rep: Reputation: 31
when dhcp server gives out ip's it writes the details of that in the file 'var/lib/dhcp/dhcp.leases'. write a script which can parse that file and get the machine names and their ips and write them in the /etc/hosts file.

you can give fixed ips to the machines by specifying the ip address and the mac address in the '/etc/dhcpd.conf' file. you might want to try that.
 
Old 06-09-2003, 01:24 PM   #3
billlee
Member
 
Registered: Jun 2003
Location: East Texas
Distribution: Fedora (24)
Posts: 47

Original Poster
Rep: Reputation: 16
Thanks for the feedback, manthram.

The problem with your suggestion is that the DHCP server is running on the router, and I doubt that it writes any files since it is not a real computer.

Also, as best as I can tell, there is no configuration file to manipulate. Yes, I can assign fixed IPs witteh local MAC addresses (which I have done previously), but I need for the system to react to a new computer coming online for which I do not have the name nor a pre-assigned IP address.

The IF to the router is via a web browser. You can access a page on the router and it will display the clients. I have tried to access this via a PERL script, but I cannot make such a script properly login to the router (requires a password) in order to get the DHCP clients page. All I have succeeded in doing is crashing the software in the router with my (probably) malformed http request.

Regards,

Bill Lee
 
Old 06-09-2003, 02:54 PM   #4
0x4B
Member
 
Registered: May 2003
Location: Nashville TN, USA
Distribution: Debian (I'm unstable)
Posts: 117

Rep: Reputation: 15
is it important for the DHCP server to be on the router?
I get the impression that at least some of you're network is transient, but if there is a machine that stays connected, it could end up being much simpler to put the DHCP server there.
how is dns handled in you network (does the router maintain that information too)?
 
Old 06-09-2003, 03:25 PM   #5
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
Probably tottaly useless to you and impractible but interesting anyway.


If you run samba as a WINS server then run any other clients using samba as wins clients and point them to the WINS server which would need static IP I guess, you could find out the IP address for each machine using it's samba netbios name - "nmblookup -T netbiosname"

I guess you could parse that and modify the hosts file accordingly.

just something I found interesting but probably not very useful to you

 
Old 06-09-2003, 03:42 PM   #6
billlee
Member
 
Registered: Jun 2003
Location: East Texas
Distribution: Fedora (24)
Posts: 47

Original Poster
Rep: Reputation: 16
0x4B: You are correct for the most part: not only are parts of the network transient, but the whole thing needs to be transportable.

Actually, I am setting up a system that I intend to take to a site outdoors (running the router and wireless AP from a motor home) with several laptops roaming about within line of site. One system will be configured to serve as a web server/MySQL database server supporting an application that all of the roaming systems will access.

At home, I could assign the DHCP to one or another of the systems, but in the deployed mode, i would not be able to do that. Having the router in the system to serve that purpose (as well as giving me WAN access when available) seems like a "really good thing".

DNS on the systems attached to the DHCP server/router is handled by the server returning the configured DNS IP addresses. I do not run any sort of local DNS, depending upon that provided by whatever ISP I am attached to at the time. Obviously, if the router is not attached to an ISP, no DNS is available, but none is really needed either, if I can solve this issue of obtaining the host names and IP address for the subscribed systems on the local subnet.

Regards,

Bill Lee
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
View DHCP clients? Avatar Linux - Networking 3 06-30-2004 12:55 PM
IP Address for /etc/hosts when using DHCP jimbo Linux - Networking 5 03-27-2004 06:59 PM
dhcp clients not renewing lease tuxguy Linux - Networking 0 03-21-2004 11:27 AM
dhcp clients alaios Linux - Networking 5 12-12-2003 07:19 AM
Switching DHCP clients GhostOfYoda Linux - Security 1 08-01-2003 12:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration