linux DHCP服务器配置,基于CentOS6.4

因为作服务器的配置,首先把防火墙与selinux关了

首先,关闭防火墙,命令如下:

service iptables stop
chkconfig iptables off

然后,关闭selinux,打开vi /etc/selinux/config,设置SELINUX为不可用;

SELINUX=disable
使用yum联网安装DHCP:

yum install dhcp

DHCP的开启,关闭及重启命令如下:

service dhcpd start
service dhcpd stop
service dhcpd restart

安装后,如未对DHCP作配置,是不能正常开启DHCP的,否则会提示开启DHCP服务失败:

service dhcpd start
Starting dhcpd:           [FAILED]   #开启服务失败

然后设置DHCP的配置文件/etc/dhcpd/dhcpd.conf,如下:

default-lease-time 600;
max-lease-time 7200;

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.100 192.168.1.200;
  option domain-name-servers ns1.example.test;
  option domain-name "internal.example.test";
  option routers 192.168.1.1;
  option broadcast-address 192.168.1.255;
  default-lease-time 600;
  max-lease-time 7200;
}

host 20130217-1710 {
	hardware ethernet 0:0C:29:F5:02:53;
	fixed-address 192.168.1.111;
	option host-name "20130217-1710";
}
然后在开启DHCP服务器,就可以正常使用了
注:如果分配IP与DHCP服务器不在同一个网段,会出错,提示:Not configured to listen on any interfaces!

你可能感兴趣的:(linux,dhcp)