配置好一个双网卡(centos6.5)、一个dhcp服务器(centos7)和一个客户机
客户机为2网卡(此处为192.168.2.0网段0
DHCP服务器为1网卡(此处为192.168.1.0网段)
双网卡:1网卡与服务器的网段相同,2网卡与客户机的网段相同
centos6.5的网卡配置路径为/etc/syconfig/network-scripts/ifcfg-eth0
中继的第一块网关指向服务器的IP
systemctl stop firewalld
setenforce 0
配置第二块网卡
cd /etc/syconfig/network-scripts
cp ifcfg-eth0 ifcfg-eth1(记得编辑文件)
systemctl restart network
将客户机修改为dhcp自动获取
服务器中配置服务
挂载光盘
mount /dev/cdrom /media
rpm -ivh /media/Packages/dhcp-4
vim /etc/dhcp/dhcpd.conf
subnet 192.168.1.0 netmask 255.255.255.0{
range 192.168.1.100 192.168.1.200;
option routers 192.168.1.254;
}
subnet 192.168.2.0 netmask 255.255.255.0{
range 192.168.2.100 192.168.2.200;
option routers 192.168.2.254;
}
centos6.5中配置中继(记得关闭防火墙和沙盒)
mount /dev/cdrom /media
rpm -ivh /media/Packages/dhcp-4
vim /etc/sysconfig/dhcrelay
INTERFACES="eth0 eth1"
DHCPSERVERS="192.168.1.1"
service dhcrelay start #开启DHCP服务
echo "1" > /proc/sys/net/ipv4/ip_forward #开启包转发功能