三层交换


1.1 组网需求

随着网络的迅速发展,对网络设备处理数据的能力也要求越来越高。三层交换机通过硬件来交换和路由数据,吞吐量能达到和接近线速转发。单臂路由确实可以实现不同子网间通信,但是会造成性能瓶颈,三层交换技术的出现为vlan间的通信带来了新的冲击

1.2组网拓扑

三层交换


1.3实验目标

①掌握三层交换的配置命令

②掌握MLSCEF 的工作原理

③分析PC间的通信过程

1.4实验步骤

1.4.1基本信息配置

Router#enable

Router#configure terminal

Enter configuration commands, one perline.  End with CNTL/Z.

Router(config)#no ip domain-lookup

Router(config)#line console 0

Router(config-line)# logging synchronous

Router(config-line)# exec-timeout 0 0

Router(config-line)# no login

Router(config-line)#

Router(config-line)#line vty 0 4

Router(config-line)# no login

Router(config-line)#

Router(config-line)#exit


1.4.2二层链路及vlan配置和调试

sw1#vlan data

sw1(vlan)#vlan 11

VLAN 11 added:

  Name: VLAN0011

sw1(vlan)#vlan 21

VLAN 21 added:

  Name: VLAN0021

sw1(vlan)#exit

APPLY completed.

Exiting....

sw1(config)#int f0/2

sw1(config-if)#swi m tr

sw1(config-if)#swi t all vlan all

sw1(config-if)#no shut

sw1(config-if)#int f0/3

sw1(config-if)#swi m tr

sw1(config-if)#swi tr

sw1(config-if)#swi tr all vlan all

sw1(config-if)#no shut

sw2#vlan data

sw2(vlan)#vlan 11

VLAN 11 added:

  Name: VLAN0011

sw2(vlan)#vlan 21

VLAN 21 added:

   Name:VLAN0021

sw2(vlan)#exit

APPLY completed.

Exiting....

sw2#conf t

Enter configuration commands, one perline.  End with CNTL/Z.

sw2(config)#int f0/2

sw2(config-if)#swi m acc

sw2(config-if)#swi acc vlan 11

sw2(config-if)#int f0/3

sw2(config-if)#swi m acc

sw2(config-if)#swi acc vlan 21

sw2(config-if)#no shut

sw2(config-if)#int f0/2

sw2(config-if)#no shut

sw2(config)#int f0/1

sw2(config-if)#swi m tr

sw2(config-if)#swi tr all vlan all

sw2(config)#no ip routing



sw3#vlan data

sw3(vlan)#vlan 11

VLAN 11 added:

  Name: VLAN0011

sw3(vlan)#vlan 21

VLAN 21 added:

  Name: VLAN0021

sw3(vlan)#exit

APPLY completed.

Exiting....

sw3(config)#int f0/2

sw3(config-if)#swi acc vlan 11

sw3(config-if)#no shut

sw3(config-if)#int f0/3

sw3(config-if)#swi m acc

sw3(config-if)#swi acc vlan 21

sw3(config-if)#no shut

sw3(config-if)#int f0/1

sw3(config-if)#swi m tr

sw3(config-if)#swi tr all vlan all

sw3(config-if)#no shut

sw3(config)#no ip routing               //关闭交换机的路由功能

三层交换

1.4.3 三层svi接口配置和调试

sw1(config)#ip routing

sw1(config)#int vlan 11

sw1(config-if)#ip add 192.168.11.1255.255.255.0

sw1(config-if)#int vlan 21

sw1(config-if)#ip add 192.168.21.1255.255.255.0

sw1(config-if)#no shut

sw1(config-if)#int vlan 11

sw1(config-if)#no shut

sw1(config-if)#exit

sw1#show ip route

Codes: C - connected, S - static, R - RIP,M - mobile, B - BGP

     D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

     N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

     E1 - OSPF external type 1, E2 - OSPF external type 2

      i - IS-IS, su - IS-IS summary, L1 - IS-ISlevel-1, L2 - IS-IS level-2

     ia - IS-IS inter area, * - candidate default, U - per-user static route

     o - ODR, P - periodic downloaded static route


Gateway of last resort is not set


C   192.168.11.0/24 is directly connected, Vlan11

C   192.168.21.0/24 is directly connected, Vlan21



1.4.4全网连通性测试

三层交换

1.4.5 单臂路由和三层交换的区别以它们间的优缺点

三层交换机通过硬件来交换和路由数据,吞吐量能达到和接近线速转发。单臂路由确实可以实现不同子网间通信,但是会造成性能瓶颈