2

So in the following two routing table entries:

  • BGP route advertising 10.1.1.0/24
  • Static route advertising 10.1.0.0/16

Which would be selected? I know that static routes are chosen over BGP (and other) routes, and more specific routing entries are chosen over less specific, however, which one takes precedence? I want to say the static route, however I'm just not sure.

5

A more specific route is what is used to forward packets. The two prefixes you have are really that, two separate prefixes, just as if they were in completely different network blocks. You are trying to compare apples to oranges

If, on the other hand, the the prefixes were equal length, the static route would be used (assuming default ADs are used).

0

I read this question as "How will traffic to subnet 10.1.1.0/24 be routed if there is a static route to 10.1.0.0/16 and a more specific BGP-learned route to 10.1.1.0/24 ?".

In that case the answer would be : the more specific route will be selected, whatever the difference in administrative distances between the respective protocols.

Example : Router junos2 advertises 10.1.1.0/24 to router junos1.

Router junos1 has a static route to 10.1.0.0/16, discarding traffic to that less-specific prefix :

junos1 configuration

@junos1> show configuration | display set
set interfaces em0 unit 0 family inet address 172.16.100.1/30
set routing-options static route 10.1.0.0/16 discard
set protocols bgp local-as 111
set protocols bgp group AS-222 type external
set protocols bgp group AS-222 peer-as 222
set protocols bgp group AS-222 neighbor 172.16.100.2 family inet unicast

Router junos1 is receiving the more specific route from neighbour junos2 via BGP :

@junos1>show route receive-protocol bgp 172.16.100.2

inet.0: 4 destinations, 5 routes (4 active, 0 holddown, 0 hidden)
  Prefix          Nexthop          MED     Lclpref    AS path
* 10.1.1.0/24             172.16.100.2                            222 I
  172.16.100.0/30         172.16.100.2                            222 I

Checking the routing table, we see both routes are installed :

@junos1> show route

inet.0: 4 destinations, 5 routes (4 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.1.0.0/16        *[Static/5] 00:10:58
                      Discard
10.1.1.0/24        *[BGP/170] 00:12:01, localpref 100
                      AS path: 222 I
                    > to 172.16.100.2 via em0.0

For addresses within prefix 10.1.1.0/24, the more specific, BGP-learned route is preferred (even with an AD of 170 against 5 for the static route) :

@junos1> show route 10.1.1.1

inet.0: 4 destinations, 5 routes (4 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.1.1.0/24        *[BGP/170] 00:13:30, localpref 100
                      AS path: 222 I
                    > to 172.16.100.2 via em0.0

Which can be demonstrated by pinging 10.1.1.1 - traffic is not being discarded :

@junos1> ping rapid 10.1.1.1
PING 10.1.1.1 (10.1.1.1): 56 data bytes
!!!!!
--- 10.1.1.1 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.410/0.772/1.528/0.391 ms

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.