cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
726
Views
0
Helpful
5
Replies

Basic BGP:local-pref higher, but it takes the other path

news2010a
Level 3
Level 3

Hi, I managed to set local-preference higher on router R2.

However, trace from R1 indicates path is still via R3.

Can someone help me clarify why it is not taking R2? I already did 'clear ip bgp*' on border routers involved.


Config for R2 and R3 are below. Diagram is attached. Thanks!

------------------------------------------------------------------------------------------------------------------------

R1#trace 4.4.4.4

Type escape sequence to abort.
Tracing the route to 4.4.4.4

  1 10.2.80.2 304 msec 244 msec 236 msec
  2 10.2.55.133 468 msec 260 msec * <== I was expecting this to go through R2 instead since R2 has local-pref 350.
R1#

R2#sh ip bgp
BGP table version is 4, local router ID is 10.177.206.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.4.4/32       10.2.47.193              0    350      0 200 i
*> 10.2.80.0/24     10.177.206.1             2         32768 i
*> 10.177.206.0/24  0.0.0.0                  0         32768 i
R2#

R2#
R2#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     4.0.0.0/32 is subnetted, 1 subnets
B       4.4.4.4 [20/0] via 10.2.47.193, 00:07:34
     10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks
O       10.2.80.0/24 [110/2] via 10.177.206.1, 01:35:40, FastEthernet0/0
C       10.2.60.104/30 is directly connected, FastEthernet1/0
C       10.177.206.0/24 is directly connected, FastEthernet0/0
C       10.2.47.192/28 is directly connected, FastEthernet0/1
     192.168.1.0/32 is subnetted, 1 subnets
C       192.168.1.2 is directly connected, Loopback0
R2#

R2#sh run
Building configuration...

Current configuration : 1807 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
!
!
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 192.168.1.2 255.255.255.255
!
interface FastEthernet0/0
ip address 10.177.206.2 255.255.255.0
ip ospf 1 area 0
speed 100
full-duplex
!
interface FastEthernet0/1
ip address 10.2.47.204 255.255.255.240
ip ospf 1 area 0
speed 100
full-duplex
!
interface FastEthernet1/0
ip address 10.2.60.105 255.255.255.252
ip ospf 1 area 0
speed 100
full-duplex
!
router ospf 1
log-adjacency-changes
redistribute bgp 100 subnets route-map RM_ENG
!
router bgp 100
no synchronization
bgp log-neighbor-changes
network 10.2.0.0 mask 255.255.0.0
network 10.2.80.0 mask 255.255.255.0
network 10.177.206.0 mask 255.255.255.0
neighbor 10.2.47.193 remote-as 200
neighbor 10.2.47.193 route-map FROM_R4 in
neighbor 10.2.255.47 remote-as 100
no auto-summary
!
ip forward-protocol nd
!
ip as-path access-list 1 permit _200$
!
ip http server
no ip http secure-server
!
ip access-list standard MYLIST
permit 10.2.47.193 log
!
!
ip prefix-list LIST_ENG seq 5 permit 10.177.206.0/24 le 32
ip prefix-list LIST_ENG seq 10 permit 10.2.0.0/16 le 32
!
route-map RM_ENG permit 10
match ip address prefix-list LIST_ENG
set local-preference 300
!
route-map RM_ENG permit 100
!
route-map FROM_R4 permit 10
match as-path 1
set local-preference 350
!
route-map FROM_R4 permit 100
!
route-map RM_LIST permit 10
match ip address MYLIST
set local-preference 200
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
login
!
!
end


R3#sh ip bgp
BGP table version is 4, local router ID is 192.168.1.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.4.4/32       10.2.55.133              0             0 200 i
*> 10.2.80.0/24     0.0.0.0                  0         32768 i
*> 10.177.206.0/24  10.2.60.105              2         32768 i
R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     4.0.0.0/32 is subnetted, 1 subnets
B       4.4.4.4 [20/0] via 10.2.55.133, 00:06:10
     10.0.0.0/8 is variably subnetted, 5 subnets, 3 masks
C       10.2.55.0/24 is directly connected, FastEthernet0/1
C       10.2.80.0/24 is directly connected, FastEthernet0/0
C       10.2.60.104/30 is directly connected, FastEthernet1/0
O       10.177.206.0/24 [110/2] via 10.2.60.105, 01:34:17, FastEthernet1/0
O       10.2.47.192/28 [110/11] via 10.2.60.105, 01:34:17, FastEthernet1/0
     192.168.1.0/32 is subnetted, 1 subnets
C       192.168.1.3 is directly connected, Loopback0
R3#sh run
Building configuration...

Current configuration : 1539 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
memory-size iomem 5
ip cef
!
!
!
!
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 192.168.1.3 255.255.255.255
!
interface FastEthernet0/0
ip address 10.2.80.2 255.255.255.0
ip ospf 1 area 0
speed 100
full-duplex
!
interface FastEthernet0/1
ip address 10.2.55.132 255.255.255.0
speed 100
full-duplex
!
interface FastEthernet1/0
ip address 10.2.60.106 255.255.255.252
ip ospf 1 area 0
speed 100
full-duplex
!
router ospf 1
router-id 192.168.1.3
log-adjacency-changes
redistribute bgp 100 subnets route-map RM_ENG
!
router bgp 100
no synchronization
bgp log-neighbor-changes
network 10.2.0.0 mask 255.255.0.0
network 10.2.80.0 mask 255.255.255.0
network 10.177.206.0 mask 255.255.255.0
neighbor 10.2.55.133 remote-as 200
neighbor 10.2.255.15 remote-as 100
no auto-summary
!
ip forward-protocol nd
!
ip as-path access-list 1 permit _$200
!
ip http server
no ip http secure-server
!
!
ip prefix-list LIST_ENG seq 5 permit 10.177.206.0/24 le 32
ip prefix-list LIST_ENG seq 10 permit 10.2.0.0/16 le 32
!
route-map RM_ENG permit 10
match ip address prefix-list LIST_ENG
set local-preference 100
!
route-map FROM_R4 permit 10
match as-path 1
!
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
login
!
!
end

1 Accepted Solution

Accepted Solutions

Hi,

R1#trace 4.4.4.4

Type escape sequence to abort.
Tracing the route to 4.4.4.4

  1 10.2.80.2 304 msec 244 msec 236 msec - this is R3
  2 10.2.55.133 468 msec 260 msec * - this is R4, isn't it?

So both R2 and R3 are redistributing the 4.4.4.4/32 route to OSPF. Local preference has no effect on OSPF metric then (by default, the MED value -if available -  is copied into OSPF metric when redistributed from BGP).

So you should manipulate OSPF metric when redistributing from BGP if you want R2 to become a preferred router.

What I don't understand though:

4.4.4.4 does not match the prefix-list LIST_ENG so it should not be redistributed to OSPF on R3, should it?

Isn't R4 running OSPF, too?

Or am I missing something?

BR,

Milan

View solution in original post

5 Replies 5

milan.kulik
Level 10
Level 10

Hi,

it would be good to provide

sh ip bgp

output from your R1 router.

Is the BGP session between R1 and R2 Up at the moment?

The traceroute is showing it takes R3 and R2 then.

HTH,

Milan

Milan, I do not see how it gets to R2.

There is no BGP running on R1.

10.2.55.133 is the f0/1 interface on R3.

R1#show ip route

     4.0.0.0/32 is subnetted, 1 subnets
O E2    4.4.4.4 [110/1] via 10.2.80.2, 00:11:35, FastEthernet0/1
     10.0.0.0/8 is variably subnetted, 4 subnets, 3 masks
C       10.2.80.0/24 is directly connected, FastEthernet0/1
O       10.2.60.104/30 [110/2] via 10.2.80.2, 01:39:43, FastEthernet0/1
C       10.177.206.0/24 is directly connected, FastEthernet0/0
O       10.2.47.192/28 [110/12] via 10.2.80.2, 01:39:43, FastEthernet0/1
     192.168.1.0/32 is subnetted, 1 subnets
C       192.168.1.1 is directly connected, Loopback0

Hi,

R1#trace 4.4.4.4

Type escape sequence to abort.
Tracing the route to 4.4.4.4

  1 10.2.80.2 304 msec 244 msec 236 msec - this is R3
  2 10.2.55.133 468 msec 260 msec * - this is R4, isn't it?

So both R2 and R3 are redistributing the 4.4.4.4/32 route to OSPF. Local preference has no effect on OSPF metric then (by default, the MED value -if available -  is copied into OSPF metric when redistributed from BGP).

So you should manipulate OSPF metric when redistributing from BGP if you want R2 to become a preferred router.

What I don't understand though:

4.4.4.4 does not match the prefix-list LIST_ENG so it should not be redistributed to OSPF on R3, should it?

Isn't R4 running OSPF, too?

Or am I missing something?

BR,

Milan

I understand what you are saying. I tried before to increase the metric by 'redistribute bgp 100 metric 10 subnets route-map RM_ENG' on R3 and that did not work either. Then after examining:

R1#trace 4.4.4.4

Type escape sequence to abort.
Tracing the route to 4.4.4.4

  1 10.2.80.2 328 msec 280 msec 188 msec <== This is R3
  2 10.2.55.133 260 msec 908 msec *  <== This is R4, final hop.
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     4.0.0.0/32 is subnetted, 1 subnets
O E2   4.4.4.4 [110/10] via 10.2.80.2, 00:00:45, FastEthernet0/1 (This is R3)
     10.0.0.0/8 is variably subnetted, 6 subnets, 4 masks
O E2    10.2.0.0/16 [110/10] via 10.2.80.2, 00:00:45, FastEthernet0/1
C       10.2.40.0/24 is directly connected, Loopback1
C       10.2.80.0/24 is directly connected, FastEthernet0/1
O       10.2.60.104/30 [110/2] via 10.2.80.2, 00:00:45, FastEthernet0/1
C       10.177.206.0/24 is directly connected, FastEthernet0/0
O       10.2.47.192/28 [110/12] via 10.2.80.2, 00:00:45, FastEthernet0/1
     192.168.1.0/32 is subnetted, 1 subnets
C       192.168.1.1 is directly connected, Loopback0
R1#show ip route 4.4.4.4
Routing entry for 4.4.4.4/32
  Known via "ospf 1", distance 110, metric 10
  Tag 200, type extern 2, forward metric 12
  Last update from 10.2.80.2 on FastEthernet0/1, 00:00:59 ago
  Routing Descriptor Blocks:
  * 10.2.80.2, from 10.177.206.2, 00:00:59 ago, via FastEthernet0/1
      Route metric is 10, traffic share count is 1
      Route tag 200

I noticed that 10.177.206.2 is actually a R2 address (link betwen R3 and R2) . So as soon as I increased the ip ospf cost on the interface between R2 and R3, the thing now flows correctly via R2. Funny that based on the trace or show ip route, it was not possible to detect the hop via R2 is ever involved.  Only after doing the 'show ip route to the specific 4.4.4.4' target address I realized that R2 IP address 10.177.206.2 was part of the equation.

R2#show run | s ospf
ip ospf 1 area 0
ip ospf 1 area 0
ip ospf 1 area 0
router ospf 1
log-adjacency-changes
redistribute bgp 100 metric 10 subnets route-map RM_ENG
R2#


R3#show run | s ospf
ip ospf 1 area 0
ip ospf 1 area 0
router ospf 1
router-id 192.168.1.3
log-adjacency-changes
redistribute bgp 100 metric 50 subnets route-map RM_ENG
R3#
R3#

Hi,

use "show ip ospf database external" command on R1 to see what you are getting from your OSPF neighbours.

So far it seems like R2 was redistributing a BGP route with R3 as next-hop into OSPF.

Which is a little strange.

HTH,

Milan

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: