HCIP第二次作业(VRRP/STP/VLAN/Eth-trunk/NAT)

实验拓扑图

根据要求,将配置的拓扑梳理为:

实验内容

顺序1,2,3 vlan,eth-trunk

建立配置vlan,建立eth-trunk

SW1

bash 复制代码
<Huawei>sys
[Huawei]sys SW1

#创建vlan2 3
[SW1]vlan ba 2 to 3    

#创建eth-trunk
[SW1]interface Eth-Trunk 0
[SW1-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 0/0/2

#配置vlan
[SW1]port-group group-member GigabitEthernet 0/0/3 GigabitEthernet 0/0/4 Eth-Trunk 0
[SW1-port-group]port link-type trunk 
[SW1-port-group]port trunk allow-pass vlan 2 to 3
[SW1-port-group]undo port trunk allow-pass vlan 1

SW2

bash 复制代码
<Huawei>sys
[Huawei]sys SW2
[SW2]vlan ba 2 to 3

[SW2]interface Eth-Trunk 0
[SW2-Eth-Trunk0]trunkport GigabitEthernet 0/0/1 0/0/2

[SW2-GigabitEthernet0/0/4]port link-type trunk 
[SW2-Eth-Trunk0]port link-type trunk 
[SW2-Eth-Trunk0]port trunk allow-pass vlan 2 to 3

[SW2-Eth-Trunk0]port-group group-member GigabitEthernet 0/0/3 GigabitEthernet 0/0/4 Eth-Trunk 0
[SW2-port-group]port link-type trunk 
[SW2-port-group]port trunk allow-pass vlan 2 to 3
[SW2-port-group]undo por trunk all vlan 1

SW3

bash 复制代码
<Huawei>sys
[Huawei]sys SW3
[SW3]vlan ba 2 to 3
[SW3]int GigabitEthernet  0/0/1
[SW3-GigabitEthernet0/0/1]port link-type access 
[SW3-GigabitEthernet0/0/1]port default vlan 2
[SW3]int GigabitEthernet  0/0/2
[SW3-GigabitEthernet0/0/2]port link-type access 
[SW3-GigabitEthernet0/0/2]port default vlan 3
[SW4-GigabitEthernet0/0/2]q
[SW3]port-group group-member g 0/0/3 g 0/0/4
[SW3-port-group]por link-t tru
[SW3-port-group]port trunk allow-pass vlan 2 to 3
[SW3-GigabitEthernet0/0/4]undo por tr all vla 1

SW4

bash 复制代码
<Huawei>sys
[Huawei]sys SW4
[SW4]vlan ba 2 to 3
[SW4]int g 0/0/1
[SW4-GigabitEthernet0/0/1]port link-type  acc
[SW4-GigabitEthernet0/0/1]port default vlan 2
[SW4-GigabitEthernet0/0/1]int g 0/0/2
[SW4-GigabitEthernet0/0/2]por link-t acc
[SW4-GigabitEthernet0/0/2]por de vlan 3
[SW4-GigabitEthernet0/0/2]q
[SW4]port-group group-member g 0/0/3 g 0/0/4
[SW4-port-group]port link-type trun
[SW4-port-group]port trunk allow-pass vlan 2 to 3
[SW4-port-group]undo por tr all vla 1

顺序4

建立mstp

所有交换机

bash 复制代码
[SW]stp region-configuration 
[SW-mst-region]region-name aa    #域名
[SW-mst-region]revision-level 1    #修订等级
[SW-mst-region]instance 2 vlan 2    #划分实例
[SW-mst-region]instance 3 vlan 3
[SW-mst-region]active region-configuration     #激活配置
[SW-mst-region]q

SW1

bash 复制代码
[SW1]stp instance 2 root primary    #SW1在实例2作为根网桥
[SW1]stp instance 3 root secondary     #SW1在实例3作为备份网桥

SW2

bash 复制代码
[SW2]stp instance 2 root secondary
[SW2]stp instance 3 root primary 

顺序5,6 SVI,vrrp

SVI和vrrp的配置

SW1

bash 复制代码
[SW1]interface Vlanif 2
[SW1-Vlanif2]ip add 172.16.2.1 24
[SW1-Vlanif2]vrrp vrid 2 virtual-ip 172.16.2.254
[SW1-Vlanif2]vrrp vrid 2 priority 110
#配置上升链路监控和抢占延迟
[SW2-Vlanif2]vrrp vrid 2 track interface g 0/0/5 reduced 11
[SW2-Vlanif2]vrrp vrid 2 preempt-mode timer delay 20

[SW1-Vlanif2]int vlanif 3
[SW1-Vlanif3]ip add 172.16.3.2 24
[SW1-Vlanif3]vrrp vrid 3 virtual-ip 172.16.3.254

SW2

bash 复制代码
[SW2]int vlanif 2
[SW2-Vlanif2]ip add 172.16.2.2 24
[SW2-Vlanif2]vrrp vrid 2 virtual-ip 172.16.2.254
[SW2-Vlanif2]int vlanif 3
[SW2-Vlanif3]ip add 172.16.3.1 24
[SW1-Vlanif3]vrrp vrid 3 virtual-ip 172.16.3.254
[SW2-Vlanif3]vrrp vrid 3 priority 110
[SW2-Vlanif3]vrrp vrid 3 track interface g 0/0/5 reduced 11
[SW2-Vlanif3]vrrp vrid 3 preempt-mode timer delay 20

顺序7 ip

dhcp实现ip地址分配

SW1和SW2

bash 复制代码
[SW]dhcp enable 
[SW]ip pool vlan2
[SW-ip-pool-vlan2]network 172.16.2.0 mask 24
[SW-ip-pool-vlan2]gateway-list 172.16.2.254
[SW-ip-pool-vlan2]q
[SW]ip pool vlan3
[SW-ip-pool-vlan3]network 172.16.3.0 mask 24
[SW-ip-pool-vlan3]gateway-list 172.16.3.254
[SW1-ip-pool-vlan3]q
[SW1]int vlanif 2
[SW1-Vlanif2]dhcp select global 
[SW1-Vlanif2]int vlanif 3
[SW1-Vlanif3]dhcp select global 

结果:

PC1

PC4

顺序8 路由

SW1

bash 复制代码
#连接AR1
[SW1]vlan 10
[SW1-vlan10]q
[SW1]int vlanif 10
[SW1-Vlanif10]ip add 172.16.0.1 30
[SW1]int g 0/0/5
[SW1-GigabitEthernet0/0/5]port link-type access 
[SW1-GigabitEthernet0/0/5]port default vlan 10

#配置ospf
[SW1]ospf 1 rout	
[SW1]ospf 1 router-id 2.2.2.2
[SW1-ospf-1]area 0
[SW1-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255

SW2

bash 复制代码
[SW2]vlan 10
[SW2-vlan10]q
[SW2]int vlanif 10
[SW2-Vlanif10]ip add 172.16.0.5 24
[SW2-Vlanif10]q
[SW2]int g 0/0/5
[SW2-GigabitEthernet0/0/5]port link-type access 
[SW2-GigabitEthernet0/0/5]port default vlan 10
[SW2]ospf 1 router-id 3.3.3.3
[SW2-ospf-1]area 0
[SW2-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255

AR1

bash 复制代码
<Huawei>sys
[Huawei]sys AR1
[AR1]int g 0/0/1
[AR1-GigabitEthernet0/0/1]ip add 172.16.0.2 30
[AR1-GigabitEthernet0/0/1]int g 0/0/2
[AR1-GigabitEthernet0/0/2]ip add 172.16.0.6 30
[AR1-GigabitEthernet0/0/2]int g 0/0/0
[AR1-GigabitEthernet0/0/0]ip add 12.0.0.1 24
[AR1]ospf 1 router-id 1.1.1.1
[AR1-ospf-1]area 0
[AR1-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.0.255
[AR1-ospf-1-area-0.0.0.0]q

#配置缺省
[AR1-ospf-1]default-route-advertise always 
[AR1-ospf-1]q
[AR1]ip route-static 0.0.0.0 0 12.0.0.2

AR2

bash 复制代码
<Huawei>sys
[Huawei]sys ISP
[ISP]int g 0/0/0
[ISP-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[ISP-GigabitEthernet0/0/0]int l0
[ISP-LoopBack0]ip add 1.1.1.1 24

结果:

PC1 ping PC3

顺序9 nat

AR1

bash 复制代码
[AR1]acl 2000
[AR1-acl-basic-2000]rule permit  source 172.16.0.0 0.0.255.255
[AR1-acl-basic-2000]q
[AR1]int g 0/0/0	
[AR1-GigabitEthernet0/0/0]nat outbound  2000

结果:

PC1 ping ISP环回

相关推荐
h7997108 小时前
wsl使用代理网络
网络
ghie909010 小时前
Reactor 模式结合 epoll
网络
qq_3106585111 小时前
webrtc代码走读(六)-QOS-FEC冗余度配置
网络·c++·webrtc
飞飞是甜咖啡12 小时前
网络渗流:爆炸渗流
网络
tft364013 小时前
An attempt was made to access a socket in a way forbidden by its access
服务器·网络·tcp/ip
tan180°13 小时前
Linux网络HTTP(下)(9)
linux·网络·http
baynk14 小时前
传输层协议分析
网络·协议分析
せいしゅん青春之我16 小时前
[JavaEE初阶] 传输层协议---UDP 相关笔记
网络·网络协议·java-ee
泷羽Sec-静安16 小时前
Less-1 GET-Error based-Single quotes-String GET-基于错误-单引号-字符串
前端·css·网络·sql·安全·web安全·less