我想为一个 ISP 配置一个多宿主 BGP 路由器。我的实际设置将只接收默认路由,而不是来自上游 ISP 的完整 BGP 馈送。但是在这个测试设置中,我有一个如下的网络设置,我的目标是更喜欢 R4 而不是 R2 来处理来自 R1 的流量。
4 个路由器是来自GNS3 市场的 FRR 7.3.1 映像。它们的配置相同。所有路由器的配置都是一样的,只是IP地址按图改变。
R1# show running-config
Building configuration...
Current configuration:
!
frr version 7.3.1
frr defaults traditional
hostname R1
service integrated-vtysh-config
!
router bgp 1
neighbor 192.168.1.2 remote-as 2
neighbor 192.168.4.1 remote-as 4
!
address-family ipv4 unicast
network 10.1.0.0/16
exit-address-family
!
line vty
!
end
第一个问题是我没有看到所有路由器上的所有路径。两个路由器各有 7 条路径,而另外两个路由器各有 5 条路径。如果有任何意义,则具有 7 条路径的两条路径是首先配置的,也是最后配置的。
R1:
R1# show ip bgp
BGP table version is 5, local router ID is 192.168.4.2, vrf id 0
Default local pref 100, local AS 1
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.0.0/16 0.0.0.0 0 32768 i
* 10.2.0.0/16 192.168.4.1 0 4 3 2 i
*> 192.168.1.2 0 0 2 i
* 10.3.0.0/16 192.168.4.1 0 4 3 i
*> 192.168.1.2 0 2 3 i
*> 10.4.0.0/16 192.168.4.1 0 0 4 i
* 192.168.1.2 0 2 3 4 i
Displayed 4 routes and 7 total paths
R2:
R2# show ip bgp
BGP table version is 4, local router ID is 192.168.2.1, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.0.0/16 192.168.1.1 0 0 1 i
*> 10.2.0.0/16 0.0.0.0 0 32768 i
*> 10.3.0.0/16 192.168.2.2 0 0 3 i
* 10.4.0.0/16 192.168.1.1 0 1 4 i
*> 192.168.2.2 0 3 4 i
Displayed 4 routes and 5 total paths
R3:
R3# show ip bgp
BGP table version is 4, local router ID is 192.168.3.1, vrf id 0
Default local pref 100, local AS 3
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 10.1.0.0/16 192.168.3.2 0 4 1 i
*> 192.168.2.1 0 2 1 i
*> 10.2.0.0/16 192.168.2.1 0 0 2 i
*> 10.3.0.0/16 0.0.0.0 0 32768 i
*> 10.4.0.0/16 192.168.3.2 0 0 4 i
Displayed 4 routes and 5 total paths
R4:
R4# show ip bgp
BGP table version is 5, local router ID is 192.168.4.1, vrf id 0
Default local pref 100, local AS 4
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.0.0/16 192.168.4.2 0 0 1 i
* 192.168.3.1 0 3 2 1 i
* 10.2.0.0/16 192.168.4.2 0 1 2 i
*> 192.168.3.1 0 3 2 i
* 10.3.0.0/16 192.168.4.2 0 1 2 3 i
*> 192.168.3.1 0 0 3 i
*> 10.4.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 7 total paths
除了 BGP 路径列表的不同,一切看起来都还不错。我可以互相 ping 每个路由器,并且 traceroute 符合预期。
R1:~# traceroute -s 10.1.0.1 10.2.0.1
traceroute to 10.2.0.1 (10.2.0.1) from 10.1.0.1, 30 hops max, 46 byte packets
1 10.2.0.1 (10.2.0.1) 1.473 ms 1.430 ms 1.328 ms
R1:~# traceroute -s 10.1.0.1 10.3.0.1
traceroute to 10.3.0.1 (10.3.0.1) from 10.1.0.1, 30 hops max, 46 byte packets
1 192.168.1.2 (192.168.1.2) 1.377 ms 1.466 ms 1.356 ms
2 10.3.0.1 (10.3.0.1) 3.149 ms 1.462 ms 1.033 ms
R1:~# traceroute -s 10.1.0.1 10.4.0.1
traceroute to 10.4.0.1 (10.4.0.1) from 10.1.0.1, 30 hops max, 46 byte packets
1 10.4.0.1 (10.4.0.1) 0.556 ms 1.243 ms 1.271 ms
R3:~# traceroute -s 10.3.0.1 10.1.0.1
traceroute to 10.1.0.1 (10.1.0.1) from 10.3.0.1, 30 hops max, 46 byte packets
1 192.168.2.1 (192.168.2.1) 0.468 ms 1.461 ms 1.135 ms
2 10.1.0.1 (10.1.0.1) 3.038 ms 3.332 ms 3.734 ms
首选项设置: 我希望来自 R1 的传出流量通过 R4 而不是 R2,因此我将 R1 上的本地首选项设置为 300 到从 R4 学习的路径。R1:
frr(config)# ip prefix-list allow_all_pref seq 10 permit any
frr(config)# route-map rmap permit 10
frr(config-route-map)# match ip address prefix-list allow_all_pref
frr(config-route-map)# set local-preference 300
frr(config-route-map)# exit
frr(config)# router bgp 1
frr(config-router)# address-family ipv4 unicast
frr(config-router-af)# neighbor 192.168.4.1 route-map rmap in
frr(config-router-af)# do show ip bgp
BGP table version is 8, local router ID is 192.168.4.2, vrf id 0
Default local pref 100, local AS 1
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.0.0/16 0.0.0.0 0 32768 i
*> 10.2.0.0/16 192.168.4.1 300 0 4 3 2 i
* 192.168.1.2 0 0 2 i
*> 10.3.0.0/16 192.168.4.1 300 0 4 3 i
* 192.168.1.2 0 2 3 i
*> 10.4.0.0/16 192.168.4.1 0 300 0 4 i
* 192.168.1.2 0 2 3 4 i
Displayed 4 routes and 7 total paths
但现在一切都破裂了。我再也无法 ping R2 和 R3。当我从 R1 ping R2 时,我可以通过 wireshark 看到回显请求通过 R4 到 R3,但 R3 和 R2 之间没有显示流量。
traceroute to 10.2.0.1 (10.2.0.1) from 10.1.0.1, 30 hops max, 46 byte packets
1 192.168.4.1 (192.168.4.1) 1.480 ms 1.514 ms 1.499 ms
2 * * *
3 * * *
4 * * *
show ip bgp 其他路由器的输出如下。R2:
R2# show ip bgp
BGP table version is 4, local router ID is 192.168.2.1, vrf id 0
Default local pref 100, local AS 2
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.0.0/16 192.168.1.1 0 0 1 i
*> 10.2.0.0/16 0.0.0.0 0 32768 i
* 10.3.0.0/16 192.168.1.1 0 1 4 3 i
*> 192.168.2.2 0 0 3 i
* 10.4.0.0/16 192.168.1.1 0 1 4 i
*> 192.168.2.2 0 3 4 i
Displayed 4 routes and 6 total paths
R3:
R3# show ip bgp
BGP table version is 4, local router ID is 192.168.3.1, vrf id 0
Default local pref 100, local AS 3
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
* 10.1.0.0/16 192.168.3.2 0 4 1 i
*> 192.168.2.1 0 2 1 i
*> 10.2.0.0/16 192.168.2.1 0 0 2 i
*> 10.3.0.0/16 0.0.0.0 0 32768 i
*> 10.4.0.0/16 192.168.3.2 0 0 4 i
Displayed 4 routes and 5 total paths
R4:
R4# show ip bgp
BGP table version is 5, local router ID is 192.168.4.1, vrf id 0
Default local pref 100, local AS 4
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.0.0/16 192.168.4.2 0 0 1 i
* 192.168.3.1 0 3 2 1 i
*> 10.2.0.0/16 192.168.3.1 0 3 2 i
*> 10.3.0.0/16 192.168.3.1 0 0 3 i
*> 10.4.0.0/16 0.0.0.0 0 32768 i
Displayed 4 routes and 5 total paths
当我从 R4 ping R2 时,数据包按预期从 R3 移动到 R2。
任何帮助将不胜感激。我是网络新手,我对 BGP 的理解可能存在缺陷。如果我做错了什么,请指出。
似乎这个问题是特定于 FRRouting 的。通过 IOS 的本地首选项获得所需的结果,并进行精确设置。将使用更多版本的 FRRouting 进行测试,以查看问题是否仍然存在。