LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-21-2007, 05:47 AM   #1
Richtown
Member
 
Registered: Apr 2006
Location: Portsmouth
Distribution: CentOS & Ubuntu
Posts: 49

Rep: Reputation: 15
Question DHCP Server


Hi,

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.

Thanks for any help
Rich
 
Old 04-21-2007, 08:22 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
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.
 
Old 04-21-2007, 11:13 AM   #3
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
I would accomplish what you are looking for by editing /etc/dhclient.conf.

I would remove the comments from these lines:
Code:
#request subnet-mask, broadcast-address, time-offset, routers,
#       domain-name, domain-name-servers, host-name;
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.

Peace,
JimBass
 
Old 04-21-2007, 11:57 AM   #4
Richtown
Member
 
Registered: Apr 2006
Location: Portsmouth
Distribution: CentOS & Ubuntu
Posts: 49

Original Poster
Rep: Reputation: 15
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.
 
Old 04-21-2007, 12:30 PM   #5
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
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.

Peace,
JimBass
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
DHCP server and DHCP client in same box Eicos Linux - Networking 3 03-03-2007 01:28 PM
How To know if a host configured with DHCP has obtained IP address from DHCP server? Prassanta SUSE / openSUSE 1 06-29-2006 09:48 AM
eth0 ip assigned by dhcp , how would i know the ip address of the dhcp server where.. kublador Linux - Networking 14 05-16-2006 06:33 AM
how can a DHCP client get the DHCP server IP? AshesOfTime Linux - Networking 3 11-24-2004 06:50 AM
XP Pro Build 2600/sp1 v.1105 DHCP Client to Redhat 8.0 DHCP Server - Problems atomant Linux - Networking 5 06-28-2003 11:24 AM

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

All times are GMT -5. The time now is 07:45 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