华为设备配置篇——VRRP配置(假造路由冗余)

打印 上一主题 下一主题

主题 578|帖子 578|积分 1734

        VRRP可以监视上行端口的状态,当设备感知上行端口大概链路发生故障时,可以主动的低落VRRP的优先级,从而包管上行链路正常的backup设备能够通过选举切换成Master状态,指导报文转发。
          接入交换机为SW1,核心交换机为SW2和SW3,SW2与SW3做一个VRRP路由冗余。除此之外PC1能够正常的访问到Inetrnet,拓扑如下:

         1.PC1配置地址:192.168.10.1 网关:192.168.10.254

         2.配置接入交换机SW1
        ①改名字,取消提示消息并配置g0/0/3接口,思量到PC1要与vlan10的网络互通,因此将PC1的接口分别到VLAN 10 中。
  1. 更改名字为:[Huawei]sysname acsw
  2. 取消提示消息:[acsw]undo info-center enable
  3. 配置接口g0/0/3:
  4. [acsw-vlan10]vlan 10
  5. [acsw-vlan100]quit
  6. [acsw]interface g0/0/3
  7. [acsw-GigabitEthernet0/0/3]port link-type access
  8. [acsw-GigabitEthernet0/0/3]port default vlan 10
复制代码
        ②配置上行接口。配置接入交换机acsw的上行接口,接入交换机与核心交换机相连,故配置成trunk:
  1. [acsw]interface g0/0/1
  2. [acsw-GigabitEthernet0/0/1]port link-type trunk
  3. [acsw-GigabitEthernet0/0/1]port trunk allow-pass vlan all
  4. [acsw-GigabitEthernet0/0/1]quit
  5. [acsw]interface g0/0/2
  6. [acsw-GigabitEthernet0/0/2]port link-type trunk
  7. [acsw-GigabitEthernet0/0/2]port trunk allow-pass vlan all
  8. [acsw-GigabitEthernet0/0/2]
复制代码
         3.配置核心交换机SW2
        ①配置csw1。下行trunk,上行配置access,并配置一个vlanif100从而实现与上行接口网络互连。
  1. 配置下行接口g0/0/1
  2. [csw1]interface g0/0/1
  3. [csw1-GigabitEthernet0/0/1]port link-type trunk
  4. [csw1-GigabitEthernet0/0/1]port trunk allow-pass vlan all
  5. 配置下行接口g0/0/3
  6. [csw1-GigabitEthernet0/0/2]interface g0/0/3
  7. [csw1-GigabitEthernet0/0/3]port link-type trunk
  8. [csw1-GigabitEthernet0/0/3]port trunk allow-pass vlan all
  9. 创建vlan,配置接口g0/0/2并将上行端口放入vlan 100中:
  10. [csw1]vlan 10
  11. [csw1-vlan10]vlan 100
  12. [csw1-vlan100]quit
  13. [csw1]interface g0/0/2
  14. [csw1-GigabitEthernet0/0/2]port link-type access
  15. [csw1-GigabitEthernet0/0/2]port default vlan 100
  16. [csw1-GigabitEthernet0/0/2]quit
复制代码
        ②配置csw1的三层接口:
  1. [csw1]int vlan10
  2. [csw1-Vlanif10]ip address 192.168.10.252 24
  3. [csw1-Vlanif10]quit
  4. [csw1]int vlan 100
  5. [csw1-Vlanif100]ip address 192.168.100.1 30
复制代码
        4.配置核心交换机SW3:与SW2同理
  1. 配置接口g0/0/1
  2. [csw2]interface g0/0/1
  3. [csw2-GigabitEthernet0/0/1]port link-type trunk
  4. [csw2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
  5. 配置接口g0/0/3
  6. [csw2-GigabitEthernet0/0/1]interface g0/0/3
  7. [csw2-GigabitEthernet0/0/3]port link-type trunk
  8. [csw2-GigabitEthernet0/0/3]port trunk allow-pass vlan all
  9. [csw2-GigabitEthernet0/0/3]quit
  10. 配置接口g0/0/2
  11. [csw2]vlan 10
  12. [csw2-vlan10]vlan 200
  13. [csw2-vlan200]quit
  14. [csw2]interface g0/0/2
  15. [csw2-GigabitEthernet0/0/2]port link-type access
  16. [csw2-GigabitEthernet0/0/2]port default vlan 200
  17. [csw2-GigabitEthernet0/0/2]quit
  18. 配置三层接口:
  19. [csw2]interface vlanif10
  20. [csw2-Vlanif10]ip address 192.168.10.253 24
  21. [csw2-Vlanif10]quit
  22. [csw2]int vlanif100
  23. Error: The VLAN does not exist.
  24. [csw2]int vlanif200
  25. [csw2-Vlanif200]ip address 192.168.200.1 30
复制代码
        5.使用两台核心交换机ping测试是否连通,使用PC1ping两台核心交换机是否连通,证明没问题。
        6.VRRP配置
  1. 配置csw1为master,优先级为120,抢占延迟为20s
  2. [csw1]int vlanif 10
  3. [csw1-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
  4. [csw1-Vlanif10]vrrp vrid 10 priority 120
  5. [csw1-Vlanif10]vrrp vrid 10 preempt-mode timer delay 20
  6. [csw1-Vlanif10]quit
  7. 配置csw2的backup,默认优先级
  8. [csw2]interface vlanif 10
  9. [csw2-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
复制代码
        7.查看vrrp配置,可以看到csw1是master而csw2是backup
  1. [csw1]display vrrp
  2.   Vlanif10 | Virtual Router 10
  3.     State : Master
  4.     Virtual IP : 192.168.10.254
  5.     Master IP : 192.168.10.252
  6.     PriorityRun : 120
  7.     PriorityConfig : 120
  8.     MasterPriority : 120
  9.     Preempt : YES   Delay Time : 20 s
  10.     TimerRun : 1 s
  11.     TimerConfig : 1 s
  12.     Auth type : NONE
  13.     Virtual MAC : 0000-5e00-010a
  14.     Check TTL : YES
  15.     Config type : normal-vrrp
  16.     Create time : 2023-05-06 15:13:45 UTC-08:00
  17.     Last change time : 2023-05-06 15:13:48 UTC-08:00
复制代码
  1. [csw2]display vrrp
  2.   Vlanif10 | Virtual Router 10
  3.     State : Backup
  4.     Virtual IP : 192.168.10.254
  5.     Master IP : 192.168.10.252
  6.     PriorityRun : 100
  7.     PriorityConfig : 100
  8.     MasterPriority : 120
  9.     Preempt : YES   Delay Time : 0 s
  10.     TimerRun : 1 s
  11.     TimerConfig : 1 s
  12.     Auth type : NONE
  13.     Virtual MAC : 0000-5e00-010a
  14.     Check TTL : YES
  15.     Config type : normal-vrrp
  16.     Create time : 2023-05-06 15:16:30 UTC-08:00
  17.     Last change time : 2023-05-06 15:16:30 UTC-08:00
复制代码
        8.配置路由器R1
  1. <Huawei>system-view
  2. [Huawei]sysname R1
  3. [R1]interface g0/0/1
  4. [R1-GigabitEthernet0/0/1]ip address 192.168.100.2 30
  5. [R1-GigabitEthernet0/0/1]quit
  6. [R1]interface g0/0/0
  7. [R1-GigabitEthernet0/0/0]ip address 100.1.1.2 30
  8. [R1-GigabitEthernet0/0/0]interface g2/0/0
  9. [R1-GigabitEthernet2/0/0]ip address 192.168.200.2 30
  10. [R1-GigabitEthernet2/0/0]
复制代码
        9.配置路由器R2
  1. <Huawei>system-view
  2. [R2]sysname Internet
  3. [Internet]interface g0/0/0
  4. [Internet-GigabitEthernet0/0/0]ip address 100.1.1.1 30
复制代码
        10.配置静态路由
        在PC1ping 路由器100.1.1.1,无法ping通,抓包发现网络还没有送出去,所以要在核心交换机配置默认路由指向出口,把网络送出去(不知道怎么送出去的时候);在三层交换机上配置默认路由指向下一条,确保到目的地有路由;分别在csw1和csw2上配置:
  1. <csw1>system-view
  2. [csw1]ip route-static 0.0.0.0 0.0.0.0 192.168.100.2
  3. <csw2>system-view
  4. [csw2]ip route-static 0.0.0.0 0.0.0.0 192.168.200.2
复制代码
      配置以上静态路由,使用PC1继续ping 100.1.1.1,照旧没有ping通,我们通过抓包举行分析,ping 将数据包送出去了,但是并没有回来。

          11.配置回程路由
         接着我们在R1上使用 display ip routing-table下令,可以发现,R1路由并没有PC1的网络,即路由R1没有192.168.10.0网段的路由,因此我们要在R1上配置回程的静态路由。(如许就可以访问到外网了)
  1. [R1]ip route-static 192.168.10.0(PC1) 24 192.168.100.1
  2. [R1]ip route-static 192.168.10.0 (PC1)24 192.168.200.1
复制代码
        12.在pc1上用tracert下令跟踪路由。
        13.调csw1的优先级。将原来的优先级120调到90,再使用tracert下令跟踪路由,发现路由走的是右边的网络。这时候右边的是Master.
        而且当你立即改回来,再去使用tracert下令跟踪的时候,网络不会立即走回左边的网络,在前面的配置中配置了抢占延迟的时间为20 S,因此在恢复优先级后,要等过了设置的抢占延时时间才可以恢复。
        14.跟踪上行接口,如果上行效果有故障,则优先级会-30,那么原来的Master会变成backup,则网络则通过一边的举行传送。
  1. [csw1-Vlanif10]vrrp vrid 10 track interface g0/0/2 reduced 30
  2. [csw1]int g0/0/2
  3. [csw1-GigabitEthernet0/0/2]shutdown
  4. [csw1-GigabitEthernet0/0/2]quit
  5. [csw1]display vrrp
  6.   Vlanif10 | Virtual Router 10
  7.     State : Backup
  8.     Virtual IP : 192.168.10.254
  9.     Master IP : 192.168.10.253
  10.     PriorityRun : 90
  11.     PriorityConfig : 120
  12.     MasterPriority : 100
  13.     Preempt : YES   Delay Time : 20 s
  14.     TimerRun : 1 s
  15.     TimerConfig : 1 s
  16.     Auth type : NONE
  17.     Virtual MAC : 0000-5e00-010a
  18.     Check TTL : YES
  19.     Config type : normal-vrrp
  20.     Track IF : GigabitEthernet0/0/2   Priority reduced : 30
  21.     IF state : DOWN
  22.     Create time : 2023-05-06 15:13:45 UTC-08:00
  23.     Last change time : 2023-05-06 15:59:43 UTC-08:00
复制代码


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

梦应逍遥

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表