Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Objectives
• Use BGP commans to pre!ent pri!ate AS numbers "rom being a!ertise to the outsie #or$%
• Use the AS_PATH attribute to "i$ter BGP routes base on their source AS numbers%
Backgroun
The &nternationa$ Tra!e$ Agenc'(s &SP has been assigne an AS number o" )**% This pro!ier uses BGP to e+change
routing in"ormation #ith se!era$ customer net#ors% ach customer net#or is assigne an AS number "rom the
pri!ate range, such as AS ./***% Con"igure the &SP router to remo!e the pri!ate AS numbers "rom the AS Path
in"ormation o" Cust0tr% &n aition, the &SP #ou$ $ie to pre!ent its customer net#ors "rom recei!ing route
in"ormation "rom &nternationa$ Tra!e$ Agenc'(s AS 1**% Use the AS_PATH attribute to imp$ement this po$ic'%
2*13 Cisco an4or its a""i$iates% A$$ rights reser!e% This ocument is Cisco Pub$ic% Page 1 o" 11
CCNPv7 ROUTE Lab 7-2, Using the AS_PATH Attribute
Note! This $ab uses Cisco 1 531 routers #ith Cisco &6S 0e$ease 1/%3 #ith &P Base% The s#itches are Cisco S-
C25.*-23TT-L #ith 8ast thernet inter"aces, there"ore the router #i$$ use routing metrics associate #ith a 1** 9b4s
inter"ace% :epening on the router or s#itch moe$ an Cisco &6S So"t#are !ersion, the commans a!ai$ab$e an
output prouce might !ar' "rom #hat is sho#n in this $ab%
Re"uire Resources
• ) routers ;Cisco &6S 0e$ease 1/%2 o r comparab$e<
• Seria$ an thernet cab$es
2*13 Cisco an4or its a""i$iates% A$$ rights reser!e% This ocument is Cisco Pub$ic% Page 2 o" 11
CCNPv7 ROUTE Lab 7-2, Using the AS_PATH Attribute
c% Use ping to test the connecti!it' bet#een the irect$' connecte routers%
Note! San=ose #i$$ not be ab$e to reach either &SP>s $oopbac ;1*%2%2%1< or Cust0tr>s $oopbac ;1*%)%)%1<, nor #i$$
it be ab$e to reach either en o" the $in ?oining &SP to Cust0tr ;172%23%1%17 an 172%23%1%1@<%
b% eri"' that these routers ha!e estab$ishe the appropriate neighbor re$ationships b' issuing the s'o. ip bgp
neig'bors comman on each router%
ISP# sho# ip bgp neighbors
BGP neighbor is 1722!11" re$ote %S &' eternal lin*
BGP +ersion ! re$ote router I, 11
BGP
3aststate
rea0 . /stablishe0
2" u for 2"
last 4rite 2" hol0 ti$e is 1" *eeali+e inter+al is & secon0s
5outut o$itte06
2*13 Cisco an4or its a""i$iates% A$$ rights reser!e% This ocument is Cisco Pub$ic% Page ) o" 11
CCNPv7 ROUTE Lab 7-2, Using the AS_PATH Attribute
This "ai$s because San=ose sources the ping #ith its c$osest connecte inter"ace s*4*4* #ith &P aress
152%1.@%1%/% Cust0tr oes not ha!e a route bac to that inter"ace, so the ping rep$ies cannot return to San=ose%
c% Ping again, this time as an e+t ene ping, sourcing "rom the Loopbac* inter"ace aress%
SanJose# ping
Protocol DiE
Farget IP a00ress 10.&.&.1
Reeat count D'E
,atagra$ sie D1E
Fi$eout in secon0s D2E
/ten0e0 co$$an0s DnE y
Source a00ress or interface 10.1.1.1
F=e of ser+ice DE
Set ,; bit in IP hea0erH DnoE
ali0ate rel= 0ataH DnoE
,ata attern D%BC,E
3oose Strict Recor0 Fi$esta$ erboseDnoneE
S4ee range of sies DnE
F=e escae seuence to abort
Sen0ing ' 1-b=te IC8P /chos to 11 ti$eout is 2 secon0s
Pac*et sent 4ith a source a00ress of 1111
KKKKK
Success rate is 1 ercent ('') roun0-tri $ina+g$a . 2"2"2" $s
SanJose#
Note Dou can b'pass e+tene ping moe an speci"' a source aress using one o" these commans
SanJose# ping 10.&.&.1 source 10.1.1.1
or
2*13 Cisco an4or its a""i$iates% A$$ rights reser!e% This ocument is Cisco Pub$ic% Page 3 o" 11
CCNPv7 ROUTE Lab 7-2, Using the AS_PATH Attribute
AS ./*** is a pri!ate AS, #hich shou$ not be pub$ic$' a!ertise on the &nternet% 6ther#ise, c$ients o" t#o
interconnecte &SPs ha!ing the same pri!ate AS number #ou$ see their o#n AS in the route a!ertisements o"
each other% As a resu$t, each c$ient #ou$ incorrect$' conc$ue that the a!ertisement came "rom itse$" an it #ou$
ignore it%
e% Con"igure &SP to strip the pri!ate AS numbers "rom BGP routes e+change #ith San=ose using the "o$$o#ing
commans%
ISP(config)# router bgp &00
ISP(config-router)# neighbor 12.1!".1.5 remo'e-pri'ate-as
"% A"ter issuing these commans, use the clear ip bgp 1 comman on &SP to reestab$ish the BGP re$ationship
bet#een the three routers% ait se!era$ secons an then return to San=ose to chec its routing tab$e%
Note The clear ip bgp 1 so%t comman can a$so be use to "orce each router to resen its BGP tab$e%
ISP# clear ip bgp (
ISP#
>Se " 1"!''1 BGP-'-%,JC@%<G/ neighbor 1722!11" ,o4n ?ser reset
>Se " 1"!''1 BGPNS/SSI:<-'-%,JC@%<G/ neighbor 1722!11" IP+! ?nicast
toolog= base re$o+e0 fro$ session ?ser reset
>Se " 1"!''1 BGP-'-%,JC@%<G/ neighbor 121&"1' ,o4n ?ser reset
>Se " 1"!''1 BGPNS/SSI:<-'-%,JC@%<G/ neighbor 121&"1' IP+! ?nicast
toolog= base re$o+e0 fro$ session ?ser reset
>Se " 1"!!'1' BGP-'-%,JC@%<G/ neighbor 1722!11" ?
>Se " 1"!!'1 BGP-
ISP#'-%,JC@%<G/ neighbor 121&"1' ?
ISP#
2*13 Cisco an4or its a""i$iates% A$$ rights reser!e% This ocument is Cisco Pub$ic% Page / o" 11
CCNPv7 ROUTE Lab 7-2, Using the AS_PATH Attribute
g% Eo# chec the BGP tab$e on San=ose% The AS_ PATH to the 1*%)%)%* net#or shou$ be AS )**% &t no $onger has
the pri!ate AS in the path%
SanJose# sho# ip bgp
BGP table +ersion is local router I, is 1111
Status co0es s suresse0 0 0a$e0 h histor= > +ali0 6 best i - internal
r RIB-failure S Stale $ $ultiath b bac*u-ath f RF-;ilter
best-eternal a a00itional-ath c RIB-co$resse0
:rigin co0es i - IGP e - /GP H - inco$lete
RPLI +ali0ation co0es +ali0 I in+ali0 < <ot foun0
AS-path access $ists are rea $ie regu$ar access $ists% The statements are rea seFuentia$$', an there is an imp$icit
en' at the en% 0ather than matching an aress in each statement $ie a con!entiona$ access $ist, AS path access
$ists match on something ca$$e a regu$ar e+pression% 0egu$ar e+pressions are a #a' o" matching te+t patterns an
ha!e man' uses% &n this case, 'ou #i$$ be using them in the AS path access $ist to match te+t patterns in AS paths%
a% Con"igure a specia$ in o" access $ist to match BGP routes #ith an AS_PATH attribute that both begins an ens
#ith the number 1**% nter the "o$$o#ing commans on &SP%
ISP(config)# ip as-path access-list 1 deny )100*
ISP(config)# ip as-path access-list 1 permit .(
The "irst comman uses the 5 character to inicate that the AS path must begin #ith the gi!en number 1**% The 6
character inicates that the AS_PATH attribute must a$so en #ith 1**% ssentia$$', this statement matches on$'
paths that are source "rom AS 1**% 6ther paths, #hich might inc$ue AS 1** a$ong the #a', #i$$ not match this
$ist%
&n the secon statement, the & ;perio< is a #i$car, an the 1 ;asteris< stans "or a repetition o" the #i$car%
Together, &1 matches an' !a$ue o" the AS_PATH attribute, #hich in e""ect permits an' upate that has not been
enie b' the pre!ious access*list statement%
2*13 Cisco an4or its a""i$iates% A$$ rights reser!e% This ocument is Cisco Pub$ic% Page . o" 11
CCNPv7 ROUTE Lab 7-2, Using the AS_PATH Attribute
http44###%cisco%com4c4en4us4t4ocs4ios412_24termser!4con"iguration4guie4"ters!_c4tc"aapre%htm$
http44###%cisco%com4c4en4us4support4ocs4ip4borer-gate#a'-protoco$-bgp41)7/3-2.%htm$
b% App$' the con"igure access $ist using the neig'bor comman #ith the %ilter*list option%
ISP(config)# router bgp &00
ISP(config-router)# neighbor 1$2.2%.1.1" filter-list 1 out
The out e'#or speci"ies that the $ist is app$ie to routing in"ormation sent to this neighbor%
c% Use the clear ip bgp 1 comman to reset the routing in"ormation% ait se!era$ secons an then chec the
routing tab$e "or &SP% The route to 1*%1%1%* shou$ be in the routing tab$e%
Note To "orce the $oca$ router to resen its BGP tab$e, a $ess isrupti!e option is to use the clear ip bgp 1 out or
clear ip bgp 1 so%t comman ;the secon comman per"orms both outgoing an incoming route res'nc<%
ISP# clear ip bgp (
ISP#
>Se " 1"!"!1' BGP-'-%,JC@%<G/ neighbor 1722!11" ,o4n ?ser reset
>Se " 1"!"!1' BGPNS/SSI:<-'-%,JC@%<G/ neighbor 1722!11" IP+! ?nicast
toolog= base re$o+e0 fro$ session ?ser reset
>Se " 1"!"!1' BGP-'-%,JC@%<G/ neighbor 121&"1' ,o4n ?ser reset
>Se " 1"!"!1' BGPNS/SSI:<-'-%,JC@%<G/ neighbor 121&"1' IP+! ?nicast
toolog= base re$o+e0 fro$ session ?ser reset
>Se " 1"!"!'1 BGP-'-%,JC@%<G/ neighbor 1722!11" ?
>Se " 1"!"!'' BGP-
ISP#'-%,JC@%<G/ neighbor 121&"1' ?
ISP#
% Chec the routing tab$e "or Cust0tr% &t shou$ not ha!e a rou te to 1*%1%1%* in its routing tab$e%
CustRtr# sho# ip route
5outut o$itte06
2*13 Cisco an4or its a""i$iates% A$$ rights reser!e% This ocument is Cisco Pub$ic% Page 7 o" 11
CCNPv7 ROUTE Lab 7-2, Using the AS_PATH Attribute
e% 0eturn to &SP an !eri"' that the "i$ter is #oring as intene% &ssue the s'o. ip bgp rege)p 5+$$6 comman%
ISP# sho# ip bgp regexp )100*
BGP table +ersion is ! local router I, is 1221
Status co0es s suresse0 0 0a$e0 h histor= > +ali0 6 best i - internal
r RIB-failure S Stale $ $ultiath b bac*u-ath f RF-;ilter
best-eternal a a00itional-ath c RIB-co$resse0
:rigin co0es i - IGP e - /GP H - inco$lete
RPLI +ali0ation co0es +ali0 I in+ali0 < <ot foun0
The output o" this comman sho#s a$$ matches "or the regu$ar e+pressions that #ere use in the access $ist% The
path to 1*%1%1%* matches the access $ist an is " i$tere "rom upates to Cust0tr%
"% 0un the "o$$o#ing Tc$ script on a$$ routers to !eri"' #hether there is connecti!it'% A$$ pings "rom &SP shou$ be
success"u$% San=ose shou$ not be ab$e to ping the Cust0tr $oopbac 1*%)%)%1 or the AE $in 172%23%1%1.4)*%
Cust0tr shou$ not be ab$e to ping the San=ose $oopbac 1*%1%1%1 or the AE $in 152%1.@%1%34)*%
ISP# tclsh
foreach address +
10.1.1.1
10.2.2.1
10.&.&.1
12.1!".1.5
12.1!".1.!
1$2.2%.1.1$
1$2.2%.1.1"
, +
ping *address ,
2*13 Cisco an4or its a""i$iates% A$$ rights reser!e% This ocument is Cisco Pub$ic% Page @ o" 11
CCNPv7 ROUTE Lab 7-2, Using the AS_PATH Attribute
Initial Con%igurations
i shut0o4n
no a00ress 121&"1& 2''2''2''2'2
K
interface Serial1
i a00ress 1722!117 2''2''2''2'2
cloc* rate 12"
no shut0o4n
2*13 Cisco an4or its a""i$iates% A$$ rights reser!e% This ocument is Cisco Pub$ic% Page 5 o" 11
CCNPv7 ROUTE Lab 7-2, Using the AS_PATH Attribute
interface 3oobac*
i a00ress 1111 2''2''2''
K
K
interface Serial
i a00ress 121&"1' 2''2''2''2'2
cloc* rate 12"
no shut0o4n
K
router bg 1
bg log-neighbor-changes
net4or* 111 $as* 2''2''2''
neighbor 121&"1& re$ote-as
K
en0
2*13 Cisco an4or its a""i$iates% A$$ rights reser!e% This ocument is Cisco Pub$ic% Page 1* o" 11
CCNPv7 ROUTE Lab 7-2, Using the AS_PATH Attribute
2*13 Cisco an4or its a""i$iates% A$$ rights reser!e% This ocument is Cisco Pub$ic% Page 11 o" 11