首页 > 其他 > 详细

基于BGP的HA场景验证(BGP版)

时间:2020-09-14 10:31:46      阅读:64      评论:0      收藏:0      [点我收藏+]

基于BGP组网的HA场景验证(MED)

  • MED为BGP中的metric值
    ??MULTI_EXIT_DISC(多出口标识符)简称MED,MED用于影响相邻两个自治系统的路由决策,被称为外部度量值,其值越小越优先,Cisco中为metric,默认值为0,MED只能在AS之间传递,收到此属性的AS路由器不会再将其传递给任何其它的第三方AS,但会传递给他的iBGP邻居;
    ??MED的取值范围是0~4294967295(32位)
    技术分享图片
  • 图中A设备因自己需要设置多网口进行直连,可以直接在宿主机中安装vtysh进行操作,更为简便
  • 拓扑:
    ??在BGP组网中有四台设备,其中A,B,C建立EBGP连接,B,C,D建立IBGP连接。
    ??A的自治域设置为100,B、C和D的自治域为50,这三台设备BGP连接使用loopback,其他设备连接使用ip。

2,环境搭建

?2.1 A设备设置

  • vtysh
vtysh
configure terminal
router bgp 100
configure terminalbgp router-id 10.10.0.1
neighbor 10.10.0.2 remote-as 50
neighbor 10.10.0.2 ebgp-multihop 2
neighbor 20.20.0.2 remote-as 50
neighbor 20.20.0.2 ebgp-multihop 2
  • 设置metric
vtysh
configure terminal

route-map map permit 10
set metric 10
route-map map1 permit 10
set metric 100

router bgp 100
neighbor 10.10.0.2 route-map map in
neighbor 20.20.0.2 route-map map1 in

?2.2 B设备设置

  • vtysh
    ??与A设备建立BGP
vtysh
configure terminal
router bgp 50
router bgp 10.10.0.2
neighbor 10.10.0.1 remote-as 100
neighbor 10.10.0.1 ebgp-mltihop 2

??与D设备建立BGP

vtysh
configure terminal
router bgp 50
neighbor 3.3.3.1 remote-as 50
neighbor 3.3.3.1 update-source lo
//添加默认路由
ip route 3.3.3.0/24 via 192.168.20.10

?2.3 c设备设置

  • vtysh
    ??与A设备建立BGP
vtysh
configure terminal
router bgp 50
router bgp 20.20.0.2
neighbor 20.20.0.1 remote-as 100
neighbor 20.20.0.1 ebgp-mltihop 2

??与D设备建立BGP

vtysh
configure terminal
router bgp 50
neighbor 3.3.3.1 remote-as 50
neighbor 3.3.3.1 update-source lo
//添加默认路由
ip route 3.3.3.0/24 via 192.168.10.10

?2.4 D设备设置

  • vtysh
router bgp 50
bgp router-id 3.3.3.1 
neighbor 1.1.1.1 remote-as 50
neighbor 1.1.1.1 update-source lo 
neighbor 2.2.2.2 remote-as 50     
neighbor 2.2.2.2 update-source lo

//配置本地BGP发送路由
address-family ipv4 unicast 
network 3.3.3.0/24 
exit-address-family  

//需要增加默认路由
ip route add 1.1.1.0/24 via 192.168.20.20
ip route add 2.2.2.0/24 via 192.168.10.20

3,组网状态

?3.1 A

  • 使用show ip bgp summary 查看BGP neighbor情况
    技术分享图片
  • 使用show ip bgp 查看BGP路由表,根据BGP路由规则,当前优选路由是下一跳为10.10.0.2这条
    技术分享图片

?3.1 B

  • 使用show ip bgp summary 查看BGP neighbor情况
    技术分享图片
  • 使用show ip bgp 查看BGP路由表,根据BGP路由规则
    技术分享图片

?3.1 C

  • 使用show ip bgp summary 查看BGP neighbor情况
    技术分享图片
  • 使用show ip bgp 查看BGP路由表,根据BGP路由规则
    技术分享图片

?3.1 D

  • 使用show ip bgp summary 查看BGP neighbor情况
    技术分享图片
  • 使用show ip bgp 查看BGP路由表,根据BGP路由规则
    技术分享图片

4,验证

??由下图A的路由表可以看出,A现在的优选路由是下一跳为10.10.0.2这条
技术分享图片
??现在拔掉10.10.0.2这根网线,再次查看A设备的路由表
技术分享图片
??现在插回10.10.0.2这根网线,再次查看A设备的路由表
技术分享图片
??可以看出当B设备重新与A设备建立BGP后,优选路由任然为从B设备学到的
??一条相同的BGP条目通过不同的EBGP邻居学到时,只有在AS号相同时才进行MED比较,当从不同的EBGP邻居收到相同的路由,但是AS号不一样时,是不会比较MED值的,如果路由器上配置了bgp always-compare-med,就会忽略AS号不一样,始终进行MED值的比较。

基于BGP的HA场景验证(BGP版)

原文:https://www.cnblogs.com/CYD-self/p/13665168.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!