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网络互通正常