Re: Find all route target

From: Adam Booth <adam.booth_at_gmail.com>
Date: Wed, 18 Aug 2010 22:47:35 +1000

I thought it was an interesting question sinc in the past I have been more
interested in the RTs than the RDs - generally RTs are what you will be
doing your policy decisions on for importing/exporting and it could be handy
from a troubleshooting perspective.

Mustafa's question prompted me to put together a tcl script to pull the RT
info from the BGP database...

proc get_rt {} {
    set cmdout [exec "sh ip bgp vpnv4 all | include ^\\*"]

    foreach line [split $cmdout "\n"] {
       if [regexp {([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\/[0-9]+)} $line prefix] {
          puts [exec "sh ip bgp vpnv4 all $prefix \| include BGP\|RT"]
       }
    }
}

Below is how I put it in and execute it

R1#tclsh
R1(tcl)#proc get_rt {} {
+>(tcl)# set cmdout [exec "sh ip bgp vpnv4 all | include ^\\*"]
+>(tcl)#
+>(tcl)# foreach line [split $cmdout "\n"] {
+>(tcl)#if [regexp {([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\/[0-9]+)} $line prefix]
{
+>(tcl)#puts [exec "sh ip bgp vpnv4 all $prefix \| include BGP\|RT"]
+>(tcl)# }
+>(tcl)# }
+>(tcl)#}

R1(tcl)#get_rt
BGP routing table entry for 64512:10:1.2.3.0/24, version 6
      Extended Community: RT:64512:10

BGP routing table entry for 64512:10:4.3.2.0/25, version 7
      Extended Community: RT:64512:10

BGP routing table entry for 64512:20:2.4.0.0/16, version 8
      Extended Community: RT:64512:20

BGP routing table entry for 64512:20:8.6.4.2/32, version 9
      Extended Community: RT:64512:20
R1(tcl)#

Hope that's of some help.

Cheers,
Adam

On Wed, Aug 18, 2010 at 8:45 PM, Kambiz Agahian <aussiecert_at_gmail.com>wrote:

> Or you can simply turn on the debug command for incoming BGP updates. It
> does show the RTs attached.
>
> HTH
>
> Kambiz Agahian
>
> CCIE Instructor/Consultant
> M.Eng Telecom, CCIE# 25341, CCSI# 33326, MCSE, MCSA
>
>
> 2010/8/17 Mustafa Yadav <mustafa.yadav_at_gmail.com>
>
> > That is correct.I can see all rd but I wanna see all route target as
> > well which comes to any router
> >
> > 2010/8/18, Kambiz Agahian <aussiecert_at_gmail.com>:
> > > Mustafa,
> > >
> > > I'm not quite sure if I understand your question correctly but
> generally
> > RT
> > > doesn't have anything to do directly with BGP, rather it's RD that you
> > can
> > > see through the "sh ip bgp vpn all" command. It gives you a list of VPN
> > BGP
> > > routes with corresponding route distinguishers.
> > >
> > > HTH
> > >
> > >
> > > Kambiz Agahian
> > >
> > > CCIE Instructor/Consultant
> > > M.Eng Telecom, CCIE# 25341, CCSI# 33326, MCSE, MCSA
> > >
> > >
> > > 2010/8/17 Mustafa Yadav <mustafa.yadav_at_gmail.com>
> > >
> > >> How can I find all used route target by using sh bgp command.I will
> > >> use this command in a route reflector
> > >>
> > >> --
> > >> Mobil cihaz}mdan gvnderildi
> > >>
> > >>
> > >> Blogs and organic groups at http://www.ccie.net
> > >>
> > >>
> _______________________________________________________________________
> > >> Subscription information may be found at:
> > >> http://www.groupstudy.com/list/CCIELab.html
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >>
> > >
> >
> > --
> > Mobil cihaz}mdan gvnderildi
>
>
> Blogs and organic groups at http://www.ccie.net
>
> _______________________________________________________________________
> Subscription information may be found at:
> http://www.groupstudy.com/list/CCIELab.html

Blogs and organic groups at http://www.ccie.net
Received on Wed Aug 18 2010 - 22:47:35 ART

This archive was generated by hypermail 2.2.0 : Wed Sep 01 2010 - 11:20:52 ART