I want to configure a multi-homed BGP router with preference for one ISP. My actual setup will only receive the default routes and not the full BGP feed from the upstream ISPs. But in this test setup I have a network setup as following and my aim is to prefer R4 over R2 for traffic from R1.
The 4 routers are FRR 7.3.1 images from GNS3 market place. They are configured identically. The config is same for all routers, only the IP addresses change as per the figure.
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
The first issue is that I'm not seeing all paths on all routers. Two routers have 7 paths each while the other two have 5 paths each. The two with 7 paths are the ones that were configured first and last if that has any significance.
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
Apart from the difference in BGP path lists, every thing looks OK. I can ping every router from each other and traceroute is as expected.
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
Preference setting: I want my outgoing traffic from R1 to go through R4 rather than R2 so I am setting a local-preference of 300 on R1 to paths learned from 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
But now every thing breaks. I can not ping R2 and R3 any more. When I ping R2 from R1, I can see through wireshark that the echo request goes through R4 to R3 but the traffic is not showing between R3 and 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 output from other routers are as follows. 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
When I ping R2 from R4, the packets move as expected from R3 to R2.
Any help would be highly appreciated. I am a novice in networking and my understanding of BGP may be flawed. Kindly point out if I'm doing something wrong.
Seems this issue is specific to FRRouting. Getting desired results with local-preference with IOS with the exact setup. Will test with more versions of FRRouting to see if the issue persists.