中继配置的意义:
DHCP服务器与DHCP客户端不在同一网段内,避免每一个网段都布置DHCP服务,DHCP中继负责DHCP服务器与DHCP客户端之间的DHCP报文转发。
1、拓扑如下
2、交换机配置
SW2的配置如下
The device is running! <Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]sysname sw2 [sw2]vlan batch 10 20 Info: This operation may take a few seconds. Please wait for a moment...done. [sw2]interface Ethernet 0/0/1 [sw2-Ethernet0/0/1]port link-type trunk [sw2-Ethernet0/0/1]port trunk allow-pass vlan 10 20 [sw2-Ethernet0/0/1]quit
<sw2>sys Enter system view, return user view with Ctrl+Z. [sw2]interface Ethernet 0/0/2 [sw2-Ethernet0/0/2]port link-type access [sw2-Ethernet0/0/2]port default vlan 10 [sw2-Ethernet0/0/2]quit <sw2>sys Enter system view, return user view with Ctrl+Z. [sw2]inter [sw2]interface Ethernet 0/0/3 [sw2-Ethernet0/0/3]port link-type access [sw2-Ethernet0/0/3]port default vlan 20 [sw2-Ethernet0/0/3]quit [sw2]quit <sw2>save The current configuration will be written to the device. Are you sure to continue?[Y/N]Y Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]: Aug 18 2023 15:33:58-08:00 sw2 %%01CFM/4/SAVE(l)[0]:The user chose Y when decidi ng whether to save the configuration to the device. Now saving the current configuration to the slot 0. Save the configuration successfully. <sw2> <sw2> Aug 18 2023 15:33:59-08:00 sw2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 .191.3.1 configurations have been changed. The current change number is 11, the change loop count is 0, and the maximum number of records is 4095.
查看sw2 vlan 和配置信息
dis vlan 、display current-configuration
SW3的配置如下
The device is running! <Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]sysname sw3 [sw3]vlan batch 30 40 [sw3]interface Ethernet 0/0/1 [sw3-Ethernet0/0/1]ports link-type trunk [sw3-Ethernet0/0/1]port trunk allow-pass vlan 30 40 [sw3-Ethernet0/0/1]quit [sw3]interface Ethernet 0/0/2 [sw3-Ethernet0/0/2]port link-type access [sw3-Ethernet0/0/2]port default vlan 30 [sw3-Ethernet0/0/2]quit [sw3]interface Ethernet 0/0/3 [sw3-Ethernet0/0/3]port link-type access [sw3-Ethernet0/0/3]port default vlan 40 [sw3-Ethernet0/0/3]quit [sw3]quit <sw3>save The current configuration will be written to the device. Are you sure to continue?[Y/N]Y Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]: Aug 18 2023 15:57:23-08:00 sw3 %%01CFM/4/SAVE(l)[0]:The user chose Y when decidi ng whether to save the configuration to the device. Now saving the current configuration to the slot 0. Save the configuration successfully. <sw3>
SW1的配置如下 (汇聚层交换机)
The device is running! ################################################## <Huawei> <Huawei>sys Enter system view, return user view with Ctrl+Z. [Huawei]sysname sw1 Aug 18 2023 16:07:52-08:00 sw1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25 .191.3.1 configurations have been changed. The current change number is 5, the c hange loop count is 0, and the maximum number of records is 4095. [sw1]un info en #关闭配置更改提示信息 Info: Information center is disabled. [sw1]vlan batch 10 20 30 40 100 Info: This operation may take a few seconds. Please wait for a moment...done. [sw1-GigabitEthernet0/0/1]port link-type access [sw1-GigabitEthernet0/0/1]port default vlan 100 [sw1-GigabitEthernet0/0/1]quit [sw1]interface GigabitEthernet 0/0/2 [sw1-GigabitEthernet0/0/2]port link-type trunk [sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20 [sw1-GigabitEthernet0/0/2]quit [sw1]interface GigabitEthernet 0/0/3 [sw1-GigabitEthernet0/0/3]port link-type trunk [sw1-GigabitEthernet0/0/3]port trunk allow-pass vlan 30 40 [sw1-GigabitEthernet0/0/3]quit
[sw1]interface Vlanif 100 [sw1-Vlanif100]ip add [sw1-Vlanif100]ip address 192.168.10.254 24 [sw1-Vlanif100]quit [sw1]interface Vlanif 10 [sw1-Vlanif10]ip address 10.1.10.254 24 [sw1-Vlanif10]quit [sw1]interface Vlanif 20 [sw1-Vlanif20]ip address 10.1.20.254 24 [sw1-Vlanif20]quit [sw1]interface Vlanif 30 [sw1-Vlanif30]ip address 10.1.30.254 24 [sw1-Vlanif30]quit [sw1]interface Vlanif 40 [sw1-Vlanif40]ip address 10.1.40.254 24 [sw1-Vlanif40]quit [sw1]quit <sw1>save The current configuration will be written to the device. Are you sure to continue?[Y/N]Y Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]: Now saving the current configuration to the slot 0. Save the configuration successfully. <sw1>
路由器AR1配置 DHCP-Server配置
<Huawei>sys
[Huawei]sysname DHCP-Server
[DHCP-Server]un info en Info: Information center is disabled. [DHCP-Server]interface GigabitEthernet 0/0/0 [DHCP-Server-GigabitEthernet0/0/0]ip address 192.168.10.1 24 [DHCP-Server-GigabitEthernet0/0/0]quit [DHCP-Server]ip route-static 0.0.0.0 0 192.168.10.254 [DHCP-Server]
3、地址池配置
[DHCP-Server]dhcp enable Info: The operation may take a few seconds. Please wait for a moment.done.
[DHCP-Server]ip pool liu10 Info:It's successful to create an IP address pool. [DHCP-Server-ip-pool-liu10]dns-list 192.168.9.99 192.168.9.98 [DHCP-Server-ip-pool-liu10]network 10.1.10.0 mask 255.255.255.0 [DHCP-Server-ip-pool-liu10]gateway-list 10.1.10.254 [DHCP-Server-ip-pool-liu10]quit
[DHCP-Server]ip pool liu20 Info:It's successful to create an IP address pool. [DHCP-Server-ip-pool-liu20]network 10.1.20.0 mask 24 [DHCP-Server-ip-pool-liu20]gateway-list 10.1.20.254 [DHCP-Server-ip-pool-liu20]dns-list 192.168.9.99 192.168.9.98 [DHCP-Server-ip-pool-liu20]quit [DHCP-Server]ip pool liu30 Info:It's successful to create an IP address pool. [DHCP-Server-ip-pool-liu30]network 10.1.30.0 mask 24 [DHCP-Server-ip-pool-liu30]gateway-list 10.1.30.254 [DHCP-Server-ip-pool-liu30]dns-list 192.168.9.99 192.168.9.98 [DHCP-Server-ip-pool-liu30]quit [DHCP-Server]ip pool liu40 Info:It's successful to create an IP address pool. [DHCP-Server-ip-pool-liu40]network 10.1.40.0 mask 24 [DHCP-Server-ip-pool-liu40]gateway-list 10.1.40.254 [DHCP-Server-ip-pool-liu40]dns-list 192.168.9.99 192.168.9.98 [DHCP-Server-ip-pool-liu40]quit [DHCP-Server]interface GigabitEthernet 0/0/0 [DHCP-Server-GigabitEthernet0/0/0]dhcp select global [DHCP-Server-GigabitEthernet0/0/0]quit [DHCP-Server]quit <DHCP-Server>save The current configuration will be written to the device. Are you sure to continue?[Y/N]Y Info: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]: Now saving the current configuration to the slot 17. Save the configuration successfully. <DHCP-Server>
4、SW1 交换机中继配置
[sw1]interface Vlanif 10 [sw1-Vlanif10]dhcp select relay [sw1-Vlanif10]dhcp relay server-ip 192.168.10.1 [sw1-Vlanif10]quit [sw1]interface Vlanif 20 [sw1-Vlanif20]dhcp select relay [sw1-Vlanif20]dhcp relay server-ip 192.168.10.1 [sw1-Vlanif20]quit [sw1]interface Vlanif 30 [sw1-Vlanif30]dhcp select relay [sw1-Vlanif30]dhcp relay server-ip 192.168.10.1 [sw1-Vlanif30]quit [sw1]interface Vlanif 40 [sw1-Vlanif40]dhcp select relay [sw1-Vlanif40]dhcp relay server-ip 192.168.10.1 [sw1-Vlanif40]quit [sw1]quit <sw1>save The current configuration will be written to the device. Are you sure to continue?[Y/N]Y Now saving the current configuration to the slot 0. Save the configuration successfully. <sw1>
5、PC间通信测试,PC端设置自动获取IP方式
PC间是可以互通的
标签:quit,relay,ip,28,Server,sw1,DHCP,pool From: https://www.cnblogs.com/lvjing/p/17641022.html