HCIP的交换机(STP,VRRP)实验

实验要求:

在这里插入图片描述

拓扑图:

在这里插入图片描述

链路聚合

LSW1

[lsw3]interface Eth-Trunk 1
[lsw3-Eth-Trunk1]trunkport GigabitEthernet 0/0/3 0/0/4
[lsw3-Eth-Trunk1]q
[lsw3]vlan batch 1 2
[lsw3]interface Eth-Trunk 1
[lsw3-Eth-Trunk1]port link-type trunk 
[lsw3-Eth-Trunk1]port trunk allow-pass vlan 1 2
[lsw3-Eth-Trunk1]q
[lsw3]int g0/0/1
[lsw3-GigabitEthernet0/0/1]port link-type trunk
[lsw3-GigabitEthernet0/0/1]port trunk allow-pass vlan 1 2
[lsw3-GigabitEthernet0/0/1]int g0/0/2
[lsw3-GigabitEthernet0/0/2]port link-type trunk
[lsw3-GigabitEthernet0/0/2]port trunk allow-pass vlan 1 2

LSW2

[lsw4]interface Eth-Trunk 1
[lsw4-Eth-Trunk1]trunkport GigabitEthernet 0/0/3 0/0/4
[lsw4-Eth-Trunk1]q
[lsw4]vlan batch 1 2
[lsw4]interface Eth-Trunk 1
[lsw4-Eth-Trunk1]port link-type trunk 
[lsw4-Eth-Trunk1]port trunk allow-pass vlan 1 2
[lsw4-Eth-Trunk1]q
[lsw4]int g0/0/1
[lsw4-GigabitEthernet0/0/1]port link-type trunk
[lsw4-GigabitEthernet0/0/1]port trunk allow-pass vlan 1 2
[lsw4-GigabitEthernet0/0/1]int g0/0/2
[lsw4-GigabitEthernet0/0/2]port link-type trunk
[lsw4-GigabitEthernet0/0/2]port trunk allow-pass vlan 1 2

LSW1配置

[lsw1]vlan batch 1 2
Info: This operation may take a few seconds. Please wait for a moment...done.
[lsw1]
[lsw1]int e0/0/3
[lsw1-Ethernet0/0/3]port link-type trunk
[lsw1-Ethernet0/0/3]port trunk allow-pass vlan 1 2
[lsw1-Ethernet0/0/3]int e0/0/4
[lsw1-Ethernet0/0/4]port link-type trunk
[lsw1-Ethernet0/0/4]port trunk allow-pass vlan 1 2
[lsw1-Ethernet0/0/4]int e0/0/1
[lsw1-Ethernet0/0/1]port link-t	
[lsw1-Ethernet0/0/1]port link-type acc	
[lsw1-Ethernet0/0/1]port link-type access 
[lsw1-Ethernet0/0/1]port de	
[lsw1-Ethernet0/0/1]port default 	
[lsw1-Ethernet0/0/1]port default vlan 1
[lsw1-Ethernet0/0/1]int e0/0/2
[lsw1-Ethernet0/0/2]port link-t	
[lsw1-Ethernet0/0/2]port link-type acc	
[lsw1-Ethernet0/0/2]port link-type access 
[lsw1-Ethernet0/0/2]port de	
[lsw1-Ethernet0/0/2]port default vlan 2

LSW2配置

[lsw2]vlan batch 1 2
Info: This operation may take a few seconds. Please wait for a moment...done.
[lsw2]int e0/0/3
[lsw2-Ethernet0/0/3]port link-type trunk
[lsw2-Ethernet0/0/3]port trunk allow-pass vlan 1 2
[lsw2-Ethernet0/0/3]int e0/0/4
[lsw2-Ethernet0/0/4]port link-type trunk
[lsw2-Ethernet0/0/4]port trunk allow-pass vlan 1 2
[lsw2-Ethernet0/0/4]int e0/0/1
[lsw2-Ethernet0/0/1]port link-t	
[lsw2-Ethernet0/0/1]port link-type ac	
[lsw2-Ethernet0/0/1]port link-type access 
[lsw2-Ethernet0/0/1]port de	
[lsw2-Ethernet0/0/1]port default 	
[lsw2-Ethernet0/0/1]port default vlan 1
[lsw2-Ethernet0/0/1]int e0/0/2
[lsw2-Ethernet0/0/2]port link-t	
[lsw2-Ethernet0/0/2]port link-type acc	
[lsw2-Ethernet0/0/2]port link-type access 
[lsw2-Ethernet0/0/2]port de	
[lsw2-Ethernet0/0/2]port default vlan 2
[lsw2-Ethernet0/0/2]
[lsw2-Ethernet0/0/2]q

所有access接口配置为边缘接口,并配置BPDU保护
LSW1

[lsw1]port-g	
[lsw1]port-group gr	
[lsw1]port-group group-member e0/0/1 e0/0/2
[lsw1-port-group]
[lsw1-port-group]stp ed	
[lsw1-port-group]stp edged-port en	
[lsw1-port-group]stp edged-port enable 
[lsw1-Ethernet0/0/1]stp edged-port enable 
[lsw1-Ethernet0/0/2]stp edged-port enable 
[lsw1-Ethernet0/0/2]q
[lsw1]stp bp	
[lsw1]stp bpdu-p	
[lsw1]stp bpdu-protection .

LSW2

[lsw2]port-g	
[lsw2]port-group gr	
[lsw2]port-group group-member e0/0/1 e0/0/2
[lsw2-port-group]stp ed	
[lsw2-port-group]stp edged-port en	
[lsw2-port-group]stp edged-port enable 
[lsw2-Ethernet0/0/1]stp edged-port enable 
[lsw2-Ethernet0/0/2]stp edged-port enable 
[lsw2-port-group]q
[lsw2]stp bp	
[lsw2]stp bpdu-p	
[lsw2]stp bpdu-protection 

开启MSTP
LSW1

[lsw1]stp mode mstp 	
[lsw1]stp mode mstp 
[lsw1]stp region-configuration 	
[lsw1]stp region-configuration 
[lsw1-mst-region]region-name HCIP
[lsw1-mst-region]revision-level 10	
[lsw1-mst-region]revision-level 10
[lsw1-mst-region]instance 1 vlan 1
[lsw1-mst-region]instance 2 vlan 2
[lsw1-mst-region]active region-configuration

LSW2

[lsw2]
[lsw2]stp mode mstp 	
[lsw2]stp mode mstp 
[lsw2]stp region-configuration 	
[lsw2]stp region-configuration 
[lsw2-mst-region]region-name HCIP
[lsw2-mst-region]revision-level 10	
[lsw2-mst-region]revision-level 10
[lsw2-mst-region]instance 1 vlan 1
[lsw2-mst-region]instance 2 vlan 2
[lsw2-mst-region]active region-configuration 

LSW3

[lsw3]stp mode mstp 	
[lsw3]stp mode mstp 
[lsw3]stp region-configuration 	
[lsw3]stp region-configuration 
[lsw3-mst-region]region-name HCIP
[lsw3-mst-region]revision-level 10	
[lsw3-mst-region]revision-level 10
[lsw3-mst-region]instance 1 vlan 1
[lsw3-mst-region]instance 2 vlan 2
[lsw3-mst-region]active region-configuration 

LSW4

[lsw4]stp mode mstp 	
[lsw4]stp mode mstp 
[lsw4]stp region-configuration 	
[lsw4]stp region-configuration 
[lsw4-mst-region]region-name HCIP
[lsw4-mst-region]revision-level 10	
[lsw4-mst-region]revision-level 10
[lsw4-mst-region]instance 1 vlan 1
[lsw4-mst-region]instance 2 vlan 2
[lsw4-mst-region]active region-configuration

配置主根和备份根
LSW3

[lsw3]stp instance 0 root primary
[lsw3]stp instance 1 root primary 
[lsw3]stp instance 2 root secondary

LSW4

[lsw4]stp instance 0 root secondary
[lsw4]stp instance 1 root secondary
[lsw4]stp instance 2 root primary

配置VRRP
LSW3

[lsw3]interface Vlanif 1
[lsw3-Vlanif1]ip address 172.16.1.1 24
[lsw3-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.254
[lsw3-Vlanif1]vrrp vrid 1 priority 105
[lsw3-Vlanif1]q
[lsw3]interface Vlanif 2
[lsw3-Vlanif2]ip address 172.16.2.1 24
[lsw3-Vlanif2]vrrp vrid 1 virtual-ip 172.16.2.254

LSW4

[lsw4]interface Vlanif 1
[lsw4-Vlanif1]ip address 172.16.1.2 24
[lsw4-Vlanif1]vrrp vrid 1 virtual-ip 172.16.1.254
[lsw4-Vlanif1]q
[lsw4]interface Vlanif 2
[lsw4-Vlanif2]ip address 172.16.2.2 24
[lsw4-Vlanif2]vrrp vrid 1 virtual-ip 172.16.2.254
[lsw4-Vlanif2]vrrp vrid 1 priority 105

配置DHCP,PC端自动获取IP地址
LSW3

[lsw3]dhcp enable 
[lsw3]ip pool v1
[lsw3-ip-pool-v1]network 172.16.1.0 mask 24
[lsw3-ip-pool-v1]gateway-list 172.16.1.254
[lsw3-ip-pool-v1]q
[lsw3]ip pool v2           
[lsw3-ip-pool-v2]network 172.16.2.0 mask 24
[lsw3-ip-pool-v2]gateway-list 172.16.2.254
[lsw3-ip-pool-v2]q
[lsw3]interface Vlanif 1
[lsw3-Vlanif1]dhcp select global 
[lsw3]interface Vlanif 2
[lsw3-Vlanif2]dhcp select global

LSW4

[lsw4]dhcp enable 
[lsw4]ip pool v1
[lsw4-ip-pool-v1]network 172.16.1.0 mask 24
[lsw4-ip-pool-v1]gateway-list 172.16.1.254
[lsw4-ip-pool-v1]q
[lsw4]ip pool v2           
[lsw4-ip-pool-v2]network 172.16.2.0 mask 24
[lsw4-ip-pool-v2]gateway-list 172.16.2.254
[lsw4-ip-pool-v2]q
[lsw4]interface Vlanif 1
[lsw4-Vlanif1]dhcp select global 
[lsw4]interface Vlanif 2
[lsw4-Vlanif2]dhcp select global

R1和R2基础配置
R1

[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 172.16.0.2 30
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip add 172.16.0.6 30
[r1-GigabitEthernet0/0/1]int g0/0/2
[r1-GigabitEthernet0/0/2]ip add 10.1.1.1 24

R2

[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 10.1.1.2 24
[r2-GigabitEthernet0/0/0]q
[r2]int l	
[r2]int LoopBack 0
[r2-LoopBack0]ip add 2.2.2.2 24
[r2-LoopBack0]

配置OSPF
LSW3

[lsw3]vlan 99
[lsw3]interface Vlanif 99
[lsw3-Vlanif99]ip address 172.16.0.1 30
[lsw3]interface g0/0/5 
[lsw3-GigabitEthernet0/0/1]port link-type access 
[lsw3-GigabitEthernet0/0/1]port default vlan 99

[lsw3]ospf 1 router-id 2.2.2.2
[lsw3-ospf-1]area 0
[lsw3-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.0.255
[lsw3-ospf-1]area 1
[lsw3-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.255.255

LSW4

[lsw4]vlan 99
[lsw4]interface Vlanif 99
[lsw4-Vlanif99]ip address 172.16.0.5 30
[lsw4]interface g0/0/5 
[lsw4-GigabitEthernet0/0/1]port link-type access 
[lsw4-GigabitEthernet0/0/1]port default vlan 99

[lsw4]ospf 1 router-id 3.3.3.3
[lsw4-ospf-1]area 0
[lsw4-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.0.255
[lsw4-ospf-1]area 1
[lsw4-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.255.255

R1

[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.0.255

沉默接口
LSW3

[lsw3-ospf-1]sil	
[lsw3-ospf-1]silent-interface all
[lsw3-ospf-1]undo silent-interface g	
[lsw3-ospf-1]undo silent-interface GigabitEthernet 0/0/5	
[lsw3-ospf-1]undo sil	
[lsw3-ospf-1]undo silent-interface e	
[lsw3-ospf-1]undo silent-interface Eth-Trunk 1
[lsw3-ospf-1]undo silent-interface vl	
[lsw3-ospf-1]undo silent-interface Vlanif 1
[lsw3-ospf-1]undo silent-interface Vlanif 99
[lsw3-ospf-1]

LSW4

[lsw4-ospf-1]sil	
[lsw4-ospf-1]silent-interface all
[lsw4-ospf-1]undo silent-interface g	
[lsw4-ospf-1]undo silent-interface GigabitEthernet 0/0/5	
[lsw4-ospf-1]undo sil	
[lsw4-ospf-1]undo silent-interface e	
[lsw4-ospf-1]undo silent-interface Eth-Trunk 1
[lsw4-ospf-1]undo silent-interface vl	
[lsw4-ospf-1]undo silent-interface Vlanif 1
[lsw4-ospf-1]undo silent-interface Vlanif 99
[lsw4-ospf-1]

缺省,NAT
R1

[r1]ip route-static 0.0.0.0 0 10.1.1.2
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]default-route-advertise
[r1-ospf-1]q
[r1]acl 2000
[r1-acl-basic-2000]rule 1 permit source any 
[r1]int g0/0/2
[r1-GigabitEthernet0/0/0]nat outbound 2000

结果展示:
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/Zombie_QP/article/details/132418707