Dynamic Host Configuration Protocol (DHCP) is a network application protocol used by devices (DHCP clients) to obtain configuration information for operation in an Internet Protocol network. The dhclient utility provides a means for configuring network interfaces using DHCP, BOOTP, or if these protocols fail, by statically assigning an address.
This problem indicate that your DHCP server isn't sending the hostname back at all. To solve this problem configure your dhcp server to send back hostname or configure dhcp client to set hostname on your laptop itself.
Say Hello To dhclient-script
From the man page:The DHCP client network configuration script is invoked from time to timeby dhclient. This script is used by the DHCP client to set each interface's initial configuration prior to requesting an address, to test the address once it has been offered, and to set the interface's final configuration once a lease has been acquired. If no lease is acquired, the script is used to test predefined leases, if any, and also called once if no valid lease can be identified.Update your /etc/rc.conf as follows:
hostname=""
Create a file called /etc/dhclient-enter-hooks using a text editor:# vi /etc/dhclient-enter-hooks
Append the following code:
#!/bin/shSave and close the file. Set permission:
check_hostname(){
hostname laptop.nixcraft.in
}
# chmod +x /etc/dhclient-enter-hooks
You can now reboot the laptop or just request dhcp lease:
# dhclient iface
Sample dhclient.conf
Here is sample /etc/dhclient.conf file for dhcp client:timeout 60;See dhclient, dhclient.conf and dhclient-script man page for more information.
retry 60;
reboot 10;
select-timeout 5;
initial-interval 2;
interface "ep0" {
send host-name "laptop.nixcraft.in";
send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
send dhcp-lease-time 3600;
supersede domain-name "nixcraft.net.in r.nixcraft.com r.vsnl.nixcraft.net.in";
prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name;
require subnet-mask, domain-name-servers;
script "/etc/dhclient-script";
media "media 10baseT/UTP", "media 10base2/BNC";
}
alias {
interface "ep0";
fixed-address 192.5.5.213;
option subnet-mask 255.255.255.255;
}
No comments:
Post a Comment