ensp-----实验---DHCP中继

一.应用场景

  • 通常在DHCP分配网段过多的情况下,网关路由器上配置DHCP服务,压力过大
  • 一般我们用第二路由器,或者第二台DHCP服务器来分担业务

二.网络拓补图

三.具体配置

LSW2的配置

//进入系统视图
<Huawei>sys
//修改名字
[Huawei]sysname sw1
//创建vlan10 20
[sw1]vlan bat 10 20
//配置access子接口  
[sw1]int e 0/0/1
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 10
[sw1-Ethernet0/0/1]un sh
Info: Interface Ethernet0/0/1 is not shutdown.
[sw1-Ethernet0/0/1]q
[sw1]int e 0/0/2
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port default vlan 20
[sw1-Ethernet0/0/2]undo shutdown
Info: Interface Ethernet0/0/2 is not shutdown.
[sw1-Ethernet0/0/2]int e 0/0/3
[sw1-Ethernet0/0/3]port link-type access
[sw1-Ethernet0/0/3]port default vlan 10
[sw1-Ethernet0/0/3]undo shutdown
Info: Interface Ethernet0/0/3 is not shutdown.
[sw1-Ethernet0/0/3]int e 0/0/4
[sw1-Ethernet0/0/4]port link-type access
[sw1-Ethernet0/0/4]port default vlan 20
[sw1-Ethernet0/0/4]undo shutdown
Info: Interface Ethernet0/0/4 is not shutdown.
[sw1-Ethernet0/0/4]q

//配置trunk接口
[sw1]int g 0/0/1
[sw1-GigabitEthernet0/0/1]port link-type trunk
[sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[sw1-GigabitEthernet0/0/1]undo shutdown 
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[sw1-GigabitEthernet0/0/1]

R3的配置

//进入系统视图
<Huawei>sys
//修改名字
[Huawei]sysname R3
//开启DHCP服务
[R3]dhcp enable
//进入虚拟子接口
[R1]int g 0/0/1.10
//开启trunk链路
[R1-GigabitEthernet0/0/1.10]dot1q termination vid 10
//开启arp广播
[R1-GigabitEthernet0/0/1.10]arp broadcast enable
//配置IP地址
[R1-GigabitEthernet0/0/1.10]ip add 192.168.10.1 24
//指向DHCP服务器
[R1-GigabitEthernet0/0/1.10]dhcp select relay 	
[R1-GigabitEthernet0/0/1.10]dhcp relay  server-ip 14.0.0.2
[R1-GigabitEthernet0/0/1.10]undo showdown
[R1-GigabitEthernet0/0/1.10]q

//给第二个虚拟子接口配置
[R1]int g0/0/1.20
//配置trunk	
[R1-GigabitEthernet0/0/1.20]dot1q termination vid 20	
//arp广播
[R1-GigabitEthernet0/0/1.20]arp broadcast enable	
[R1-GigabitEthernet0/0/1.20]ip add 192.168.20.1 24
//基于DHCP中继	
[R1-GigabitEthernet0/0/1.20]dhcp select relay
//指向dhcp服务器 	
[R1-GigabitEthernet0/0/1.20]dhcp relay server-ip 14.0.0.2
[R1-GigabitEthernet0/0/1.20]q

//配置IP地址
[R1]int g0/0/3
[R1-GigabitEthernet0/0/3]ip add 14.0.0.1 24
[R1-GigabitEthernet0/0/3]un sh
[R1-GigabitEthernet0/0/3]q

//配置IP地址
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 12.0.0.1 24
[R1-GigabitEthernet0/0/2]un sh	
[R1-GigabitEthernet0/0/2]q

//配置通往pc7的默认路由
[R1]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2

R4的配置

//进入系统视图
<Huawei>sys
//修改名字
[Huawei]sysname R2
//开启DHCP功能
[R2]dhcp enable 
//配置接口地址
[R2]int g0/0/2	
[R2-GigabitEthernet0/0/2]ip add 12.0.0.2 24
[R2-GigabitEthernet0/0/2]un sh	
[R2-GigabitEthernet0/0/2]q
//配置接口地址
[R2]int e0/0/0
[R2-Ethernet0/0/0]ip add 15.0.0.1 24
[R2-Ethernet0/0/0]un sh
//指向DHCP服务器
[R2-Ethernet0/0/0]dhcp select relay 
[R2-Ethernet0/0/0]dhcp relay server-ip 14.0.0.2
[R2-Ethernet0/0/0]q
//配置静态路由
[R2]ip route-static 192.168.10.0 24 12.0.0.1	
[R2]ip route-static 192.168.20.0 24 12.0.0.1	
[R2]ip route-static 14.0.0.0 24 12.0.0.1

R2的配置

//进入系统视图
<Huawei>sys
//修改名字
[Huawei]sysname R3
//开启DHCP服务
[R3]dhcp enable
//配置IP地址,宣告DHCP
[R3]int g0/0/3
[R3-GigabitEthernet0/0/3]ip add 14.0.0.2 24 
[R3-GigabitEthernet0/0/3]dhcp select global 
[R3-GigabitEthernet0/0/3]un sh	
[R3-GigabitEthernet0/0/3]q
//pc7的网段池
[R3]ip pool dhcp-pc7
[R3-ip-pool-dhcp-pc7]network 15.0.0.0 mask 24
[R3-ip-pool-dhcp-pc7]gateway-list 15.0.0.1	
[R3-ip-pool-dhcp-pc7]dns-list 8.8.8.8 114.114.114.114
[R3-ip-pool-dhcp-pc7]q

//vlan10的网段池
[R3]ip pool dhcp-vlan10	
[R3-ip-pool-dhcp-vlan10]network 192.168.10.0 mask 24	
[R3-ip-pool-dhcp-vlan10]gateway-list 192.168.10.1	
[R3-ip-pool-dhcp-vlan10]dns-list 8.8.8.8 114.114.114.114
[R3-ip-pool-dhcp-vlan10]q
//vlan20的网段池
[R3]ip pool dhcp-vlan20
[R3-ip-pool-dhcp-vlan20]network 192.168.20.0 mask 24	
[R3-ip-pool-dhcp-vlan20]gateway-list 192.168.20.1	
[R3-ip-pool-dhcp-vlan20]dns-list 8.8.8.8 114.114.114.114
[R3-ip-pool-dhcp-vlan20]q
//配置静态静态路由
[R3]ip route-static 192.168.10.0 24 14.0.0.1	
[R3]ip route-static 192.168.20.0 24 14.0.0.1
[R3]ip route-static 15.0.0.0 24 14.0.0.1
发布了94 篇原创文章 · 获赞 108 · 访问量 6415

猜你喜欢

转载自blog.csdn.net/qq_42761527/article/details/103490151