H3C DHCP Relay配置
由于在IP地址动态获取过程中采用广播方式发送请求报文,因此DHCP只适用于DHCP客户端和服务器处于同一个子网内的情况。DHCP中继功能就解决了客户端可以通过DHCP中继与其他网段的DHCP服务器通信,最终获取到IP地址。
本篇介绍以Windows Server 2019作为DHCP服务器,H3C交换机配置DHCP Relay到服务器上为客户端分配地址方法,Relay agent地址务必要与服务器互通。
拓扑图:
DHCP_Server(192.168.1.200) --------- 核心交换机(192.168.1.100) ----------- 终端
核心交换机地址:192.168.1.100,服务器网卡地址:192.168.1.200。
DHCP服务器配置:
H3C交换机基本配置:
[H3C]vlan 10 to 30
[H3C]interface Vlan-interface 1
[H3C-Vlan-interface1]ip address 192.168.1.100 24
[H3C-Vlan-interface1]quit
[H3C]interface Vlan-interface 10
[H3C-Vlan-interface10]ip address 172.16.10.254 24
[H3C-Vlan-interface10]interface Vlan-interface 20
[H3C-Vlan-interface20]ip address 172.16.20.254 24
[H3C-Vlan-interface20]interface Vlan-interface 30
[H3C-Vlan-interface30]ip address 172.16.30.254 24
[H3C-Vlan-interface30]quit
H3C交换机DHCP Relay配置:
[H3C]dhcp enable #开启DHCP功能
[H3C]interface Vlan-interface 10
[H3C-Vlan-interface10]dhcp select relay
[H3C-Vlan-interface10]dhcp relay server-address 192.168.1.200 #可以配置多个服务器
[H3C-Vlan-interface10]quit
[H3C]interface Vlan-interface 20
[H3C-Vlan-interface20]dhcp select relay
[H3C-Vlan-interface20]dhcp relay server-address 192.168.1.200
[H3C-Vlan-interface20]quit
[H3C]interface Vlan-interface 30
[H3C-Vlan-interface30]dhcp select relay
[H3C-Vlan-interface30]dhcp relay server-address 192.168.1.200
[H3C-Vlan-interface30]quit
交换机debugging日志:
From 0.0.0.0 port 68, interface Vlan-interface10
Message type: REQUEST (1)
Hardware type: 1, Hardware address length: 6
Hops: 0, Transaction ID: 484277912
Seconds: 0, Broadcast flag: 1
Client IP address: 0.0.0.0 Your IP address: 0.0.0.0
Server IP address: 0.0.0.0 Relay agent IP address: 0.0.0.0
Client hardware address: 3cf5-ccbd-09ed
Server host name: not configured
Boot file name: not configured
DHCP message type: DHCPREQUEST (3)
*Jan 1 00:35:02:369 2013 H3C DHCPR/7/PACKET:
To 192.168.1.200 port 67, interface is selected by routing table
Message type: REQUEST (1)
Hardware type: 1, Hardware address length: 6
Hops: 1, Transaction ID: 484277912
Seconds: 0, Broadcast flag: 1
Client IP address: 0.0.0.0 Your IP address: 0.0.0.0
Server IP address: 0.0.0.0 Relay agent IP address: 172.16.10.254 #Relay agent地址务必要与服务器互通。
Client hardware address: 3cf5-ccbd-09ed
Server host name: not configured
Boot file name: not configured
DHCP message type: DHCPREQUEST (3)
*Jan 1 00:35:02:374 2013 H3C DHCPR/7/PACKET:
From 192.168.1.200 port 67, interface Vlan-interface10
Message type: REPLY (2)
Hardware type: 1, Hardware address length: 6
Hops: 0, Transaction ID: 484277912
Seconds: 0, Broadcast flag: 1
Client IP address: 0.0.0.0 Your IP address: 172.16.10.10 #客户端获取的到的地址
Server IP address: 0.0.0.0 Relay agent IP address: 172.16.10.254
Client hardware address: 3cf5-ccbd-09ed
Server host name: not configured
Boot file name: not configured
DHCP message type: DHCPACK (5)
*Jan 1 00:35:02:375 2013 H3C DHCPR/7/PACKET:
To 255.255.255.255 port 68, interface Vlan-interface10
Message type: REPLY (2)
Hardware type: 1, Hardware address length: 6
Hops: 0, Transaction ID: 484277912
Seconds: 0, Broadcast flag: 1
Client IP address: 0.0.0.0 Your IP address: 172.16.10.10
Server IP address: 0.0.0.0 Relay agent IP address: 172.16.10.254
Client hardware address: 3cf5-ccbd-09ed
Server host name: not configured
Boot file name: not configured
DHCP message type: DHCPACK (5)