您好,登錄后才能下訂單哦!
1.設置host、firewald、selinux
hostnamectl set-hostname fengxiaoli41.com
systemctl stop firewalld.service
systemctl disable firewalld.service
setenforce 0
2.配置基本dhcp服務
yum install -y dhcp
vim /etc/dhcp/dhcpd.conf
#全局參數
option domain-name "fengxiaoli41.com";
option domain-name-servers dns.fengxiaoli41.com;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;
#配置192.168.1.0網段動態獲取
subnet 192.168.1.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.1.20 192.168.1.254;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
}
#配置192.168.1.0網絡給該mac分配固定ip
host feng {
#hardware ethernet MAC
fixed-address 192.168.1.5;
}
systemctl restart dhcpd
systemctl status dhcpd
-------------至此客戶端可以獲取動態和固定ip
3.中繼服務器
vim /etc/dhcp/dhcpd.conf
#配置192.168.2.0為dhcp中繼網段(若沒有中)
subnet 192.168.2.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.2.20 192.168.2.254;
option broadcast-address 192.168.2.255;
option routers 192.168.2.254;
}
cp /lib/systemd/system/dhcrelay.service /etc/systemd/system/
cd /etc/systemd/system/
vim dhcrelay.service
[Service]
ExecStart=/usr/sbin/dhcrelay -d --no-pid 192.168.1.10
4.重啟服務
systemctl --system daemon-reload
systemctl restart dhcrelay.service
注:配置之前先要保證dhcp服務器和中繼服務器網絡互通,dhcp服務器為192.168.1.0網段,中繼服務器192.168.2.0網段。另外也可在dhcp服務器上添加兩塊網卡,將中繼服務器與dhcp服務器配置在同一服務器上。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。