Академический Документы
Профессиональный Документы
Культура Документы
Language
as-path-set name
[set elements]
end-set
community-set name
[set elements]
end-set
extcommunity-set name
[set elements]
end-set
Set Object
AS Path Set
Community Set
Extended
Community
Set
Prefix Set
prefix-set name
[set elements]
end-set
rd-set name
[set elements]
end-set
Route
Distinguisher
Set
Route Policy
Object
route-policy name
[policy statements]
end-policy
route-policy myPolicy
if med eq 50 and destination in (10.0.0.0/8) then
set local-preference 50
else
pass
this will pass all other prefixes without changes. Otherwise they would be dropped by the
implicit drop and not appear in the BGP table. Use in case you dont want to drop any prefixes,
but you do want to modify some of them
endif
end-policy
route-policy myPolicy
if med eq 100 and (destination in (10.0.0.0/8) or as-path in (500)) then
prefix-set siteBprefixes
2001:db8:b:10::/64,
2001:db8:b:11::/64
end-set
!
route-policy SiteA-in-R1
if destination in siteBprefixes then
set local-preference 150
pass
not explicitly needed here as any set statement will grant a pass. Just for consistency.
else
set local-preference 200
pass
endif
end-policy
route-policy SiteA-in-R1
if destination in (2001:db8:b:10::/64,2001:db8:b:11::/64) then
set local-preference 150
pass
else
set local-preference 200
pass
endif
end-policy
route-policy allow_all
pass
end-policy
BGP AS 64500
Set weight 40,000
Set local pref 200
Set communities 65000:100
and 65000:200
ISP-1
BGP AS 64501
IBGP
:1
:5
EDGE
:5
:3
AS path prepend, 5x
ISP-2
prefix-set neighbors
2001:db8:1:5::1,
2001:db8:3:5::3
end-set
!
route-policy parameters($weight, $localpref)
set weight $weight
set local-preference $localpref
end-policy
!
route-policy communities
set community (65000:100) additive
set community (65000:200) additive
end-policy
!
route-policy eBGP_neighbor($neighbors, $weight, $localpref)
if next-hop in $neighbors then
apply parameters($weight, $localpref)
apply communities
else
apply parameters(32000, 100)
set community (100:100)
set community (100:200)
endif
end-policy
!
route-policy ISP_1_in
apply eBGP_neighbor(neighbors, 40000, 200)
end-policy
!
route-policy ISP_2_in
apply eBGP_neighbor(neighbors, 60000, 300)
end-policy
!
route-policy ISP_1_out
pass
end-policy
!
route-policy ISP_2_out
if as-path in (ios-regex '^$') then
prepend as-path 64501 5
endif
end-policy
!
!
!
router bgp 64501
bgp router-id 5.5.5.5
address-family ipv6 unicast
network 2001:db8::5:5:5:5/128
network 2001:db8:a:10::/64
network 2001:db8:a:11::/64
!
neighbor 2001:db8:1:5::1
remote-as 64500
keychain EBGP
address-family ipv6 unicast
route-policy ISP_1_in in
route-policy ISP_1_out out
!
!
neighbor 2001:db8:3:5::3
remote-as 64500
address-family ipv6 unicast
route-policy ISP_2_in in
route-policy ISP_2_out out
!
RD version: 181
Next Hop
2001:db8::1:1:1:1/128
2001:db8:1:5::1
*>
*
200
40000 64500 i
300
60000 64500 i
2001:db8:1:5::1
200
40000 64500 i
2001:db8:3:5::3
300
60000 64500 i
200
40000 64500 i
300
60000 64500 i
2001:db8:1:5::1
200
40000 64500 i
2001:db8:3:5::3
300
60000 64500 i
2001:db8:3:5::3
2001:db8::2:2:2:2/128
*>
*
2001:db8::3:3:3:3/128
2001:db8:1:5::1
*>
*
2001:db8:3:5::3
2001:db8::4:4:4:4/128
*>
(output omitted)
2001:db8::1:1:1:1/128
bRIB/RIB
SendTblVer
Speaker
176
176
RD version: 106
Next Hop
*>i2001:db8::5:5:5:5/128
2001:db8::1:1:1:1
0
*
2001:db8:3:5::5
100
0
0 64501 i
0 64501 64501 64501
2001:db8:3:5::5
100
0
0 64501 i
0 64501 64501 64501
2001:db8:3:5::5
100
0
0 64501 i
0 64501 64501 64501
RP/0/0/CPU0:R7#edit ?
as-path-set
edit an as-path-set
community-set
edit a community-set
extcommunity-set
edit an extended-community-set
policy-global
prefix-set
edit a prefix-set
rd-set
edit a rd-set
route-policy
edit a route-policy
tag-set
edit a tag-set
nano
vim
<cr>
RP/0/0/CPU0:R7#edit route-policy setOrigin vim
(at this point we get a VI based editor with the policy, then we save and exit)
Wed Jan 21 23:34:05.095 UTC
[OK]
"/dev/shmem/rpl_edit.778520" 4 lines, 53 characters written
Proceed with commit (yes/no/cancel)? [cancel]: yes
Parsing.cy
53 bytes parsed in 1 sec (51)bytes/sec
Committing.
Prepared commit in 0 sec
~
1 items committed in 1 sec (0)items/sec
Updating.
Updated Commit database in 1 sec