Solved

BGP - USING LOCAL_PREF & MED ATTRIBUTES

Posted on 2009-03-31
35
500 Views
Last Modified: 2012-08-14
after following instructions to configure configs on the 3 routers below:

- sanjose3 - is the main router
- ISP1A - another router
- ISP1B - another router

I have 2 questions:

1.  which path is better - i believe it to be 192.168.1.6 ?
2.  based on the output of the "sh ip bgp" command below, what is the local preference values of paths 1 & 2 - i believe at this point for the configurations done so far that there is currently only 1 local preference value, as i have not added any "Local_pref" configurations as yet.  would I be correct in thinking this?
-------------------------------------------
Building configuration...

Current configuration : 768 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname sanjose3
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip subnet-zero
!
!
!
!
interface Ethernet0
 ip address 200.100.50.1 255.255.255.0
!
 interface Serial0
 ip address 192.168.1.6 255.255.255.252
 clock rate 56000
 no fair-queue
!
interface Serial1
 ip address 172.24.1.17 255.255.255.252
 clock rate 56000
!
interface BRI0
 no ip address
 encapsulation hdlc
 shutdown
!
router bgp 300
 no synchronization
 bgp log-neighbor-changes
 network 200.100.50.0
 neighbor 172.24.1.18 remote-as 400
 neighbor 192.168.1.5 remote-as 200
 no auto-summary
!
ip http server
ip classless
!
!
!
!
line con 0
line aux 0
line vty 0 4
!
end

sanjose3#sh ip bgp
BGP table version is 2, local router ID is 192.168.1.6
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
*> 200.100.50.0     0.0.0.0                  0         32768 i
sanjose3#sh rip   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

C    200.100.50.0/24 is directly connected, Ethernet0
     172.24.0.0/30 is subnetted, 1 subnets
C       172.24.1.16 is directly connected, Serial1
     192.168.1.0/30 is subnetted, 1 subnets
C       192.168.1.4 is directly connected, Serial0
sanjose3#
---------------------------------------------
Building configuration...

Current configuration : 661 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname ISP1A
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip subnet-zero
!
!
!
!
interface Ethernet0
 no ip address
 shutdown
!
interface Serial0
 ip address 192.168.1.5 255.255.255.252
 no fair-queue
!
interface Serial1
 ip address 10.1.1.1 255.255.255.252
!
router bgp 200
 no synchronization
 bgp log-neighbor-changes
 network 10.0.0.0
 neighbor 10.1.1.2 remote-as 400
 neighbor 192.168.1.6 remote-as 300
 no auto-summary
!
ip http server
ip classless
!
!
!
!
line con 0
exec-timeout 0 0
line aux 0
line vty 0 4
!
end

ISP1A#sh ip bgp
BGP table version is 2, local router ID is 192.168.1.5
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
*> 200.100.50.0     192.168.1.6              0             0 300 i
ISP1A#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

B    200.100.50.0/24 [20/0] via 192.168.1.6, 00:07:41
     192.168.1.0/30 is subnetted, 1 subnets
C       192.168.1.4 is directly connected, Serial0
ISP1A#
-----------------------------------------------
Building configuration...

Current configuration : 723 bytes
!
version 12.3
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname ISP1B
!
boot-start-marker
boot-end-marker
!
!
no aaa new-model
ip subnet-zero
!
!
!
!
interface Ethernet0
 no ip address
 shutdown
!
interface Serial0
 ip address 172.24.1.18 255.255.255.252
 no fair-queue
!
interface Serial1
 ip address 10.1.1.2 255.255.255.252
!
interface BRI0
 no ip address
 encapsulation hdlc
 shutdown
!
router bgp 400
 no synchronization
 bgp log-neighbor-changes
 network 10.0.0.0
 neighbor 10.1.1.1 remote-as 200
 neighbor 172.24.1.17 remote-as 300
 no auto-summary
!
ip http server
ip classless
!
!
!
!
line con 0
 exec-timeout 0 0
line aux 0
line vty 0 4
!
end

ISP1B#sh ip bgp
BGP table version is 2, local router ID is 172.24.1.18
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
*> 200.100.50.0     172.24.1.17              0             0 300 i
ISP1B#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

B    200.100.50.0/24 [20/0] via 172.24.1.17, 00:04:26
     172.24.0.0/30 is subnetted, 1 subnets
C       172.24.1.16 is directly connected, Serial0
ISP1B#
0
Comment
Question by:mikey250
  • 21
  • 14
35 Comments
 
LVL 43

Expert Comment

by:JFrederick29
Comment Utility
1.  Assuming you are talking about the path to 200.100.50.0/24.  The path via 192.168.1.6 is the only path as the ISP1B router is not advertising that subnet.

2.  The local pref is the default of 100 since you don't have it configured otherwise.
0
 

Author Comment

by:mikey250
Comment Utility
1. This is what I thought, it looks like my scenarios are a little back to front or maybe me?

2. when you say default 100 are you meaning if no commands regarding "local_Pref" are configured then a default of 100 is assummed although I cannot see this in config?

a. the reason why i say this is because one of the config commands for ISP1B - "neighbor 172.24.1.17 remote-as 300 should have been "neighbor 172.24.1.17 remote-as 100", but i thought "............ remote-as 300 was a typo or WASNT it?

3.  once ive cleared up those issues above, then i will THEN be adding a "local_pref" on ISP1A -
- which will force a specified route direction

- & eventually a "route-map badmetric", stopping ISP1A from routing via 192.168.1.6
- & then on ISP1B a "goodmetric" 172.24.1.17 out etc.

so as you can see im cross-checking my results!!
0
 
LVL 43

Expert Comment

by:JFrederick29
Comment Utility
2.  Yes, default value is 100 so you won't see it in the BGP table/config.

a.  It should be 300 since sanjose3 has an AS number of 300.

3.  Add this to the ISP1B router so ISP1A has two paths to the 200.100.50.0/24 subnet.

ISP1B:

router bgp 400
network 200.100.50.0

Now, on ISP1A, you should see two entries in the BGP table under that subnet and it will prefer one of the two paths.  You can then use local pref to favor one way or the other.
0
 

Author Comment

by:mikey250
Comment Utility
ive added on ISP1B, the command &

ISP1A#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

B    200.100.50.0/24 [20/0] via 192.168.1.6, 01:50:47
     192.168.1.0/30 is subnetted, 1 subnets
C       192.168.1.4 is directly connected, Serial0
ISP1A#sh ip bgp
BGP table version is 2, local router ID is 192.168.1.5
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
*> 200.100.50.0     192.168.1.6              0             0 300 i
ISP1A#

1. i will local pref later as presumably I should see two paths before I do that?
0
 

Author Comment

by:mikey250
Comment Utility
the !sh ip bgp" are exactly as before!!
0
 
LVL 43

Expert Comment

by:JFrederick29
Comment Utility
Well, look at the BGP and routing table on ISP1A now, you should see different results than before.
0
 

Author Comment

by:mikey250
Comment Utility
ISP1A#sh ip bgp
BGP table version is 2, local router ID is 192.168.1.5
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
*> 200.100.50.0     192.168.1.6              0             0 300 i
ISP1A#
0
 
LVL 43

Expert Comment

by:JFrederick29
Comment Utility
Oops, sorry, that was from ISP1A :)

Add this to ISP1A:

conf t
ip route 172.24.1.16 255.255.255.252 10.1.1.2

Then on ISP1A, do a "clear ip bgp neigh 10.1.1.2 soft in" command.
0
 

Author Comment

by:mikey250
Comment Utility
1. or is it supposed to be to add the "Local_pref commands and or "goodmetric & badmetrick" to get that?
0
 
LVL 43

Expert Comment

by:JFrederick29
Comment Utility
1.  Nope, you need two entries for the same network before local pref comes into play.
0
 

Author Comment

by:mikey250
Comment Utility
do i remove or leave "the last command you said to enter?
0
 
LVL 43

Expert Comment

by:JFrederick29
Comment Utility
On ISP1A:

Add the route:

conf t
ip route 172.24.1.16 255.255.255.252 10.1.1.2
exit

Then reset the peer session:

clear ip bgp neigh 10.1.1.2 soft in
0
 

Author Comment

by:mikey250
Comment Utility
ISP1A#
!
interface Serial0
 ip address 192.168.1.5 255.255.255.252
 no fair-queue
!
interface Serial1
 ip address 10.1.1.1 255.255.255.252
!
router bgp 200
 no synchronization
 bgp log-neighbor-changes
 network 10.0.0.0
 neighbor 10.1.1.2 remote-as 400
 neighbor 192.168.1.6 remote-as 300
 no auto-summary
!
ip http server
ip classless
ip route 172.24.1.16 255.255.255.252 10.1.1.2
!
------------------
ISP1A#sh ip bgp
BGP table version is 1, local router ID is 192.168.1.5
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
*  200.100.50.0     192.168.1.6              0             0 300 i
ISP1A#
---------------------------------
 still same
0
 
LVL 43

Expert Comment

by:JFrederick29
Comment Utility
Can you post a "show ip bgp neigh summary" from ISP1A.
0
 

Author Comment

by:mikey250
Comment Utility
ISP1A#clear ip bgp neigh 10.1.1.2 soft in
                    ^
% Invalid input detected at '^' marker.

ISP1A#clear ip bgp * - so i did this command instead
ISP1A#
0
 
LVL 43

Expert Comment

by:JFrederick29
Comment Utility
Sorry, I meant "show ip bgp summary".
0
 

Author Comment

by:mikey250
Comment Utility
ISP1A#show ip bgp summary
BGP router identifier 192.168.1.5, local AS number 200
BGP table version is 1, main routing table version 1
1 network entries using 101 bytes of memory
1 path entries using 48 bytes of memory
1 BGP path attribute entries using 60 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 233 total bytes of memory
BGP activity 5/4 prefixes, 5/4 paths, scan interval 60 secs

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd

10.1.1.2        4   400       0       0        0    0    0 never    Idle
192.168.1.6     4   300     161     153        0    0    0 00:01:37        1
ISP1A#
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:mikey250
Comment Utility
im not complaining, were working through it!!
0
 
LVL 43

Accepted Solution

by:
JFrederick29 earned 500 total points
Comment Utility
Okay, well, the serial connection between ISP1A and ISP1B is not up.  Is it cabled correctly?
0
 

Author Comment

by:mikey250
Comment Utility
it came loose!
0
 

Author Comment

by:mikey250
Comment Utility
i removed that ip route 172.24.1.16 255.255.255.252 10.1.1.2

then did:

ISP1A#clear ip bgp *
ISP1A#clear ip bgp neigh 10.1.1.2 soft in
*Mar  1 02:48:22.231: %BGP-5-ADJCHANGE: neighbor 10.1.1.2 Down User reset
*Mar  1 02:48:22.239: %BGP-5-ADJCHANGE: nsh ip bgp

ISP1A#sh ip bgp

ISP1A#
*Mar  1 02:49:03.499: %BGP-5-ADJCHANGE: neighbor 192.168.1.6 Up
*Mar  1 02:49:09.727: %BGP-5-ADJCHANGE: neighbor 10.1.1.2 Up
ISP1A#sh ip bgp
BGP table version is 2, local router ID is 192.168.1.5
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
*  200.100.50.0     10.1.1.2                               0 400 300 i
*>                  192.168.1.6              0             0 300 i
ISP1A#
0
 

Author Comment

by:mikey250
Comment Utility
so this is presumably the result I wanted, so i should be able to carryon?
0
 
LVL 43

Expert Comment

by:JFrederick29
Comment Utility
Good, now you have two routes to 200.100.50.0.  The router has selected 192.168.1.6 as the best path as indicated by the > in front of the 192.168.1.6 next hop.

Now you can introduce local pref and other attributes to change the best path.
0
 
LVL 43

Expert Comment

by:JFrederick29
Comment Utility
>so this is presumably the result I wanted, so i should be able to carryon?

Yes, correct.  Good luck.
0
 

Author Comment

by:mikey250
Comment Utility
so the better path is 192.168.1.6 in the above case, but now ive done a

1. my next question is based on the output command below, what is the local preference value of paths 1 & 2.  im assuming is is in the order below: 10.1.1.2 then 192.168.1.6?
ISP1A#sh ip bgp 200.100.50.0

ISP1A#sh ip bgp 200.100.50.0
BGP routing table entry for 200.100.50.0/24, version 2
Paths: (2 available, best #2, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.1.1.2
  400 300
    10.1.1.2 from 10.1.1.2 (172.24.1.18)
      Origin IGP, localpref 100, valid, external
  300
    192.168.1.6 from 192.168.1.6 (192.168.1.6)
      Origin IGP, metric 0, localpref 100, valid, external, best
ISP1A#
0
 

Author Comment

by:mikey250
Comment Utility
1. thats what it says just before i add local pref or med for example?
0
 
LVL 43

Expert Comment

by:JFrederick29
Comment Utility
Both have a localpref of 100 which again is the default value.  The highest localpref is favored so once you set higher localpref via the 10.1.1.2 peer, that will be the favored path over the current best path via 192.168.1.6.
0
 

Author Comment

by:mikey250
Comment Utility
i can now see and I understand.  appreciated cheers!

1. but ive just removed:

router bgp 400
no network 200.100.50.0 - just to see & done the following, so im assuming this is ok, since obviously my serial cable came loose?

ISP1A#clear ip bgp *
ISP1A#sh ip bgp
*Mar  1 03:06:39.227: %BGP-5-ADJCHANGE: neighbor 192.168.1.6 Down User reset

ISP1A#sh ip bgp

ISP1A#
*Mar  1 03:07:06.983: %BGP-5-ADJCHANGE: neighbor 10.1.1.2 Up
*Mar  1 03:07:16.959: %BGP-5-ADJCHANGE: neighbor 192.168.1.6 Up
ISP1A#sh ip bgp
BGP table version is 3, local router ID is 192.168.1.5
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
*> 200.100.50.0     192.168.1.6              0             0 300 i
*                              10.1.1.2                                   0 400 300 i
ISP1A#
-------------
ISP1A#sh ip bgp
BGP table version is 3, local router ID is 192.168.1.5
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
*> 200.100.50.0     192.168.1.6              0             0 300 i
*                   10.1.1.2                               0 400 300 i
ISP1A#sh ip bgp 200.100.50.0
BGP routing table entry for 200.100.50.0/24, version 3
Paths: (2 available, best #1, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.1.1.2
  300
    192.168.1.6 from 192.168.1.6 (192.168.1.6)
      Origin IGP, metric 0, localpref 100, valid, external, best
  400 300
    10.1.1.2 from 10.1.1.2 (172.24.1.18)
      Origin IGP, localpref 100, valid, external
ISP1A#
0
 
LVL 43

Expert Comment

by:JFrederick29
Comment Utility
Yeah, looks good now.  The serial cable coming loose was the issue :)
0
 

Author Comment

by:mikey250
Comment Utility
yes that why i thought id remove just to see.  sorted thanks!!
0
 

Author Comment

by:mikey250
Comment Utility
how do i add points for this one, since my cable was loose. i could allocate the points but add a comment aswell.  what do you suggest?
0
 

Author Comment

by:mikey250
Comment Utility
you walked me through changes to realise the serial cable so points are yours!
0
 
LVL 43

Expert Comment

by:JFrederick29
Comment Utility
Thanks!
0
 

Author Comment

by:mikey250
Comment Utility
oh yeh it was your comment about the serial cable that made us realise why.  so i will allocate points to that specific comment from you!!!!
0
 

Author Closing Comment

by:mikey250
Comment Utility
ive removed those commands given and my config after all was correct. accept that as you suggested my serial cable had come loose.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Hello , This is a short article on how would you go about enabling traceoptions on a Juniper router . Traceoptions are similar to Cisco debug commands but these traceoptions are implemented in Juniper networks router . The following demonstr…
Problem Description:   Couple of months ago we upgraded the ADSL line at our branch office from Home to Business line. The purpose of transforming the service to have static public IP’s. We were in need for public IP’s to publish our web resour…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now