如何搭建DHCP服务器
1、要是没有现成的Linux系统的话可以用虚拟机安装一个,参考文章:http://jingyan.baidu.com/article/49711c61460c78fa451b7c5e.html。
仅仅看第二步以后的内容即可。
2、rpm -qa |grep -i dhcp, 检查DHCP有没有安装
3、如果没有安装的话,在网络上下载,或者从安装光盘里面找到dhcp安装包,进行安装
rpm -ivh dhcp-3.0pl1-23.i386.rpm。
4、修改 /etc/dhcpd.conf 文件,这里的next server后面的ip就是你这台Linux的IP[一定要一样,请把下面的ip修改成您需要的ip].
文件内容如下:
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
default-lease-time 172800;
class "pxeclients" {
match ifsubstring(option vendor-class-identifier,0,9)="PXEClient";
next-server 192.168.1.250; # set the next server. PXE client will try to connect the nextserver for bootstrap.
filename"linux-install/pxelinux.0"; # set the bootstrap
}
subnet 192.168.1.0 netmask 255.255.255.0 { # set IPrange
optionbroadcast-address 192.168.1.255;
optionrouters 192.168.1.250;
optionsubnet-mask 255.255.255.0;
range192.168.1.1 192.168.1.249;
default-lease-time 86400; #how long the configuration will be kept for thisPXE client.
}
5、修改完成以后重启DHCP服务,service dhcpd restart.
可以用 service dhcpd status查看当前dhcp服务的状态。