Ths is also used to influence return-traffic back into our
ntwk. We can interpret bgp community as
“ Upon agreement, I will tag some routes. Upon receiving it, you will apply some conditions to it and flood it into your network”
“ Upon agreement, I will tag some routes. Upon receiving it, you will apply some conditions to it and flood it into your network”
Rules of Community:
1) BGP communities are not permitted outside your AS unless
u specify nei x.x.x.x send-community
2) BGP community can be in the range of 0-4 billion (232)
3) BGP standard communities are no advertise (can include inter-confederations)
,local (if it is a
confederation,it wld not flood out to oda confederation peers), no-export and internet. With these communities
configured, we do not need to cfg a router map to match these communities since
they are well known communities (check task 4)
4) New bgp community is in the form of AS:nn where nn is
local preference. Default
nn values 17=local pref 50, 18=local pref 100, 21=prepend once before sending
to xternal nei, 22=prepend twice b4 sending to xternal nei, 23=prepend thrice
b4 sending to xternal nei
5) BGP cost community id breaks the tie if cost is the same
(lower is better) and range is 0-255
6) You need to configure ip bgp new-format on both sending
and receiving routers before it can be understood
7) To apply community list, use ‘set community-list
{comm-list name} delete’ on a route-map statement
8) To add to an existing list of tags, use set community {community-tags}
additive
9) We can only have a
maximum of 32 comm /route
Default
config include,
R1.....................
int s0/1
ip add 20.20.20.1 255.255.255.0
no shut
int s0/0
ip add 10.10.10.1 255.255.255.0
no shut
int lo 1
ip add 150.150.150.1 255.255.255.0
no shut
int lo 2
ip add 150.150.151.1 255.255.255.0
no shut
exit
router eigrp 1
network 20.20.20.0 0.0.0.255
network 10.10.10.0 0.0.0.255
no auto-summary
exit
router bgp 100
nei 10.10.10.2 remote-as 222
nei 20.20.20.2 remote-as 100
nei 20.20.20.2 next-hop-self
bgp router-id 150.150.150.1
no synchronization
network 150.150.150.0 mask 255.255.255.0
network 150.150.151.0 mask 255.255.255.0
R2..................
int s0/0
ip add 30.30.30.2 255.255.255.0
no shut
int s0/1
ip add 20.20.20.2 255.255.255.0
no shut
int s0/2
ip add 50.50.50.2 255.255.255.0
no shut
int lo 1
ip add 77.77.77.1 255.255.255.0
no shut
exit
router eigrp 1
network 20.20.20.0 0.0.0.255
network 30.30.30.0 0.0.0.255
network 50.50.50.0 0.0.0.255
no auto-summary
exit
router bgp 100
nei 30.30.30.1 remote-as 100
nei 30.30.30.1 next-hop-self
nei 20.20.20.1 remote-as 100
nei 20.20.20.1 next-hop-self
nei 50.50.50.1 remote-as 111
bgp router-id 77.77.77.1
no synchronization
network 77.77.77.0 mask 255.255.255.0
R3..........................
int s0/0
ip add 40.40.40.1 255.255.255.0
no shut
int s0/1
ip add 30.30.30.1 255.255.255.0
no shut
int lo 1
ip add 99.99.99.1 255.255.255.0
no shut
exit
router eigrp 1
network 30.30.30.0 0.0.0.255
network 40.40.40.0 0.0.0.255
no auto-summary
router bgp 100
nei 40.40.40.2 remote-as 222
nei 30.30.30.2 remote-as 100
nei 30.30.30.2 next-hop-self
bgp router-id 99.99.99.1
no synchronization
network 99.99.99.0 mask 255.255.255.0
ISP1..................................
int s0/0
ip add 50.50.50.1 255.255.255.0
no shut
int lo 1
ip add 200.200.200.1 255.255.255.0
no shut
exit
router bgp 111
nei 50.50.50.2 remote-as 100
bgp router-id 200.200.200.1
no synchronization
network 200.200.200.0 mask 255.255.255.0
ISP2..................
int s0/1
ip add 40.40.40.2
255.255.255.0
no shut
int s0/0
ip add 10.10.10.2
255.255.255.0
no shut
int lo 1
ip add 100.100.100.1
255.255.255.0
no shut
int lo 2
ip add 100.100.101.1
255.255.255.0
no shut
int lo 3
ip add 100.100.102.1
255.255.255.0
no shut
int lo 4
ip add 100.100.103.1
255.255.255.0
no shut
exit
router bgp 222
nei 10.10.10.1
remote-as 100
nei 40.40.40.1
remote-as 100
bgp router-id
100.100.100.1
no synchronization
network 100.100.100.0
mask 255.255.255.0
network 100.100.101.0
mask 255.255.255.0
network 100.100.102.0
mask 255.255.255.0
network 100.100.103.0
mask 255.255.255.0
TASKS
Task 1) Using bgp community 222:200, configure ISP2 so that
the traffic from AS 100 towards
100.100.100.0/24 and 100.100.101.0/24 is received from R1, and the traffic
towards 100.100.102.0/24 and 100.100.103.0/24 is received from R3.
Note that R1 must accepts the BGP communities from AS 222 and apply local preference=200 to all prefixes that use the community 222:200
Note that R1 must accepts the BGP communities from AS 222 and apply local preference=200 to all prefixes that use the community 222:200
Presently on R3 bgp
table
R3# sh ip bgp
Network Next
Hop Metric LocPrf Weight Path
*>i100.100.100.0/24 30.30.30.1 0 100 0 222
i
* i 20.20.20.1 0 100 0
222 i
*>i100.100.101.0/24 30.30.30.1 0 100 0 222
i
* i 20.20.20.1 0 100 0 222
i
*>i100.100.102.0/24 30.30.30.1 0 100 0
222 i
* i 20.20.20.1 0 100 0
222 i
*>i100.100.103.0/24 30.30.30.1 0 100 0
222 i
* i 20.20.20.1 0 100 0
222 i
We can
deduce that bgp uses lowest router-id as the determining factor for ntwk
100.100.100.0
ISP2(conf)# ip prefix-list
o seq 5 permit 100.100.102.0/24
ip prefix-list o
seq 10 permit 100.100.103.0/24
ip prefix-list p
seq 5 permit 100.100.100.0/24
ip prefix-list p
seq 10 permit 100.100.101.0/24
route-map
o permit 10
match ip address prefix-list o
set community 222:200
exit
route-map o permit
20
exit
route-map p permit
10
match ip address prefix-list p
set community 222:200
exit
route-map p permit
20
exit
ip bgp new-format
router bgp 222
neighbor 10.10.10.1 send-community
both
neighbor 10.10.10.1 route-map p out
neighbor 40.40.40.1 send-community
both
neighbor 40.40.40.1 route-map o out
On ISP2# sh ip bgp 100.100.100.0
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Advertised to update-groups:
1 2
Local
0.0.0.0 from 0.0.0.0
(100.100.100.1)
Origin IGP, metric 0,
localpref 100, weight 32768, valid, sourced, local, best
we observe that we donot see the community appear. never worry
we observe that we donot see the community appear. never worry
Now going to R1 and R3, we need to allow the new bgp format or else we
wouldn’t be able to see it
R1(conf) ip bgp new-format
R3(conf) ip bgp new-format
Now,
lets show that R3 and R1 are receiving the community tags
R1# sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 15
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Advertised to update-groups:
1
222, (received & used)
10.10.10.2 from 10.10.10.2
(100.100.100.1)
Origin IGP, metric 0,
localpref 100, valid, external, best
Community: 222:200
R3# sh ip bgp 100.100.102.0
BGP routing table entry for 100.100.102.0/24, version 10
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Advertised to update-groups:
1
222
40.40.40.2 from 40.40.40.2
(100.100.100.1)
Origin IGP, metric 0,
localpref 100, valid, external, best
Community: 222:200
Note
that routers would accept tags by default, Now let R1 configure it to apply
R1(conf) ip community 1 permit 222:200
route-map
p permit 10
match community 1
set local-preference 200
exit
route-map p permit
20
exit
router bgp 100
nei
10.10.10.2 route-map p in
do clear ip bgp
10.10.10.2 in
do clear ip bgp
10.10.10.2 out
R3(conf) ip community 1 permit 222:200
route-map o permit
10
match community 1
set local-preference 200
exit
route-map o permit 20
exit
router bgp 100
nei
40.40.40.2 route-map p in
do clear ip bgp
40.40.40.2 in
do clear ip bgp
40.40.40.2 out
To prove this config, lets view R2 bgp table
R2# sh
ip bgp
Network Next
Hop Metric LocPrf
Weight
Path
* i100.100.100.0/24 30.30.30.1 0 100 0
222 i
*>i 20.20.20.1 0 200 0
222 i
* i100.100.101.0/24 30.30.30.1 0 100 0
222 i
*>i
20.20.20.1 0 200 0
222 i
*>i100.100.102.0/24 30.30.30.1 0 200 0 222
i
* i 20.20.20.1 0 100 0
222 i
*>i100.100.103.0/24 30.30.30.1 0 200 0
222 i
* i 20.20.20.1 0 100 0
222 i
R1# sh ip bgp community-list 1
Network Next
Hop Metric LocPrf Weight Path
*> 100.100.100.0/24 10.10.10.2 0 200 0
222 i
*> 100.100.101.0/24 10.10.10.2 0 200 0
222 i
Task 2) Cfg on AS 222 additional
tags to be sent to R1 and R3 (500:100, 222:500)
ISP2(conf) no route-map
p permit 10
route-map
p permit 10
match ip address
prefix-list p
set community
222:200 222:500 500:100
do clear ip bgp *
in
do clear ip bgp *
out
Lets confirm that R1 would be receiving this community-tags
R1# sh ip bgp 100.100.100.0
BGP routing table entry for 100.100.100.0/24, version 15
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x880
Advertised to update-groups:
1
222
BGP routing table entry for 100.100.100.0/24, version 15
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x880
Advertised to update-groups:
1
222
10.10.10.2 from 10.10.10.2
(100.100.100.1)
Origin IGP, metric 0,
localpref 200, valid, external, best
Community: 222:200 222:500 500:100
We can deduce that ip-community list does not filter out
tags. To filter out tags we need to cfg a set comm-list { p
} delete
Similarly we can cfg ,
Similarly we can cfg ,
ISP2(conf)# route-map o
permit 10
set community 500:100 222:500
additive
This allows us to add the tags without deleting the
route-map statement like we did above
Task 3) Cfg on AS 100 to filter
out all tags aside from 222:200
We would need to create another
community-list again but we must note that we are appling ‘set comm-list {name
of community} delete’, so
we have to deny what will be permitted
R2(conf)# ip community-list expanded w deny
222:200
ip community-list expanded w permit
.*
Going back to the route-map created, route-map o permit 10
set comm-list w delete
do
clear ip bgp * in
do
clear ip bgp * out
To confirm what we have just configured,
R1# sh ip bgp 100.100.102.0
10.10.10.2 from 10.10.10.2
(100.100.100.1)
Origin IGP, metric 0,
localpref 400, valid, external, best
Community: 222:200
Task 4) Cfg ISP1 such that 200.200.200.0 is not advertised
to any oda AS aside from AS 100
Currently on ISP2
ISP2# sh ip bgp
* 200.200.200.0
10.10.10.1
0 100 111 i
*> 40.40.40.1 0 100 111 i
Now lets configure ISP1 to send a no-export tag to R2
ISP1(conf)# ip prefix-list
p permit 200.200.200.0/24
route-map
p permit 10
match
ip add prefix-list p
set community no-export
exit
route-map
p permit 20
exit
ip bgp new-format
router bgp 111
nei 50.50.50.2 send-community both
nei 50.50.50.2 route-map p out
On AS 100, we need to allow the new bgp community format
R2(conf)# ip bgp new-format
We also need to cfg R2 to be able to send these
community-tags to R1 and R3
R2(conf)# router bgp
100
nei 20.20.20.1 send-community both
nei 30.30.30.1 send-community both
To confirm our config
ISP2# sh ip bgp
{We do not see ntwk
200.200.200.0}
No comments:
Post a Comment