Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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)?
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
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.