LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Sending hostname along with DHCP request (https://www.linuxquestions.org/questions/linux-networking-3/sending-hostname-along-with-dhcp-request-107439/)

adz 10-23-2003 01:28 AM

Sending hostname along with DHCP request
 
Hi there.

I have several computers networked together with one being the gateway/DHCP server. It all works just fine except for one thing. I was wondering if it was at all possible to send a computer's host name along with the DHCP request.

To explain further... Let's say I have a computer (IP 192.168.0.1) acting as a gateway and three other computers (DHCP assigned addresses) networked to it through a hub. Let's say the gateway's hostname is "gateway" and the other three computers are called "comp1", "comp2" and "comp3". As it stands, to telnet to any of the other three computers, I have to type telnet <IP address>. Is it at all possible to dynamically assign host names as well? In other words, I'd like to be able to type telnet comp1, for example. This is easy with static IPs but these are dynamic. So i'd either like each computer to send it's unique hostname to the DHCP server (and hence to the rest of the network) or each computer to request a specific IP from the DHCP server (and then I could edit /etc/hosts as usual confident in the knowledge that the IP will be the same each time).

Any suggestions?

born4linux 10-23-2003 01:37 AM

bind the hostname to the IP addresses you are leasing to your clients. And you can pick which machine get's the IP via the MAC addresses of their NICs.

this is a combination of DCHP and DNS service setup.

something like (in dhcpd.conf):

host client1 {
next-server client1.domain.org;
hardware ethernet 12:xx:xx:xx:xx:xx;
fixed-address 192.168.0.1;
}


(in your dns zone file):
client1 IN A 192.168.0.1


hth.

adz 10-23-2003 01:50 AM

How do I do that? I presume I have to edit the dhcp.conf file but what options do I put in it?

stickman 10-23-2003 08:12 AM

You can assign hostnames via DHCP, but the name lookups are done via DNS. comp1 doesn't know that comp2 points to IP2 without a DNS lookup. To get around this, you can run your own local DNS server or create hosts files on each machine.

adz 10-23-2003 10:15 AM

Yeah I was hoping to avoid the hosts files. There's no guarantee that comp1 will get the same IP assigned to it each time. It generally does, I have to say, but it's not a robust system. I want something bulletproof. Or at least fairly reliable. Could you give me a few pointers on setting up a DNS server? Or at least point me to a good HOWTO? Oh and how exactly do I assign host names via DHCP?


All times are GMT -5. The time now is 10:12 AM.