在校园网、城域教育网中,从骨干网、城域网骨干、汇聚层都有三层交换机的用武之地,尤其是核心骨干网一定要用三层交换机,否则整个网络成千上万台的计算机都在一个子网中,不仅毫无安全可言,也会因为无法分割广播域而无法隔离广播风暴。如果采用传统的路由器,虽然可以隔离广播,但是性能又得不到保障。而三层交换机的性能非常高,既有三层路由的功能,又具有二层交换的网络速度。二层交换是基于mac寻址,三层交换则是转发基于第三层地址的业务流;除了必要的路由决定过程外,大部分数据转发过程由二层交换处理,提高了数据包转发的效率。三层交换机通过使用硬件交换机构实现了ip的路由功能,其优化的路由软件使得路由过程效率提高,解决了传统路由器软件路由的速度问题。因此可以说,三层交换机具有“路由器的功能、交换机的性能”。
另外,连接子网少不了三层交换换。同一网络上的计算机如果超过一定数量(通常在200台左右,视通信协议而定),就很可能会因为网络上大量的广播而导致网络传输效率低下。为了避免在大型交换机上进行广播所引起的广播风暴,可将其进一步划分为多个虚拟网(vlan)。但是这样做将导致一个问题:vlan之间的通信必须通过路由器来实现。但是传统路由器也难以胜任vlan之间的通信任务,因为相对于局域网的网络流量来说,传统的普通路由器的路由能力太弱。 而且千兆级路由器的价格也是非常难以接受的。如果使用三层交换机上的千兆端口或百兆端口连接不同的子网或vlan,就在保持性能的前提下,经济地解决了子网划分之后子网之间必须依赖路由器进行通信的问题,因此三层交换机是连接子网的理想设备。
三层交换机详细配置实例
一:二层交换机的配置:
在三个二层交换机上分别划出两vlan,并将二层交换机上与三层交换或路由器上的接线设置为trunk接口
二:三层交换机的配置:
1:首先在三层交换上划出两个vlan,并进入vlan为其配置ip,此ip将作为与他相连pc的网关。
2:将与二层交换机相连的线同样设置为trunk接线,并将三层交换与路由器连接的线设置为路由接口(no switchsport)
3:将路由器和下面的交换机进行单臂路由的配置 实验最终结果:拓扑图下各个pc均能相互通信
交换机的配置命令:
sw 0:
switch》 switch》en switch#conf
configuring from terminal, memory, or network [terminal]? enter configuration commands, one per line. end with cntl/z. switch(config)#vlan 2 switch(config-vlan)#exit switch(config)#int f0/2
switch(config-if)#switchport access vlan 2 switch(config-if)#no shut switch(config-if)#int f0/3
switch(config-if)#switchport mode trunk
%lineproto-5-updown: line protocol on interface fastethernet0/3, changed state to down
%lineproto-5-updown: line protocol on interface fastethernet0/3, changed state to up
switch(config-if)#exit switch(config)#
sw 1:
switch》en switch#conf
configuring from terminal, memory, or network [terminal]? enter configuration commands, one per line. end with cntl/z. switch(config)#int f0/2
switch(config-if)#switchport access vlan 2 % access vlan does not exist. creating vlan 2 switch(config-if)#no shut switch(config-if)#exit switch(config)#int f0/3
switch(config-if)#switchport mode trunk
%lineproto-5-updown: line protocol on interface fastethernet0/3, changed state to down
%lineproto-5-updown: line protocol on interface fastethernet0/3, changed state to up
switch(config-if)#
sw 2:
switch》en
switch#conf
configuring from terminal, memory, or network [terminal]? enter configuration commands, one per line. end with cntl/z.
switch(config)#int f0/2
switch(config-if)#switchport access vlan 2 % access vlan does not exist. creating vlan 2 switch(config-if)#exit
switch(config)#int f0/3
switch(config-if)#switchport mode trunk switch(config-if)#
三层交换的配置命令:
switch》en switch#conf
configuring from terminal, memory, or network [terminal]? enter configuration commands, one per line. end with cntl/z. switch(config)#int f0/1
switch(config-if)#switchport mode trunk
%lineproto-5-updown: line protocol on interface fastethernet0/2, changed state to down
switch(config-if)#exit switch(config)#int f0/2
switch(config-if)#switchport mode trunk switch(config-if)#exit switch(config)#vlan 2 switch(config-vlan)#exit switch(config)#int vlan 1 switch(config-if)#no shut
%link-5-changed: interface vlan1, changed state to up
%lineproto-5-updown: line protocol on interface vlan1, changed state to up switch(config-if)#ip address 192.168.1.168 255.255.255.0 switch(config-if)#exit switch(config)#int vlan 2
%link-5-changed: interface vlan2, changed state to up
%lineproto-5-updown: line protocol on interface vlan2, changed state to upswitch(config-if)#ip add
switch(config-if)#ip address 192.168.2.168 255.255.255.0 switch(config-if)#
%link-5-changed: interface fastethernet0/3, changed state to up
%lineproto-5-updown: line protocol on interface fastethernet0/3, changed state to up
switch(config-if)#exit switch(config)#int f0/3
switch(config-if)#no switchport
%lineproto-5-updown: line protocol on interface fastethernet0/3, changed state to down
%lineproto-5-updown: line protocol on interface fastethernet0/3, changed state to upswitch(config-if)#
switch(config-if)#ip address 192.168.10.1 255.255.255.0 switch(config-if)#no shut switch(config-if)#exit switch(config)#ip routing switch(config-if)#exit
switch(config)#ip route 0.0.0.0 0.0.0.0 192.168.10.2 switch(config)# 路由器的配置:
router》en router#conf
configuring from terminal, memory, or network [terminal]? enter configuration commands, one per line. end with cntl/z. router(config)#int f0/0 router(config-if)#no shut
%link-5-changed: interface fastethernet0/0, changed state to up router(config-if)#exit router(config)#int f0/1 router(config-if)#no shut
%link-5-changed: interface fastethernet0/1, changed state to up
%lineproto-5-updown: line protocol on interface fastethernet0/1, changed state to up
router(config-if)#exit router(config)#int f0/0 router(config-if)#no shut router(config-if)#exit router(config)#int f0/0.1
router(config-subif)#encapsulation dot1q 1
router(config-subif)#ip address 192.168.3.168 255.255.255.0 router(config-subif)#exit router(config)#int f0/0.2
router(config-subif)#encapsulation dot1q 2 router(config-subif)#ip add
router(config-subif)#ip address 192.168.4.168 255.255.255.0 router(config-subif)#exit
router(config)#ip route 0.0.0.0 0.0.0.0 192.168.10.1 router(config)#exit
%sys-5-config_i: configured from console by console router#conf
configuring from terminal, memory, or network [terminal]? enter configuration commands, one per line. end with cntl/z.
router(config)#int f0/1
router(config-if)#ip add
router(config-if)#ip address 192.168.10.2 255.255.255.0
router(config-if)#
h3c配置三层交换机配置实例
举例讲解h3c配置三层交换机4个步骤详细用法,配置三层交换机通用的四个步骤就是:划分vlan,并描述;给vlan划网关;给vlan指定端口;配置路由协议;学会这几个步骤之后就能解决所有的配置三层交换机的问题。
《h3c》language-modechinese//切换到中文模式
《h3c》system-view//进入系统视图
[h3c]displaycurrent-configuration//显示当前配置三层交换机
//以下开始配置三层交换机
配置三层交换机第一步:划分vlan,并描述
vlan1
descriptionlocal-s3600//本交换机使用
#
vlan2
descriptionlink-to-shanxicentre//陕西省中心
#
vlan3
descriptionlink-to-shangjiecentre//商界分中心内部使用
#
vlan4
descriptionlink-to-shangdongsuo//商东所
#
vlan5
descriptionlink-to-shangnansuo//商南所
配置三层交换机第二步:给vlan划网关
#
interfacevlan-interface2
descriptionlinktoshanxicentre
ipaddress10.61.242.110255.255.255.252//省中心指定广域网关、子网掩码
#
interfacevlan-interface3
descriptionlinktoshangjiecentre
ipaddress10.161.134.65255.255.255.192//商界分中心局域网关、子网掩码
#
interfacevlan-interface4
descriptionlinktoshangdongsuo
ipaddress10.61.242.113255.255.255.252//商东所广域网关、子网掩码
#
interfacevlan-interface5
descriptionlinktoshangnansuo
ipaddress10.61.242.117255.255.255.252//商南所广域网关、子网掩码
配置三层交换机第三步:给vlan指定端口
#
interfaceethernet1/0/2//将交换机的端口2指定给省中心使用
descriptionlinktoshanxicentre
portaccessvlan2
#
interfaceethernet1/0/15-24//将交换机的端口15-24指定给分中心内部使用
descriptionlinktoshangjiecentre
portaccessvlan3
#
interfaceethernet1/0/3//将交换机的端口3指定给商东所使用
descriptionlinktoshangdongsuo
portaccessvlan4
#
interfaceethernet1/0/4//将交换机的端口4指定给商南所使用
descriptionlinktoshangnansuo
portaccessvlan5
配置三层交换机第四步:配置路由协议
//配静态路由(只用对远端设备配一条路由即可,本地自通)
iproute0.0.0.00.0.0.010.61.242.109//指定所有网段到商东所的路由
//配置三层交换机商东所的反向路由
iproute10.161.134.0255.255.255.010.61.242.114
iproute10.161.135.0255.255.255.010.61.242.114
//配置三层交换机商南所的反向路由
iproute10.161.135.0255.255.255.010.61.242.118
iproute10.161.136.0255.255.255.010.61.242.118
//省中心配置三层交换机:
iproute10.61.242.0255.255.255.010.61.242.110//商东所242.114和商南所242.118共属的242.0指向分中心网关
iproute10.161.134.0255.255.255.010.61.242.110//分中心内部网段指向分中心网关
//iproute10.161.134.0255.255.255.010.61.242.110
//iproute10.161.135.0255.255.255.010.61.242.110
//iproute10.161.136.0255.255.255.010.61.242.110
Micro LED技术待突破,台湾发展环境相对成熟有望成为产业练兵场
基于FPGA器件实现EPON测试仪的应用设计
一文详解电子电气架构的演进
PCBA加工不同的分板方式
R课堂 | 用户测评:罗姆BM2PDA(B)1Y-EVK-001+负载调整测试
三层交换机配置实例详解
全球招募新品体验官 | 30天玩转地平线RDK X3 Module
疲劳试验机选购要素须知
易华录光存储技术有效保护数据安全
一加5什么时候上市?最新消息:一加5再曝光 黑科技来袭,配置党最爱!
操作系统工作原理
暗池可能对加密交易市场来说是个福音
Molex薄膜电池
移动电视接收单芯片MT5192
通信筑基,引领智慧高速!迈威通信亮相第25届高速公路信息展
PIC32MZE:建立MPLAB X项目步骤解析
HJY-350-EX防爆湿度分析仪
基于RBF神经网络的照明定量计算数据实现提高照明精度的设计
SMT自动化生产线联机
想创业先看看马云的忠告 这4类人要重用