1. 程式人生 > >華為綜合實驗:STP與VRRP技術

華為綜合實驗:STP與VRRP技術

VLAN STP RIP VRRP NAT

本實驗使用華為eNSP模擬器,采用了VLAN技術、MSTP技術、VRRP技術、RIP等技術,搭建了一個簡單的公司內網環境,實現網絡的冗余及負載均衡


實驗環境如下:

技術分享圖片


在sw1上配置

<Huawei>system-view 
[Huawei]sysname sw1
[sw1]vlan batch 10 20          #配置VLAN以及Trunk
[sw1]int e0/0/1
[sw1-Ethernet0/0/1]port link-type access 	
[sw1-Ethernet0/0/1]port default vlan 10
[sw1-Ethernet0/0/1]int e0/0/2	
[sw1-Ethernet0/0/2]port link-type access 	
[sw1-Ethernet0/0/2]port default vlan 20
[sw1-Ethernet0/0/2]int e0/0/3
[sw1-Ethernet0/0/3]port link-type trunk 
[sw1-Ethernet0/0/3]port trunk allow-pass vlan 10 20
[sw1-Ethernet0/0/3]int e0/0/4	
[sw1-Ethernet0/0/4]port link-type trunk 	
[sw1-Ethernet0/0/4]port trunk allow-pass vlan 10 20

[sw1]stp region-configuration 	   #進入創建MSTP實例模式
[sw1-mst-region]region-name test	#配置統一的實例名
[sw1-mst-region]revision-level 1        #配置一致的修訂級別
[sw1-mst-region]instance 1 vlan 10      #配置實例1,將vlan10加入到實例1
[sw1-mst-region]instance 2 vlan 20	#配置實例2,將vlan20加入到實例2
[sw1-mst-region]active region-configuration      #提交配置


在3sw1上配置

<Huawei>system-view 
[Huawei]sysname 3sw1
[3sw1]vlan batch 10 20 1000
[3sw1]int g0/0/1
[3sw1-GigabitEthernet0/0/1]port link-type trunk 
[3sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[3sw1-GigabitEthernet0/0/1]int g0/0/2
[3sw1-GigabitEthernet0/0/2]port link-type trunk
[3sw1-GigabitEthernet0/0/2] port trunk allow-pass vlan 10 20
[3sw1-GigabitEthernet0/0/2]int g0/0/3	
[3sw1-GigabitEthernet0/0/3]port link-type access 	
[3sw1-GigabitEthernet0/0/3]port default vlan 1000

[3sw1]stp region-configuration          #配置MSTP實例
[3sw1-mst-region] region-name test
[3sw1-mst-region] revision-level 1
[3sw1-mst-region] instance 1 vlan 10
[3sw1-mst-region] instance 2 vlan 20
[3sw1-mst-region] active region-configuration

[3sw1]stp instance 1 root primary        #指定為實例1 的根網橋
[3sw1]stp instance 2 root secondary      #指定為實例2 的備份網橋

[3sw1]int Vlanif 10                 #配置為vlan10的master
[3sw1-Vlanif10]ip add 192.168.10.100 24            #配置vlan10網關的真實IP
[3sw1-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254   #配置虛擬網關
[3sw1-Vlanif10]vrrp vrid 10 priority 150           #優先級
[3sw1-Vlanif10]vrrp vrid 10 track int g0/0/2 reduced 100   #端口跟蹤
[3sw1-Vlanif10]vrrp vrid 10 track int g0/0/3 reduced 100

[3sw1-Vlanif10]int vlanif 20        #配置為vlan20的backup
[3sw1-Vlanif20]ip add 192.168.20.100 24
[3sw1-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254

[3sw1]int Vlanif 1000
[3sw1-Vlanif1000]ip add 192.168.1.2 30

[3sw1]rip 1
[3sw1-rip-1]undo summary      #關閉路由自動匯總
[3sw1-rip-1]version 2         #開啟版本2
[3sw1-rip-1]network 192.168.10.0    #宣告路由
[3sw1-rip-1]network 192.168.20.0
[3sw1-rip-1]network 192.168.1.0
[3sw1-rip-1]silent-interface g0/0/1   #配置被動接口
[3sw1-rip-1]silent-interface g0/0/2

[3sw1]display vrrp brief       #查看VRRP配置信息
VRID  State        Interface                Type     Virtual IP     
----------------------------------------------------------------
10    Master       Vlanif10                 Normal   192.168.10.254 
20    Backup       Vlanif20                 Normal   192.168.20.254 
----------------------------------------------------------------
Total:2     Master:1     Backup:1     Non-active:0


在3sw2上配置

<Huawei>system-view 
[Huawei]sysname 3sw2
[3sw2]vlan batch 10 20 2000
[3sw2]int g0/0/1
[3sw2-GigabitEthernet0/0/1]port link-type trunk 
[3sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[3sw2-GigabitEthernet0/0/1]int g0/0/2
[3sw2-GigabitEthernet0/0/2]port link-type trunk 
[3sw2-GigabitEthernet0/0/2]port trunk allow-pass vlan 10 20
[3sw2-GigabitEthernet0/0/2]int  g0/0/3
[3sw2-GigabitEthernet0/0/3]port link-type access 
[3sw2-GigabitEthernet0/0/3]port default vlan 2000

[3sw2]stp region-configuration             #配置MSTP實例
[3sw2-mst-region] region-name test
[3sw2-mst-region] revision-level 1
[3sw2-mst-region] instance 1 vlan 10
[3sw2-mst-region] instance 2 vlan 20
[3sw2-mst-region] active region-configuration

[3sw2]stp instance 2 root primary        #指定為實例2 的根網橋
[3sw2]stp instance 1 root secondary      #指定為實例1 的備份網橋

[3sw2]int Vlanif 10                  #配置為vlan10的backup
[3sw2-Vlanif10]ip add 192.168.10.200 24
[3sw2-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254

[3sw2-Vlanif10]int vlanif 20         #配置為vlan20的master
[3sw2-Vlanif20]ip add 192.168.20.200 24
[3sw2-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254
[3sw2-Vlanif20]vrrp vrid 20 priority 150
[3sw2-Vlanif20]vrrp vrid 20 track int g0/0/2 reduced 100
[3sw2-Vlanif20]vrrp vrid 20 track int g0/0/3 reduced 100

[3sw2]int Vlanif 2000
[3sw2-Vlanif2000]ip add 192.168.1.6 30

[3sw2]rip 1
[3sw2-rip-1]undo summary
[3sw2-rip-1]version 2
[3sw2-rip-1]network 192.168.10.0
[3sw2-rip-1]network 192.168.20.0
[3sw2-rip-1]network 192.168.1.0
[3sw2-rip-1]silent-interface g0/0/1
[3sw2-rip-1]silent-interface g0/0/2

[3sw2]display vrrp brief 
VRID  State        Interface                Type     Virtual IP     
----------------------------------------------------------------
10    Backup       Vlanif10                 Normal   192.168.10.254 
20    Master       Vlanif20                 Normal   192.168.20.254 
----------------------------------------------------------------
Total:2     Master:1     Backup:1     Non-active:0


在R1上配置

<Huawei>system-view 
[Huawei]sysname R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 30
[R1-GigabitEthernet0/0/0]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 192.168.1.5 30
[R1-GigabitEthernet0/0/2]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 100.1.1.1 30

[R1]ip route-static 0.0.0.0 0.0.0.0 100.1.1.2
[R1]rip 1	
[R1-rip-1]undo summary 
[R1-rip-1]version 2
[R1-rip-1]network 100.0.0.0
[R1-rip-1]network 192.168.1.0
[R1-rip-1]default-route originate      #宣告默認路由

[R1]acl 2000	
[R1-acl-basic-2000]rule permit source 192.168.10.0 0.0.0.255
[R1-acl-basic-2000]rule permit source 192.168.20.0 0.0.0.255	
[R1-acl-basic-2000]rule deny source any 
[R1-acl-basic-2000]quit
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]nat outbound 2000


配置完畢,實現全網互通,如果一個核心交換機出現故障,也不會影響網絡的正常通信了



華為綜合實驗:STP與VRRP技術