新建好拓扑,如下图:
按上面标注的配置好客户端,网关都是192.168.1.100
接下来配置交换机LSW1,代码如下:
<Huawei>sys
[Huawei]sysname SwitchA
[SwitchA]int g0/0/1
[SwitchA-GigabitEthernet0/0/1]port link-type acc
[SwitchA]int g0/0/2
[SwitchA-GigabitEthernet0/0/2]port link-type acc
[SwitchA]int g0/0/3
[SwitchA-GigabitEthernet0/0/3]port link-type acc
[SwitchA]vlan 10
[SwitchA-vlan10]port g0/0/1
[SwitchA]vlan 20
[SwitchA-vlan20]port g0/0/2
[SwitchA]vlan 30
[SwitchA-vlan30]port g0/0/3
[SwitchA]int g0/0/24
[SwitchA-GigabitEthernet0/0/24]port link-type trunk
[SwitchA-GigabitEthernet0/0/24]port trunk allow-pass vlan all
[SwitchA]dis 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(U)
10 common UT:GE0/0/1(U)
TG:GE0/0/24(U)
20 common UT:GE0/0/2(U)
TG:GE0/0/24(U)
30 common UT:GE0/0/3(U)
TG:GE0/0/24(U)
VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001
10 enable default enable disable VLAN 0010
20 enable default enable disable VLAN 0020
30 enable default enable disable VLAN 0030
<SwitchA>sa
接下来配置交换机LSW2,代码如下:
<Huawei>sys
[Huawei]sysname SwitchB
[SwitchB]int g0/0/1
[SwitchB-GigabitEthernet0/0/1]port link-type acc
[SwitchB]int g0/0/2
[SwitchB-GigabitEthernet0/0/2]port link-type acc
[SwitchB]int g0/0/3
[SwitchB-GigabitEthernet0/0/3]port link-type acc
[SwitchB]vlan 10
[SwitchB-vlan10]port g0/0/1
[SwitchB]vlan 20
[SwitchB-vlan20]port g0/0/2
[SwitchB]vlan 30
[SwitchB-vlan30]port g0/0/3
[SwitchB]int g0/0/24
[SwitchB-GigabitEthernet0/0/24]port link-type trunk
[SwitchB-GigabitEthernet0/0/24]port trunk allow-pass vlan all
[SwitchB]dis 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(U)
10 common UT:GE0/0/1(U)
TG:GE0/0/24(U)
20 common UT:GE0/0/2(U)
TG:GE0/0/24(U)
30 common UT:GE0/0/3(U)
TG:GE0/0/24(U)
VID Status Property MAC-LRN Statistics Description
--------------------------------------------------------------------------------
1 enable default enable disable VLAN 0001
10 enable default enable disable VLAN 0010
20 enable default enable disable VLAN 0020
30 enable default enable disable VLAN 0030
<SwitchB>sa
到此配置已完成,我们来测试下,
在PC1里ping 192.168.1.3
在PC2里ping 192.168.1.4
在Server1里ping 192.168.1.254
经测试所有正常ping通,所以我们的目的实现了!
上一篇:华为交换机常用配置命令
讨论数量:0