一:實驗環境
1.1: 華爲ensp軟件
1.2: PC機和路由器及交換機
初始化狀態的PC機和初始化狀態的路由器,交換機
二.實驗需求,實現全網互通且DHCP中繼在R4上
三:實驗過程
3.1:配置設備
在ensp中,將PC機和路由器及交換機準備好,並啓動。
ide
3.2配置思路
配置R1
1)配置接口this
Int g0/0/0 ; ip add 12.0.0.1 24 ;un sh Int g0/0/2 ; ip add 14.0.0.1 24 ;un sh
2)配置單臂路由及中繼code
dhcp enable #系統視圖下命令 int g0/0/1.10 ; ip add 192.168.10.1; d t v 10 ; a b e; dhcp select relay; #配置中繼模式 dhcp relay server-ip 14.0.0.2; #配置中繼地址 un sh int g0/0/1.20 ; ip add 192.168.20.1; d t v 20 ;a b e;dhcp select relay; dhcp relay server-ip 14.0.0.2; un sh
3)配置靜態/默認路由ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
配置R2
1) 配置接口server
int g0/0/0 ip add 12.0.0.2 24 un sh int g0/0/1 ip add 15.0.0.1 24 un sh;q
2)配置開啓中繼模式blog
dhcp enable dhcp select relay dhcp relay server-ip 14.0.0.2 ##指定中繼地址
3)配置靜態/默認路由(運營商端)dns
ip route-static 14.0.0.0 24 12.0.0.1 ip route-static 192.168.10.0 24 12.0.0.1 ip route-static 192.168.20.0 24 12.0.0.1
配置R4,提供中繼服務
1)配置路由接口接口
Int g0/0/0 Ip add 14.0.0.2 24 un sh
2)配置DHCP中繼服務ip
dhcp enable int g0/0/0 ip add 14.0.0.2 24 dhcp select global #在接口上聲明去全局模式找配置的DHCP服務 undo sh 配置中繼池子,一個網段配置一個 ip pool DHCP15 #進DHCP15,配置PC5 15網段的池子 network 15.0.0.0 mask 24 gateway-list 15.0.0.1 dns-list 8.8.8.8 2.2.2.2 excluded-ip-address 15.0.0.100 15.0.0.254 static-bind ip-address 15.0.0.88 mac-address 5489-98C3-6B6F ip pool DHCPvlan10 #進DHCPvlan10配置10.0網段池子 network 192.168.10.0 mask 24 gateway-list 192.168.10.1 dns-list 8.8.8.8 2.2.2.2 ip pool DHCPvlan20 #進DHCPvlan20配置20.0網段池子 network 192.168.20.0 mask 24 gateway-list 192.168.20.1 dns-list 8.8.8.8 2.2.2.2
3)配置路由ip route-static 0.0.0.0 0.0.0.0 14.0.0.1
3.3 配置SW1交換機路由
[SW1] vlan batch 10 20 [SW1] interface Ethernet0/0/1 [SW1-Ethernet0/0/1]port link-type access [SW1-Ethernet0/0/1]port default vlan 10 [SW1-Ethernet0/0/1]un sh [SW1]interface Ethernet0/0/2 [SW1-Ethernet0/0/2]port link-type access [SW1-Ethernet0/0/2]port default vlan 20 [SW1-Ethernet0/0/2]un sh [SW1] interface Ethernet0/0/3 [SW1-Ethernet0/0/3]port link-type access [SW1-Ethernet0/0/3]port default vlan 10 [SW1-Ethernet0/0/3]un sh [SW1]interface Ethernet0/0/4 [SW1-Ethernet0/0/4]port link-type access [SW1-Ethernet0/0/4]port default vlan 20 [SW1-Ethernet0/0/4]un sh [SW1-Ethernet0/0/4]int g0/0/1 [SW1-GigabitEthernet0/0/1]p l t [SW1-GigabitEthernet0/0/1]p t a v a [SW1-GigabitEthernet0/0/1]un sh
3.4配置R1路由器
3.4.1 配置單臂路由it
[R1]int g0/0/2 [R1-GigabitEthernet0/0/2]ip add 14.0.0.1 24 [R1-GigabitEthernet0/0/2]un sh [R1-GigabitEthernet0/0/2]int g0/0/0 [R1-GigabitEthernet0/0/0]ip add 12.0.0.1 24 [R1-GigabitEthernet0/0/0]un sh [R1]dhcp enable [R1]int GigabitEthernet 0/0/1.10 [R1-GigabitEthernet0/0/1.10]d t v 10 [R1-GigabitEthernet0/0/1.10]ip address 192.168.10.1 24 [R1-GigabitEthernet0/0/1.10]a b e [R1-GigabitEthernet0/0/1.10]un sh [R1-GigabitEthernet0/0/1.10]int GigabitEthernet 0/0/1.20 [R1-GigabitEthernet0/0/1.20]d t v 20 [R1-GigabitEthernet0/0/1.20]ip address 192.168.20.1 24 [R1-GigabitEthernet0/0/1.20]a b e [R1-GigabitEthernet0/0/1.20]un sh
3.4.2配置DHCP中繼服務(指定中繼路由地址)
[R1-GigabitEthernet0/0/1.20]int GigabitEthernet 0/0/1.10 [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]un sh [R1-GigabitEthernet0/0/1.10]int GigabitEthernet 0/0/1.20 [R1-GigabitEthernet0/0/1.20]dhcp select relay [R1-GigabitEthernet0/0/1.20]dhcp relay server-ip 14.0.0.2 [R1-GigabitEthernet0/0/1.20]un sh
3.4.3配置靜態路由[R1]ip route-static 0.0.0.0 0.0.0.0 12.0.0.2
3.5 配置R2路由器
3.5.1配置接口
[R2]int g0/0/0 [R2-GigabitEthernet0/0/0]ip add 12.0.0.2 24 [R2-GigabitEthernet0/0/0]un sh [R2-GigabitEthernet0/0/0]int g0/0/1 [R2-GigabitEthernet0/0/1]ip add 15.0.0.1 24 [R2-GigabitEthernet0/0/1]un sh
3.5.2配置中繼服務
[R2]dhcp enable [R2-GigabitEthernet0/0/1]dhcp select relay [R2-GigabitEthernet0/0/1]dhcp relay server-ip 14.0.0.2 [R2-GigabitEthernet0/0/1]undo sh [R2-GigabitEthernet0/0/1]q
3.5.3配置路由
[R2]ip route-static 14.0.0.0 24 12.0.0.1 [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
3.6 配置R4路由器
3.6.1配置路由接口
Int g0/0/0 Ip add 14.0.0.2 24 un sh
3.6.2配置DHCP中繼服務
[R4]dhcp enable #系統模式聲明啓用DHCP [R4]int g0/0/0 [R4-GigabitEthernet0/0/0]ip add 14.0.0.2 24 [R4-GigabitEthernet0/0/0]dhcp select global #在接口上聲明去全局模式找配置的DHCP
3.6.3配置的DHCP服務
[R4-GigabitEthernet0/0/0]undo sh [R4-GigabitEthernet0/0/0]q [R4]ip pool DHCP15 [R4-ip-pool-DHCP15]network 15.0.0.0 mask 24 [R4-ip-pool-DHCP15]gateway-list 15.0.0.1 [R4-ip-pool-DHCP15]dns-list 8.8.8.8 2.2.2.2 [R4-ip-pool-DHCP15]excluded-ip-address 15.0.0.100 15.0.0.254 [R4-ip-pool-DHCP15]static-bind ip-address 15.0.0.88 mac-address 5489-98C3-6B6F #此處MAC地址配的是PC5的mac,且配置分配15.0.0.88地址 [R4-ip-pool-DHCP15]dis this ip pool DHCP15 gateway-list 15.0.0.1 network 15.0.0.0 mask 255.255.255.0 static-bind ip-address 15.0.0.88 mac-address 5489-98c3-6b6f excluded-ip-address 15.0.0.100 15.0.0.254 dns-list 8.8.8.8 2.2.2.2 [R4-ip-pool-DHCP15]q [R4]ip pool DHCPvlan10 [R4-ip-pool-DHCPvlan10]network 192.168.10.0 mask 24 [R4-ip-pool-DHCPvlan10]gateway-list 192.168.10.1 [R4-ip-pool-DHCPvlan10]dns-list 8.8.8.8 2.2.2.2 [R4-ip-pool-DHCPvlan10]ip pool DHCPvlan20 [R4-ip-pool-DHCPvlan20]network 192.168.20.0 mask 24 [R4-ip-pool-DHCPvlan20]gateway-list 192.168.20.1 [R4-ip-pool-DHCPvlan20]dns-list 8.8.8.8 2.2.2.2 [R4-ip-pool-DHCPvlan20]q [R4]ip route-static 0.0.0.0 0.0.0.0 14.0.0.1
3.7 檢查是否知足需求
PC5已經獲取指定配置的IP