华为 ----三层交换小实验
程序员文章站
2022-06-13 12:33:48
...
华为 ----三层交换,实现全网互通
一:实验目的:
(1)掌握交换机Tag VLAN的配置
(2)掌握三层交换机基本配置方法
(3)掌握三层交换机VLAN路由的配置方法
(4)通过三层交换机实现VLAN间相互通信
二:实验拓扑
三:实验配置过程
LSW1
<Huawei> system-view
[Huawei]sysname SW1
[SW1]vlan batch 10 20 1000 ' 配置vlan '
[SW1]int g0/0/1 " 配置端口模式"
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
[SW1-GigabitEthernet0/0/1]undo shutdown
[SW1-GigabitEthernet0/0/1]int g0/0/2
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]port default vlan 1000 ‘将端口加入特定vlan’
[SW1-GigabitEthernet0/0/2]un sh
[SW1]int Vlanif 10
[SW1-Vlanif10]ip add 192.168.10.1 24 ‘配置每隔vlan对应的接口地址’
[SW1-Vlanif10]int vlanif 20
[SW1-Vlanif20]ip add 192.168.20.1 24
[SW1-Vlanif20]int vlanif 1000
[SW1-Vlanif1000]ip add 11.0.0.1 30
[SW1]ip route-static 0.0.0.0 0.0.0.0 11.0.0.2 ‘设置默认路由’
LSW2
<Huawei>system-view
[Huawei]sysname sw2
[sw2]vlan batch 10 20 ‘配置vlan’
[sw2]int e0/0/2 ‘配置端口模式’
[sw2-Ethernet0/0/2]port link-type access
[sw2-Ethernet0/0/2]port default vlan 10
[sw2-Ethernet0/0/2]un sh
[sw2-Ethernet0/0/2]int e0/0/3
[sw2-Ethernet0/0/3]port link-type access
[sw2-Ethernet0/0/3]port default vlan 20 ‘将端口哦加入特定vlan’
[sw2-Ethernet0/0/3]un sh
[sw2-Ethernet0/0/3]int e0/0/1
[sw2-Ethernet0/0/1]port link-type trunk
[sw2-Ethernet0/0/1]port trunk allow-pass vlan all ‘配置交换机之间的互联链路’
[sw2-Ethernet0/0/1]un sh
[sw2-Ethernet0/0/1]int g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type trunk
[sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[sw2-GigabitEthernet0/0/1]un sh
LSW3
<Huawei>system-view
[Huawei]sysname sw3
[sw3]vlan batch 10 20
[sw3]int e0/0/2
[sw3-Ethernet0/0/2]port link-type access
[sw3-Ethernet0/0/2]port default vlan 10
[sw3-Ethernet0/0/2]un sh
[sw3-Ethernet0/0/2]int e0/0/3
[sw3-Ethernet0/0/3]port link-type access
[sw3-Ethernet0/0/3]port default vlan 20
[sw3-Ethernet0/0/3]un sh
[sw3-Ethernet0/0/3]int e0/0/1
[sw3-Ethernet0/0/1]port link-type trunk
[sw3-Ethernet0/0/1]port trunk allow-pass vlan all
[sw3-Ethernet0/0/1]un sh
R1
<Huawei>system view
[Huawei]sysname R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 11.0.0.2 30 ‘配置接口地址’
[R1-GigabitEthernet0/0/0]un sh
[R1]int LoopBack 0 ‘配置回环接口地址’
[R1-LoopBack0]ip add 1.1.1.1 30
[R1] ip route-static 0.0.0.0 0.0.0.0 11.0.0.1 ‘配置默认路由’
每个主机IP地址都要配置,注意点击应用
互相ping,验证能否ping通