标签:ip地址 开启 ase 需要 str art max 双机热备 modify
DHCP三个端口:
服务端:UDP 67
客户端:UDP 68
DHCPv6 客户端:UDP 546,这是需要特别开启的 DHCP failover 服务,用来做双机热备的。
实验一、DHCP服务器基本配置
在RHEL1服务器上:
yum install dhcp
vim /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example
vim /etc/dhcp/dhcpd.conf
subnet 192.168.100.0 netmask 255.255.255.0 { range 192.168.100.30 192.168.100.60; option domain-name-servers 192.168.100.1; option domain-name "rusky.com"; option routers 192.168.100.1; option broadcast-address 192.168.100.255; default-lease-time 3600; max-lease-time 7200; } |
systemctl restart dhcpd
在linux客户端上
nmcli connection modify eno16777736 ipv4.method auto
nmcli connection down eno16777736
nmcli connection up eno16777736
ifconfig
实验二、根据MAC地址分配固定IP
vim /etc/dhcp/dhcpd.conf
host rhel1-eno16777736 {
hardware ethernet 00:0C:29:EB:BE:10;
fixed-address 192.168.100.88;
}
--有多台主机需要分配固定IP地址,则添加多段
systemctl restart dhcpd
systemctl restart dhcpd
systemctl enable dhcpd
在linux客户端上
nmcli connection modify eno16777736 ipv4.method auto
nmcli connection down eno16777736
nmcli connection up eno16777736
在windows客户端上
设置网卡自动获取IP地址和DNS
禁用网卡再启动网卡,查看IP
实验三、DHCP中继
对不同的网段分配不同的IP地址。
在rhel1上
添加虚拟网络vnet2,关闭DHCP服务
添加新网卡eno33554984,并将其插在vnet2网络上
nmcli connection add type ethernet con-name eno33554984 ifname eno33554984
nmcli connection modify eno33554984 ipv4.method manual ipv4.addresses "10.0.0.1/24 10.0.0.1" ipv4.dns 10.0.0.1 connection.autoconnect yes
nmcli connection up eno33554984
ifconfig
vim /etc/dhcp/dhcpd.conf
subnet 192.168.100.0 netmask 255.255.255.0 { range 192.168.100.30 192.168.100.60; option domain-name-servers 192.168.100.1; option domain-name "rusky.com"; option routers 192.168.100.1; option broadcast-address 192.168.100.255; default-lease-time 3600; max-lease-time 7200; } subnet 10.0.0.0 netmask 255.255.255.0 { range 10.0.0.30 10.0.0.60; option domain-name-servers 10.0.0.1; option domain-name "test.com"; option routers 10.0.0.1; option broadcast-address 10.0.0.255; default-lease-time 3600; max-lease-time 7200; } |
rhel2和rhel3分别将网卡连接到vnet1和vnet2网络上,获取到不同网段的IP
实验四、清除DHCP服务器的缓存
rm -f /var/lib/dhcpd/*
systemctl restart dhcpd
标签:ip地址 开启 ase 需要 str art max 双机热备 modify
原文地址:http://www.cnblogs.com/rusking/p/7749394.html