DHCP :Dynamic Host Configuration Protocol 动态主机配置协议 使用UDP协议工作
端口:
DHCP Server: UDP67
DHCP Client: UDP68
正式安装DHCP服务:
Yum install dhcp dhcp-devel -y即可,然后修改DHCP
/etc/dhcpd.conf 配置文件内容如下:
ddns-uupdate-style interim;
ignore client-updates;
next-server 192.168.0.79;
filename "pxelinux.0";
allow booting;
allow bootp;
subnet 192.168.0.0 netmask 255.255.252.0{
#---default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
#option nis-domain "domain.org";
#option domain-name "192.168.0.10";
#otion domain-name-servers 182.168.0.11;
#option ntp-servers 192.168.1.1;
#option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# --you understand Netbios very well
#option netbios-node-type 2;
range dynamic-bootp 192.168.0.100 192.168.0.200;
host ns{
hardware ethernet 00:1a:a0:2b:38:81;
fixed-address 192.168.0.101;
}
}
注意如上配置,需要修改成对应服务器网段ip,然后重启DHCP服务, /etc/init.d/dhcpd restart即可。
客户端要从这个DHCP服务器获取ip,需要做简单的设置,如果是linux,需要把/etc/sysconfig/network-scritps/ifcfg-eth0 里BOOTPROTO修改成dhcp即可,windows机器的话,需要修改本地连接,把他设置成自动获取ip即可;
BOOTPROTO-dhcp