三层交换机

三层交换机

1.什么是三层交换机

​ 三层交换机是网络层和数据链路层的结合体,数据帧和数据包都能进行转发了,其目的就是为了不同vlan之间的通信.

​ 交换机 数据帧转发,mac地址,mac地址表

​ 路由器 数据包 arp地址表,ip和mac地址之间的映射关系,路由表,静态路由.,ip地址(最佳路径).

2.三层交换机如何实现转发:

​ 由FIB转发信息库邻接关系表组成的MLS头目

​ FIB转发信息库:可以理解成路由表,下一跳的地址,路由表当中包含目的ip地址,下一跳地址的路由信息

​ 邻接关系表:可以理解为就是mac地址表 邻接主机和交换机的mac地址对应的二层信息.

​ MIS条目 转发数据

image-20240513091958073

三层交换机要设置ip地址,必须要先配置vlan

根据vlanip再来配置ip地址

基于vlanid创建的虚拟接口

undo t m Info: Current terminal monitor is off. sys Enter system view, return user view with Ctrl+Z. [Huawei]vlan batch 10 20 Info: This operation may take a few seconds. Please wait for a moment...done. [Huawei]int e0/0/1 [Huawei-Ethernet0/0/1]port link-type access [Huawei-Ethernet0/0/1]port default vlan 10 [Huawei-Ethernet0/0/1]int e 0/0/2 [Huawei-Ethernet0/0/2]port link-type access [Huawei-Ethernet0/0/2]port default vlan 20 [Huawei-Ethernet0/0/2]q [Huawei]int e 0/0/3 [Huawei-Ethernet0/0/3]port link-type trunk [Huawei-Ethernet0/0/3]port trunk allow-pass vlan all

image-20240513093058685

image-20240513101135524

image-20240513101245314

image-20240513101304561

3.VRRP协议原理与配置

​ VRRP:高可用,路由器的高可用,终端设备可以通过一组路由器实现数据转发,组当中的其中一台设备出现故障,不影响数据转发.

​ 主备区分靠优先级

1.如何实现网关的高可用?

image-20240513111244445

image-20240513111312029

image-20240513111633912

image-20240513111736099

224.0.0.18 内部的组表地址 在两个网关服务器中发送组播,谁收到不到,就会认为是哪个服务器失效了.失效的不再转发数据,另外一个继续工作

冗余:两台网关互为备份,但是在工作中,只有一台工作

主备

​ 主工作,备的工作监听主的情况,主挂了,备来提供服务.

​ 224.0.0.18通过这个地址监听主的工作情况

​ 主备是根据优先级来进行确定的,优先级是我们人为配置的

​ 冗余模式:主的设备配置要稍高一些,比如cpu内存,硬盘

​ 备的设备相对来说要求低一些.

image-20240513112341444

image-20240513112427520

image-20240513112635834

image-20240513113303164

image-20240513113424013

image-20240513113503333

image-20240513113518360

image-20240513113949876

Master_Down_Interval 这个是响应时间,多长时间没有收到这个消息,备成为主服务器.时间不能太长,也不能太短,否则会丢失数据,一般设置六秒,主备之间抢占的时间一般是6秒.也是我们人为设置的

image-20240513114042254

image-20240513114314889

image-20240513114501094

image-20240513114506818

vrrp:确定主备,可以实现故障切换,以及数据分流即负载均衡

实验

image-20240513150212470

LSW1

Please press enter to start cmd line!
<Huawei>undo t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]v b 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int e0/0/3
[Huawei-Ethernet0/0/3]p l a
[Huawei-Ethernet0/0/3]p d v 10
[Huawei-Ethernet0/0/3]int e0/0/4
[Huawei-Ethernet0/0/4]p l a
[Huawei-Ethernet0/0/4]p d v 20
[Huawei-Ethernet0/0/4]int e0/0/1
[Huawei-Ethernet0/0/1]p l t
[Huawei-Ethernet0/0/1]p t a v a
[Huawei-Ethernet0/0/1]int e 0/0/2
[Huawei-Ethernet0/0/2]p l t
[Huawei-Ethernet0/0/2]p t a v a
[Huawei-Ethernet0/0/2] User interface con0 is available
Please Press ENTER.

AR2

The device is running!
<Huawei>undo t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 11.0.0.1 30
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 12.0.0.1 30
[Huawei-GigabitEthernet0/0/1]q
[Huawei]int LoopBack 1
[Huawei-LoopBack1]ip address 1.1.1.1 32
[Huawei-LoopBack1]

  Please check whether system data has been changed, and save data in time

  Configuration console time out, please press any key to log on

LSW2

The device is running!
<Huawei>undo t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]v b 10 20 100	//设置vlan batch 10 20 100
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int Vlanif 10		//虚拟逻接口10
[Huawei-vlanif10]ip address 192.168.10.252 24 //添加vlanif10的ip地址
[Huawei-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1//创建虚拟路由网关
[Huawei-Vlanif10]vrrp vrid 1 priority 120//接口优先级
[Huawei-Vlanif10]vrrp vrid 1 preempt-mode timer delay 6//抢占主位时间延迟6秒
[Huawei-Vlanif10]vrrp vrid 1 track interface g0/0/2 reduced 30 //监听上层接口,如何上层接口挂了,优先级120-30
[Huawei-Vlanif10]vrrp vrid 1 track interface g0/0/1//监听下层,如果挂了,直接切换备用
[Huawei-Vlanif10]int vlanif 20//虚拟逻辑接口20
[Huawei-Vlanif20]ip address 192.168.20.252 24	//添加vlan20的ip地址
[Huawei-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1//创建虚拟路由网关
[Huawei-Vlanif20]q
[Huawei]int Vlanif 100 //虚拟逻辑接口100
[Huawei-Vlanif100]ip address 11.0.0.2 30//接口ip
[Huawei-Vlanif100]q
[Huawei]int g 0/0/1
[Huawei-GigabitEthernet0/0/1]p l t	//vlan T口
[Huawei-GigabitEthernet0/0/1]p t a v a	//设置所有
[Huawei-GigabitEthernet0/0/1]int g 0/0/2
[Huawei-GigabitEthernet0/0/2]p l a	//vlan A口
[Huawei-GigabitEthernet0/0/2]p d v 100 //单独设置vlan 100
[Huawei-GigabitEthernet0/0/2]q

LSW3

The device is running!
<Huawei>
<Huawei> User interface con0 is available
Please Press ENTER.
<Huawei>undo t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]v b 10 20 100	//设置vlan batch 数量类型
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int vlanif 10	//进入vlan10
[Huawei-Vlanif10]ip address 192.168.10.254 24	//添加vlan10虚拟ip地址
[Huawei-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1	//设置vlan10中虚拟接路由器标识符为1的虚拟路由器网关
[Huawei-Vlanif10]q
[Huawei]int vlanif 20
[Huawei-Vlanif20]ip address 192.168.20.254 24
[Huawei-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1
[Huawei-Vlanif20]vrrp vrid 2 priority 110
[Huawei-Vlanif20]vrrp vrid 2 preempt-mode timer delay 6
[Huawei-Vlanif20]vrrp vrid 2 track interface g0/0/2 reduced 30
[Huawei-Vlanif20]vrrp vrid 2 track interface g0/0/1
[Huawei-Vlanif20]q
[Huawei]int vlan 100
[Huawei-Vlanif100]ip address 12.0.0.2 30
[Huawei-Vlanif100]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]p l t
[Huawei-GigabitEthernet0/0/1]p t a v a
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]p l a
[Huawei-GigabitEthernet0/0/2]p d v 100

12.0.0.2 30
[Huawei-Vlanif100]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]p l t
[Huawei-GigabitEthernet0/0/1]p t a v a
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]p l a
[Huawei-GigabitEthernet0/0/2]p d v 100


![image-20240513151341628](https://img-blog.csdnimg.cn/img_convert/05811d70f0e1d04848e2afa896ce417a.png)
  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值