1. 同台交換機不同VLAN間的網絡互通,邏輯拓撲圖如下:
需求:實現VLAN 100、VLAN 200、VLAN300之間的PC網絡互通
在LSW 11交換機進行如下命令行配置:
<Huawei>system-view #進入系統視圖模式 [Huawei]sysname test department #將交換機命名為test department [test department]vlan batch 100 200 300 #批量創建vlan 100 200 300 [test department]vlan 100 #進入vlan 100中 [test department-vlan100]description test #為vlan 100添加描述為test [test department-vlan100]quit #退出 [test department]vlan 200 #進入vlan 200中 [test department-vlan200]description science #為vlan 200添加描述為science [test department-vlan200]quit #退出 [test department]vlan 300 #進入vlan 300中 [test department-vlan300]description technology #為vlan 300添加描述為technology [test department-vlan300]quit #退出 #配置g0/0/1接口 [test department]interface GigabitEthernet0/0/1 #進入g0/0/1接口下 [test department-GigabitEthernet0/0/1]port link-type access #將g0/0/1接口鏈路類型設置為access [test department-GigabitEthernet0/0/1]port default vlan 100 #將g0/0/1接口划分至vlan100中 [test department-GigabitEthernet0/0/1]quit #退出 #配置g0/0/2接口 [test department]interface g0/0/2 #進入g0/0/2接口;GigabitEthernet0/0/2 可簡寫為 g0/0/2 [test department-GigabitEthernet0/0/2]port link-type access #將g0/0/2接口鏈路類型設置為access [test department-GigabitEthernet0/0/2]port default vlan 200 #將g0/0/1接口划分至vlan200中 [test department-GigabitEthernet0/0/2]quit #退出 #配置g0/0/3接口 [test department]interface g0/0/3 #進入g0/0/3接口 [test department-GigabitEthernet0/0/3]port link-type access # 將g0/0/3接口鏈路類型設置為access [test department-GigabitEthernet0/0/3]port default vlan 300 #將g0/0/3接口划分至vlan300中 [test department-GigabitEthernet0/0/3]quit #退出 [test department]display vlan #查看vlan信息如下: The total number of vlans is : 4 -------------------------------------------------------------------------------- U: Up; D: Down; TG: Tagged; UT: Untagged; MP: Vlan-mapping; ST: Vlan-stacking; #: ProtocolTransparent-vlan; *: Management-vlan; -------------------------------------------------------------------------------- VID Type Ports -------------------------------------------------------------------------------- 1 common UT:GE0/0/4(D) GE0/0/5(D) GE0/0/6(D) GE0/0/7(D) GE0/0/8(D) GE0/0/9(D) GE0/0/10(D) GE0/0/11(D) GE0/0/12(D) GE0/0/13(D) GE0/0/14(D) GE0/0/15(D) GE0/0/16(D) GE0/0/17(D) GE0/0/18(D) GE0/0/19(D) GE0/0/20(D) GE0/0/21(D) GE0/0/22(D) GE0/0/23(D) GE0/0/24(D) 100 common UT:GE0/0/1(U) 200 common UT:GE0/0/2(U) 300 common UT:GE0/0/3(U) VID Status Property MAC-LRN Statistics Description -------------------------------------------------------------------------------- 1 enable default enable disable VLAN 0001 100 enable default enable disable test 200 enable default enable disable science 300 enable default enable disable technology
打開PC 27命令窗口,運行 ping 10.0.200.1 是無法通訊的,雖然兩台PC是連接在同台交換機下,但不屬於同一VLAN中,所以是無法正常通信
繼續在LSW 11交換機進行配置:
<Huawei>system-view #進入系統視圖模式 [test department]interface Vlanif 100 #進入vlan 100 [test department-Vlanif100]ip address 10.0.100.254 255.255.255.0 #配置vlan 100的IP地址為10.0.100.254/24 [test department-Vlanif100]quit #退出 [test department]interface Vlanif 200 #進入vlan 200 [test department-Vlanif200]ip address 10.0.200.254 24 #配置vlan 200的IP地址為10.0.200.254/24,華為設備mask掩碼可簡寫為24 [test department-Vlanif200]quit #退出 [test department]interface Vlanif 300 #進入vlan 300 [test department-Vlanif300]ip address 10.0.30.254 24 #配置vlan 300的IP地址為10.0.30.254/24,這里只能寫成30網段了 [test department-Vlanif300]quit #退出
#查看vlan IP地址信息 [test department]display ip interface brief *down: administratively down ^down: standby (l): loopback (s): spoofing The number of interface that is UP in Physical is 4 The number of interface that is DOWN in Physical is 2 The number of interface that is UP in Protocol is 4 The number of interface that is DOWN in Protocol is 2 Interface IP Address/Mask Physical Protocol MEth0/0/1 unassigned down down NULL0 unassigned up up(s) Vlanif1 unassigned down down Vlanif100 10.0.100.254/24 up up Vlanif200 10.0.200.254/24 up up Vlanif300 10.0.30.254/24 up up #查看接口信息 [test department]display interface brief PHY: Physical *down: administratively down (l): loopback (s): spoofing (b): BFD down (e): ETHOAM down (dl): DLDP down (d): Dampening Suppressed InUti/OutUti: input utility/output utility Interface PHY Protocol InUti OutUti inErrors outErrors GigabitEthernet0/0/1 up up 0% 0% 0 0 GigabitEthernet0/0/2 up up 0% 0% 0 0 GigabitEthernet0/0/3 up up 0% 0% 0 0 GigabitEthernet0/0/4 down down 0% 0% 0 0 GigabitEthernet0/0/5 down down 0% 0% 0 0 GigabitEthernet0/0/6 down down 0% 0% 0 0 GigabitEthernet0/0/7 down down 0% 0% 0 0 GigabitEthernet0/0/8 down down 0% 0% 0 0 GigabitEthernet0/0/9 down down 0% 0% 0 0 GigabitEthernet0/0/10 down down 0% 0% 0 0 GigabitEthernet0/0/11 down down 0% 0% 0 0 GigabitEthernet0/0/12 down down 0% 0% 0 0 GigabitEthernet0/0/13 down down 0% 0% 0 0 GigabitEthernet0/0/14 down down 0% 0% 0 0 GigabitEthernet0/0/15 down down 0% 0% 0 0 GigabitEthernet0/0/16 down down 0% 0% 0 0 GigabitEthernet0/0/17 down down 0% 0% 0 0 GigabitEthernet0/0/18 down down 0% 0% 0 0 GigabitEthernet0/0/19 down down 0% 0% 0 0 GigabitEthernet0/0/20 down down 0% 0% 0 0 GigabitEthernet0/0/21 down down 0% 0% 0 0 GigabitEthernet0/0/22 down down 0% 0% 0 0 GigabitEthernet0/0/23 down down 0% 0% 0 0 GigabitEthernet0/0/24 down down 0% 0% 0 0 MEth0/0/1 down down 0% 0% 0 0 NULL0 up up(s) 0% 0% 0 0 Vlanif1 down down -- -- 0 0 Vlanif100 up up -- -- 0 0 Vlanif200 up up -- -- 0 0 Vlanif300 up up -- -- 0 0
現在將PC 27網關設置為10.0.100.254,PC 28網關設置為10.0.200.254,PC 29網關設為10.0.30.254后,用PC 27計算機ping PC 28與PC 29網絡互通正常