VLAN间路由之SVI
SVI【Switch Virtual Interface】交换机虚拟接口
网络拓扑图如下:通过交换机SVI虚拟接口,来打通不同VLAN间的网络互通
在sw2 上配置命令:
<Huawei>system-view [Huawei]sysname sw2 [sw2]vlan batch 10 20 [sw2]undo info-center enable [sw2]interface Ethernet 0/0/2 [sw2-Ethernet0/0/2]port link-type access [sw2-Ethernet0/0/2]port default vlan 10 [sw2-Ethernet0/0/2]quit [sw2]interface Ethernet 0/0/3 [sw2-Ethernet0/0/3]port link-type access [sw2-Ethernet0/0/3]port default vlan 10 [sw2-Ethernet0/0/3]quit [sw2]interface Ethernet 0/0/4 [sw2-Ethernet0/0/4]port link-type access [sw2-Ethernet0/0/4]port default vlan 20 [sw2-Ethernet0/0/4]quit [sw2]interface Ethernet 0/0/1 [sw2-Ethernet0/0/1]port link-type trunk [sw2-Ethernet0/0/1]port trunk allow-pass vlan all [sw2-Ethernet0/0/1]quit
在sw3 上配置命令:
<Huawei>system-view [Huawei]undo info-center enable [Huawei]vlan batch 10 20 [Huawei]interface Ethernet 0/0/2 [Huawei-Ethernet0/0/2]port link-type access [Huawei-Ethernet0/0/2]port default vlan 10 [Huawei-Ethernet0/0/2]quit [Huawei]interface Ethernet 0/0/3 [Huawei-Ethernet0/0/3]port link-type access [Huawei-Ethernet0/0/3]port default vlan 20 [Huawei-Ethernet0/0/3]quit [Huawei]interface Ethernet 0/0/4 [Huawei-Ethernet0/0/4]port link-type access [Huawei-Ethernet0/0/4]port default vlan 20 [Huawei-Ethernet0/0/4]quit [Huawei]interface Ethernet 0/0/1 [Huawei-Ethernet0/0/1]port link-type trunk [Huawei-Ethernet0/0/1]port trunk allow-pass vlan all [Huawei-Ethernet0/0/1]quit
核心交换机sw1 上配置命令:
1 <Huawei>system-view 2 [Huawei]sysname sw1 3 [sw1]undo info-center enable 4 [sw1]vlan batch 10 20 5 [sw1]interface GigabitEthernet 0/0/1 6 [sw1-GigabitEthernet0/0/1]port link-type trunk 7 [sw1-GigabitEthernet0/0/1]port trunk allow-pass vlan all 8 [sw1-GigabitEthernet0/0/1]quit 9 [sw1]interface GigabitEthernet 0/0/2 10 [sw1-GigabitEthernet0/0/2]port link-type trunk 11 [sw1-GigabitEthernet0/0/2]port trunk allow-pass vlan all 12 [sw1-GigabitEthernet0/0/2]quit 13 14 [sw1]interface vlanif 10 #进入虚拟vlan 10接口 15 [sw1-Vlanif10]ip address 1.1.1.254 24 #设置vlan 10的网关地址 16 [sw1-Vlanif10]quit 17 [sw1]interface vlanif 20 #进入虚拟vlan 20接口 18 [sw1-Vlanif20]ip address 2.2.2.254 24 #设置vlan 20的网关地址 19 [sw1-Vlanif20]quit
查看核心上的路由表信息【学习了2条路由信息,下一跳接口分别指向vlanif 10和vlanif 20】:display ip routing-table