Linux运维 第三阶段 (二) DHCP服务
Linux运维 第三阶段 (二) DHCP服务
1、软件包:dhcp;
服务名:主程序dhcpd、中继服务dhcrelay;
端口:udp67、68、546、547;
配置文件:/etc/dhcp/dhcpd.conf 主配置文件
/etc/sysconfig/dhcrelay 中继配置文件
/usr/share/doc/dhcp*/dhcpd.conf.sample 主配置文件模板
2、搭建DHCP
服务端:#yum -y install dhcp
#cp /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
#vi /etc/dhcp/dhcpd.conf 删除多余配置,保留一个subnet区域
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
option routers 192.168.1.2;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.1.2;
default-lease-time 21600;
max-lease-time 23200;
}
客户端:#vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
#service dhcpd restart
3、搭建DHCP中继服务:
服务端:#yum -y install dhcp
#cp /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
#vi /etc/dhcp/dhcpd.conf 删除多余配置,保留一个subnet区域
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.100;
option routers 192.168.1.2;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.1.2;
default-lease-time 21600;
max-lease-time 23200;
}
subnet 200.200.200.0 netmask 255.255.255.0 {
range 200.200.200.10 200.200.200.100;
option routers 200.200.200.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 200.200.200.1;
default-lease-time 21600;
max-lease-time 23200;
}
#service dhcpd restart
#route add default gw 192.168.1.2
中继端:
#yum -y install dhcp
#vi /etc/sysctl.conf
net.ipv4.ip_forward=1
#sysctl -p
#vi /etc/sysconfig/dhcrelay
INTERFACE="eth0 eth1"
DHCPSERVER="192.168.1.1"
#service dhcrelay restart
客户端:
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
#service network restart
来自兄弟连培训
本文出自 “Linux运维重难点学习笔记” 博客,请务必保留此出处http://jowin.blog.51cto.com/10090021/1654840
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。