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'm running DHCP Server on my CentOS 4.4 system. I have two clients workstations both CentOS 4.4. I want to be able to give the two client machines hostnames. But as they obtain there IP Address from the DHCP Server i cannot create them, For example:
vi /etc/hosts
127.0.0.1 localhost localdomain XXX.XXX.XXX.XXX client.xxxxx.com
How can i give my client workstation a hostname if the IP address changes?
It's probably really simple, go easy im new at this stuff.
How can i give my client workstation a hostname if the IP address changes?
Well, I expect that there is some way of doing this, but why don't you just assign your PCs static IPs?
That way they will not change (unless you change them) and your /etc/hosts files will be correct.
That way your client should ask the dhcp server for a hostname. You'll obviously need to configure the dhcp server to provide a hostname based on MAC address, or some parameter.
I'm creating a router for a small network "University Project", so assigning a static IP address for the client is not a problem. I would like to be able to give the client the option to change the hostname. But it does make sense to remove the comments from the lines in /etc/dhclient.conf. As in the real world static IP addresses would be used for a dhcp server.
The only other way to do it would be to assigne static IP addressess from the dhcp server then change them from the server end.
The DHCP server can assign the same address to a MAC address, or it can allow the address to come from the pool of allowed addresses. If you configure the DHCP server to give out hostnames, then it will.
I don't understand your recent post. In the first post you say you want to assign hostnames, then in the second you say you want the client to be able to change hostnames? Either the hostname is set on the machine, or it accepts a hostname from DHCP. Much like an IP address, it either is set by the client machine or the server, but not both. I also don't understand what you mean by, "in the real world static IP addresses would be used for a dhcp server." A DHCP server can assign real world IP addresses or LAN addresses. And they can be fixed per client or part of a pool. I think we might be using different names for things.
Reading the output of
Code:
man dhcpd.conf
can help if you're looking for the right syntax to assign a hostname.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.