linux安装配置 dhcp服务详解

2016-01-0410:11:43linux安装配置 dhcp服务详解已关闭评论 611

1.安装dhcp软件包
yum -y install dhcp

cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf

subnet 192.168.0.0 netmask 255.255.255.0 { //地址段
range 192.168.0.1 192.168.0.100; //地址池
option domain-name-servers ns1.internal.example.org; //dns服务器域名,一般不需要
option domain-name "internal.example.org"; //域,,一般不需要
option routers 192.168.0.254; //网关
option broadcast-address 192.168.0.255; //广播地址
default-lease-time 600;//默认租约时间
max-lease-time 7200;//最大租约时间
}

2.独立保存dhcp日志
vim /etc/dhcp/dhcpd.conf
配置文件末尾添加
log-facility local4;

vim /etc/rsyslog.conf

*.info;mail.none;authpriv.none;cron.none /var/log/messages
改为
*.info;mail.none;authpriv.none;cron.none;local4.none /var/log/messages
dhcp的日志不记录到messages

添加
local4.* /var/log/dhcp.log
日志记录到dhcp.log

创建dhcp.log文件,修改权限
touch /var/log/dhcp.log
chmod 600 /var/log/dhcp.log

重启rsyslog,dhcpd 服务