DHCP = Dynamic Host Configuration Protocol 基于TCP/IP,用于動(dòng)態(tài)配置工作站網(wǎng)絡(luò )接口,使工作站的網(wǎng)絡(luò )接口管理自動(dòng)化。
DHCP服務(wù)器軟件
dhcpd 網(wǎng)站:http://www.isc.org
安裝方法:
#tar -zxvf dhcp-4.0.0.tar.gz
#cd dhcp-4.0.0
#./configure
#make
#make install
#touch /var/db/dhcpd.leases
#vi /etc/dhcpd.conf --編輯配置文件
#/usr/sbin/dhcpd --啟動(dòng)dhcp服務(wù) 或者 #dhcpd
主要配置選項
1.默認網(wǎng)關(guān)
2.IP地址
3.子網(wǎng)掩碼
4.DNS服務(wù)器地址
5.租用時(shí)間
配置文件 /etc/dhcpd.conf
ddns-update-style none;
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name "my zone";
option domain-name-servers 192.168.0.1;
range 192.168.0.3 192.168.0.253;
default-lease-time 21600;
max-lease-time 43200;
host mail {
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 192.168.0.2;
}
}
===========================
#/usr/sbin/dhcpd 啟動(dòng)服務(wù)器
#grep bootp /etc/services 查看dhcp端口
#netstat -unl | grep 67
#ssh 192.168.0.11
Linux客戶(hù)機的配置
/etc/sysconfig/network-scripts/ifcfg-eth0:
DEVICE=etho
ONBOOT=yes
BOOTPROTO=dhcp
或者使用netconfig配置動(dòng)態(tài)地址:
然后運行
#service network restart
#more /etc/resolv.conf
#route -n
調試
調試服務(wù)器
1.查看日志文件
#tail -f /var/log/messages
2.查看租用記錄文件
#more /var/db/dhcpd.lease
調試客戶(hù)機
under linux:
#dhclient eth0
#under windows:
C:/>ipconfig /renew