天天看點

組網技術(二)1.交換機VLAN實驗2.交換機STP實驗3.動态路由RIP實驗

組網技術(二)

  • 1.交換機VLAN實驗
  • 2.交換機STP實驗
  • 3.動态路由RIP實驗

1.交換機VLAN實驗

1.1 交換機GVRP:VLAN注冊協定,在VLAN增加、删除、調整時,自動發廣播,保持全網所有的交換機VLAN資訊是一緻的。

GVRP把交換機分為3種注冊模式:

① Normal模式:VLAN增删改,廣播保持一緻。

② Fixed模式:隻傳播手動配置的VLAN資訊。

③ Forbidden模式:隻傳播VLAN1不傳其他VLAN。

·交換機預設:透明模式,VLAN1,所有端口。

1.2 基于接口劃分VLAN:靜态VLAN。

<Huawei>sys									//進入交換機系統視圖
Enter system view, return user view with Ctrl+Z.		
[Huawei]sysname S1							//交換機命名為S1
[S1]
[S1]vlan batch 2								//批量方式建立VLAN2
Info: This operation may take a few seconds. Please wait for a moment...done.
[S1]interface g0/0/1							//進入交換機接口視圖
[S1-GigabitEthernet0/0/1]port link-type access		//配置接口類型
[S1-GigabitEthernet0/0/1]port default vlan 2		//将接口加入VLAN2
[S1-GigabitEthernet0/0/1]
Dec 30 2020 10:41:48-08:00 S1 %%01IFNET/4/IF_STATE(l)[52]:Interface Vlanif1 has 
turned into DOWN state.
[S1-GigabitEthernet0/0/1]quit
[S1]interface g0/0/2
[S1-GigabitEthernet0/0/2]port link-type trunk
[S1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2
[S1-GigabitEthernet0/0/2]quit
[S1]
           
組網技術(二)1.交換機VLAN實驗2.交換機STP實驗3.動态路由RIP實驗

1.3 基于MAC劃分VLAN:動态VLAN。

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname S2
<S2>sys
Enter system view, return user view with Ctrl+Z.
[S2]vlan batch 2
Info: This operation may take a few seconds. Please wait for a moment...done.
[S2]interface g0/0/1									//在接口視圖配置上聯結口
[S2-GigabitEthernet0/0/1]port link-type hybrid				//配置上聯結口類型
[S2-GigabitEthernet0/0/1]port hybrid untagged vlan 2			//通過VLAN 2 
[S2-GigabitEthernet0/0/1]quit
[S2]interface g0/0/2									//進入交換機接口視圖
[S2-GigabitEthernet0/0/2]port link-type hybrid				//配置接口類型
[S2-GigabitEthernet0/0/2]port hybrid untagged vlan 2			//将接口接入vlan2
[S2-GigabitEthernet0/0/2]quit
[S2]vlan 2
[S2-vlan2]mac-vlan mac-address 22-22-22				//PC的MAC位址與VLALN2關聯
[S2-vlan2]quit
[S2]interface g0/0/2
[S2-GigabitEthernet0/0/2]mac-vlan enable				//基于MAC位址啟用接口
Info: This operation may take a few seconds. Please wait for a moment...done.
[S2-GigabitEthernet0/0/2]quit
[S2]
           

1.4 基于GVRP的VLAN配置實驗:可在LSW1建立VLAN2,LSW2可以學到,ping通。

組網技術(二)1.交換機VLAN實驗2.交換機STP實驗3.動态路由RIP實驗
第一步:交換機LSW1基本配置:LSW2參考配置。
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname SwitchA
[SwitchA]gvrp
[SwitchA]vlan 2
[SwitchA-vlan2]int vlan 2
[SwitchA-Vlanif2]ip add 192.168.1.254 24
           
第二步:交換機LSW1端口配置:LSW2參考下。
[SwitchA]
[SwitchA]int g0/0/1
[SwitchA-GigabitEthernet0/0/1]port link-type access
[SwitchA-GigabitEthernet0/0/1]port default vlan 2
[SwitchA-GigabitEthernet0/0/1]
[SwitchA-GigabitEthernet0/0/1]quit
[SwitchA]
[SwitchA]int g0/0/2
[SwitchA-GigabitEthernet0/0/2]port link-type trunk
[SwitchA-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[SwitchA-GigabitEthernet0/0/2]
           
第三步:交換機LSW1配置GVRP:LSW2參考如下。
[SwitchA]int g0/0/2
[SwitchA-GigabitEthernet0/0/2]gvrp
[SwitchA-GigabitEthernet0/0/2]
           
第四步:配置PC1的IP,ping驗證:PC2參考。
組網技術(二)1.交換機VLAN實驗2.交換機STP實驗3.動态路由RIP實驗
組網技術(二)1.交換機VLAN實驗2.交換機STP實驗3.動态路由RIP實驗

2.交換機STP實驗

2.1 交換機生成樹協定STP配置:優先級。

組網技術(二)1.交換機VLAN實驗2.交換機STP實驗3.動态路由RIP實驗

Cloud配置如下:

組網技術(二)1.交換機VLAN實驗2.交換機STP實驗3.動态路由RIP實驗

(1)配置STP基本功能

配置環網中的裝置生成樹協定工作在STP模式。

#配置SwitchA的STP工作模式,SwitchB、SwitchC、SwitchD的配置相同。
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]
[Huawei]sysname SwitchA
[SwitchA]stp mode stp
Info: This operation may take a few seconds. Please wait for a moment...done.
配置根橋和備份根橋裝置
#配置SwitchA為根橋
[SwitchA]stp root primary
#配置SwitchB為備份根橋
[SwitchB]stp root secondary
           

2.2 交換機生成樹協定STP配置:路徑值

#配置SwitchA的端口路徑開銷計算方法為華為計算方法,SwitchB、SwitchD配置方法相同。
[SwitchA]stp pathcost-standard legacy
           
#配置SwitchC端口GigabitEthernet0/0/1端口路徑開銷值為2000
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SwitchC
[SwitchC]stp pathcost-standard legacy
[SwitchC]int g0/0/1
[SwitchC-GigabitEthernet0/0/1]stp cost 2000
[SwitchC-GigabitEthernet0/0/1]quit
[SwitchC]
           
#配置SwitchD端口GigabitEthernet0/0/2為邊緣端口并啟用段口的BPDU封包過濾功能
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]
[Huawei]sysname SwitchD
[SwitchD]int g0/0/2
[SwitchD-GigabitEthernet0/0/2]stp edged-port enable
[SwitchD-GigabitEthernet0/0/2]stp bpdu-filter enable
[SwitchD-GigabitEthernet0/0/2]quit
[SwitchD]
           
#配置SwitchC端口GigabitEthernet0/0/2為邊緣端口并啟用段口的BPDU封包過濾功能
[SwitchC]int g0/0/2
[SwitchC-GigabitEthernet0/0/2]stp edged-port enable
[SwitchC-GigabitEthernet0/0/2]stp bpdu-filter enable
[SwitchC-GigabitEthernet0/0/2]
[SwitchC-GigabitEthernet0/0/2]quit
[SwitchC]
           

裝置全局啟用STP,所有裝置配置相同。

3.動态路由RIP實驗

3.1動态路由RIP:距離矢量,拓撲如下圖。

組網技術(二)1.交換機VLAN實驗2.交換機STP實驗3.動态路由RIP實驗
第一步:配置各接口IP:R1、R2、R3參考如下:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]un in en
Info: Information center is disabled.
[R1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip add 192.168.1.1 24
[R1-GigabitEthernet0/0/2]
           
第二步:配置RIP協定:R1、R2、R3參考如下。
<R1>sys
Enter system view, return user view with Ctrl+Z.
[R1]un in en
[R1]rip
[R1-rip-1]network 192.168.1.0
[R1-rip-1]network 10.0.0.0
           
第三步:驗證配置結果:dis ip routing、ping
組網技術(二)1.交換機VLAN實驗2.交換機STP實驗3.動态路由RIP實驗
組網技術(二)1.交換機VLAN實驗2.交換機STP實驗3.動态路由RIP實驗

繼續閱讀