zoukankan      html  css  js  c++  java
  • HSRP热备份路由协议 、 STP生成树协议

    【HSRP热备份路由协议 、 STP生成树协议】
    1. 什么是 HSRP?工作原理是?
    HSRP:热备份路由协议
    HSRP 是 cisco 私有协议,确保了当网络边缘设备或接入链路出现故障时,用户通信能迅速并透明地恢复,
    以此为 IP 网络提供冗余行。通过使用同一个虚拟 IP 地址和虚拟 MAC 地址,LAN 网段上的两台或者多台路由器可以作为一台虚拟路由器对外提供服务。 HSRP 使组内的 cisco 路由器能互相监视对方的运行状态。
    ——HSRP热备份路由选择协议——
    HSRP组成员:活跃(优先传输数据)、备份(监听活跃路由器,活跃路由器不可用时接替)、虚拟、其他路由器(成员之间必须是同一网段,内网组建)
    UDP端口号是1985、使用公用地址 224.0.0.2,TTL=1
    HSRP状态
    初始、学习、监听(互相监听优先级)、发言、备份、活跃
    HSRP计时器:Hello间隔3s,保持时间10s

    ——HSRP配置——
    配置为HSRP成员
    Switch(config-if)# standby(备用) 1 ip 192.168.1.254
    配置HSRP优先级
    Switch(config)#interface f0/0
    Switch(config-if)#standby 1 ip 192.168.1.254
    Switch(config-if)#standby 1 priority(优先) 200
    %HSRP-6-STATECHANGE: FastEthernet9快速以太网)0/0 Grp(组) 1 state(状态) Speak(说) -> Standby
    %HSRP-6-STATECHANGE: FastEthernet0/0 Grp 1 state Standby -> Active(活跃)


    配置HSRP占先权
    Switch(config)#interface fastEthernet 0/0
    Switch(config-if)#standby 1 track f0/1
    Switch(config)#interface fastEthernet 0/0
    Switch(config-if)#standby 1 preempt(先取,先买) ( 备份优先)
    配置HSRP端口跟踪
    Switch(config-if)# standby 1 track(追踪) int f 0/1
    查看HSRP摘要信息
    Switch(config-if)# show standby brief(摘要)

    ——二层交换配置HSRP——
    SW1(config)# int f 0/24
    SW1(config-if)# ip address 192.168.1.253 255.255.255.0
    SW1(config-if)# standby 1 ip 192.168.1.254
    SW1(config-if)# standby 1 priority(优先) 200
    SW1(config-if)# standby 1 preempt(
    SW1(config-if)# standby 1 track int f 0/1
    SM1(config)#router rip
    SM1(config-router)#version 2
    SM1(config-router)#no auto-summary
    SM1(config-router)#network 192.168.1.0
    SM1(config-router)#network 192.168.2.0

    SW2(config)# int f 0/24
    SW2(config-if)# ip address 192.168.1.252 255.255.255.0
    SW2(config-if)# standby 1 ip 192.168.1.254
    SW2(config-if)# standby 1 priority 150
    SW2(config-if)# standby 1 preempt
    SW2(config-if)# standby 1 track int f 0/1
    SM2(config)#router rip
    SM2(config-router)#version 2
    SM2(config-router)#no auto-summary
    SM2(config-router)#network 192.168.1.0
    SM2(config-router)#network 192.168.3.0

    ——三层交换配置HSRP——
    SW-3L1(config)# int f 0/24
    SW-3L1(config-if)# ip address 192.168.1.253 255.255.255.0
    SW-3L1(config-if)# standby 1 ip 192.168.1.254
    SW-3L1(config-if)# standby 1 priority 200
    SW-3L1(config-if)# standby 1 preempt
    SW-3L1(config-if)# standby 1 track int f 0/1

    SW-3L2(config)# int f 0/24
    SW-3L2(config-if)# ip address 192.168.1.252 255.255.255.0
    SW-3L2(config-if)# standby 1 ip 192.168.1.254
    SW-3L2(config-if)# standby 1 priority 150
    SW-3L2(config-if)# standby 1 preempt
    SW-3L2(config-if)# standby 1 track int f 0/1

    SW-3L(config)# ip routing
    SW-3L(config)# int v 1
    SW-3L(config-if)# ip address 192.168.1.254 255.255.255.0
    SW-3L(config-if)# no shutdown
    SW-3L(config-if)# no switchport
    SW-3L(config)# int f 0/24
    SW-3L(config-if)# switchport trunk encapsulation dot1q
    SW-3L(config-if)# switchport mode trunk
    outer(config)#router rip
    Router(config-router)#version 2
    Router(config-router)#no auto-summary
    Router(config-router)#network 192.168.2.0
    Router(config-router)#network 192.168.3.0
    Router(config-router)#network 192.168.4.0


    ——STP生成树协议——
    STP:生成树协议
    作用:逻辑上断开环路,防止广播风暴的产生,当线路故障,阻塞接口被激活,恢复通信,起备份线路
    的作用。
    生成树算法:
    1.根网桥:每个广播域选择一个根网桥,BID(网桥id:网桥优先级32768+网桥的mac地址)最小的
    2.根端口:每个非根网桥分别选择一个根端口,路径成本低(传输时间短、网速)、接口ID(连接对方接口f0/1)小,绿色
    3.指定端口:每个网段(交换机之间的线)上选择指定端口,黄色
    4.阻塞端口:未选端口为阻塞端口,红色

    带宽与路径成本:
    10Mbps-----100
    16Mbps------62
    45Mbps------39
    100Mbps----19
    155Mbps----14
    622Mbps-----6
    1000Mbps---4

    BDDU桥协议数据单元
    根网桥ID-----8bit
    根路径成本---4bit
    发送网桥ID---8bit
    端口ID--------2bit

    STP的收敛
    交换机端口STP的5状态
    转发、学习、监听、阻塞、禁用

    ——STP配置——

    PVST+配置
    选择稳定的交换机作为根网桥
    启用生成树命令
    Switch(config)# spanning-tree vlan vlan-id
    指定根网桥
    Switch(config)# spanning-tree vlan vlan-id priority n4096 (优先级)
    指定VLAN主次根
    Switch(config)# spanning-tree vlan id(1/2/3...) root { primary (主根)| secondary(次根) }
    查看生成树配置
    Switch# show spanning-tree
    查看某个VLAN生成树详细信息
    Switch# show spanning-tree vlan vlan-id detail
    配置速端口(避免转发延迟)
    Switch(config-if)# spanning-tree portfast

  • 相关阅读:
    谈谈数据库连接池的原理
    认识wsgi
    mysql存储引擎介绍,索引
    Go语言并发组件--Goroutine
    【高级课程笔记】—— Echarts高级应用(二)
    【高级课程笔记】—— Echarts高级应用(一)
    【高级课程笔记】—— Echarts常用图表
    【高级课程笔记】—— Echarts入门&常用组件
    【重点突破】—— js防抖和节流(转)
    【重点突破】—— moment.js获取时间格式化
  • 原文地址:https://www.cnblogs.com/fuzhongfaya/p/8948162.html
Copyright © 2011-2022 走看看