目录
1、三层交换机概述
- 集成了三层数据包转发功能的交换机被称为三层交换机。
- 可以实现将终端隔离在不同的VLAN中,同时还可以为这些终端提供VLAN间路的功能。
- 三层交换机需要解决接口分配三层IP地址的配置,否则不具备称为终端网关设备的能力。
- 虚拟VLAN接口
简称SVI接口。
所在的网段作为直连路由填充在路由表中。
虚拟VLAN接口就十分适合充当该VLAN所连接设备的网关。
2、三层交换机VLAN间路由的配置
(1)题目要求
使用三层交换技术实现VLAN10和20互通。
(2)交换机SW1配置
- 修改名字
<Huawei>system
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW1
[SW1]
- 虚拟VLAN接口配置
[SW1]vlan batch 10 20
[SW1]interface vlanif 10
[SW1-Vlanif10]ip address 10.0.10.254 24
[SW1-Vlanif10]quit
[SW1]interface vlanif 20
[SW1-Vlanif20]ip address 10.0.20.254 24
[SW1-Vlanif20]quit
- 接口e0/0/10、e0/0/20分别划分到VLAN10、VLAN20中
[SW1]interface e0/0/10
[SW1-Ethernet0/0/10]port link-type access
[SW1-Ethernet0/0/10]port default vlan 10
[SW1-Ethernet0/0/10]quit
[SW1]interface e0/0/20
[SW1-Ethernet0/0/20]port link-type access
[SW1-Ethernet0/0/20]port default vlan 20
[SW1-Ethernet0/0/20]quit
例1:查看SW1上的VLAN
[SW1]display vlan
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged;
MP: Vlan-mapping; ST: Vlan-stacking;
#: ProtocolTransparent-vlan; *: Management-vlan;
--------------------------------------------------------------------------------
VID Type Ports
--------------------------------------------------------------------------------
1 common UT:Eth0/0/1(D) Eth0/0/2(D) Eth0/0/3(D) Eth0/0/4(D)
Eth0/0/5(D) Eth0/0/6(D) Eth0/0/7(D) Eth0/0/8(D)
Eth0/0/9(D) Eth0/0/11(D) Eth0/0/12(D) Eth0/0/13(D)
Eth0/0/14(D) Eth0/0/15(D) Eth0/0/16(D) Eth0/0/17(D)
Eth0/0/18(D) Eth0/0/19(D) Eth0/0/21(D) Eth0/0/22(D)
GE0/0/1(D) GE0/0/2(D)
10 common UT:Eth0/0/10(U)
20 common UT:Eth0/0/20(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
例2:查看SW1上的IP路由表
[SW1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.0.10.0/24 Direct 0 0 D 10.0.10.254 Vlanif10
10.0.10.254/32 Direct 0 0 D 127.0.0.1 Vlanif10
10.0.20.0/24 Direct 0 0 D 10.0.20.254 Vlanif20
10.0.20.254/32 Direct 0 0 D 127.0.0.1 Vlanif20
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0