DHCP is useful for fast delivery of client network configuration. When configuring the client system, the administrator can choose DHCP and not have to enter an IP address, netmask, gateway, or DNS servers. The client retrieves this information from the DHCP server. DHCP is also useful if an administrator wants to change the IP addresses of a large number of systems. Instead of reconfiguring all the systems, he can just edit one DHCP configuration file on the server for the new set of IP address. If the DNS servers for an organization changes, the changes are made on the DHCP server, not on the DHCP clients. Once the network is restarted on the clients (or the clients are rebooted), the changes will take effect.
Furthermore, if a laptop or any type of mobile computer is configured for DHCP, it can be moved from office to office without being reconfigured as long as each office has a DHCP server that allows it to connect to the network.
Installing DHCP server in Debian
#apt-get install dhcp3-server
Once you press enter installation will start it will ask you some questions just you need to click ok for all three times
Configuring DHCP server
The main Configuration file for DHCP server is /etc/dhcp3/dhcpd.conf
Before doing any changes take backup copy of this file and add the following lines
option domain-name "test1.com";
option domain-name-servers 192.0.0.1, 194.2.0.50;
option routers 192.0.0.151;
default-lease-time 3600;
subnet 192.0.0.0 netmask 255.255.255.0 {
arrange 192.0.0.200 192.0.0.254;
}
Each one of the above line is explained below
first line provides the name field for the clients, second line gives DNS for for the clients, third one is for router ip,fourth one is lease time fifth line is subnet and netmask details, sixth line is ipaddress range for your clients
If you want more details in dhcpd.conf file check the main page of this file
If you want to configure static ipaddress for some machines follow this
host hostname {
hardware ethernet 00:B0:CF:8B:49:37;
fixed-address 192.0.0.19;
}
Each one of the above line is explained below
First line name of the host you want to configure static ip address,second one is MAC address of that perticular machine,if you want to find the MAC address of that machine you need to run the "ifconfig" command,third one is ipaddress you want to assign to that perticular machine.
You need to restart the DHCP daemon to take effect of your new changes.
#/etc/init.d/dhcp3-server restart
If it restarts without any errors your configuration is correct. If you get any errors you need to check the log files for more error information
#tail /var/log/messages
The following file give you the complete details about the DHCP clients connecting to the DHCP server this details includes the following
IP address of the client machine
MAC address of the client machine
Name of the client machine
Beginning and ending of ipaddress lease time
Client Machine Configuration
You need to modify the following file
# nano /etc/network/interfaces
You need to add the following lines and save the file.
auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp
Now you need to restart the networking service to take these new changes
#/etc/init.d/networking restart
If you want to check your machine is configured properly you need to run the following command
#ifconfig
Finally you can check your log file(/var/log/messages) everything is properly configured or not.
0 komentar:
Posting Komentar