Sie sind auf Seite 1von 7

BGP POLICY ROUTING

AS65010: 192.168.1.0/24 for R2, R4, R6 and Loopbacks, 192.168.3.0/24 for R6


ip subnet mask description
10.0.1.0 255.555.255.252 wan r1-r2
10.0.1.4 255.555.255.252 wan r3-r4
192.168.0.1 255.555.255.255 loop r1
192.168.0.3 255.555.255.255 loop r3
192.168.0.5 255.555.255.255 loop r5
192.168.0.8 255.555.255.252 wan r1-r5
192.168.0.12 255.555.255.252 wan r3-r5
192.168.2.0 255.555.255.0 LAN r5-WS2
192.168.1.2 255.555.255.255 loop r2
192.168.1.4 255.555.255.255 loop r4
192.168.1.6 255.555.255.255 loop r6
192.168.1.8 255.555.255.252 wan r2-r6
192.168.1.12 255.555.255.252 wan r4-r6
192.168.3.0 255.555.255.0 LAN r6-WS1
PART 1
Set up network runing BGP and OSPF
Verify operation
!
Router 1 BGP AS65000 OSPF 65000
!
interface Loop 0
ip address 192.168.0.1 255.255.255.255
interface Fx/x
description 10.0.1.x WAN R1 to R2
ip address 10.0.1.1 255.255.255.252
interface fx/x
description iBGP link R1 to R5
ip address 192.168.0.9 255.255.255.252
!
router ospf 65000
network 192.168.0.1 0.0.0.0 area 0 !loop
network 192.168.0.8 0.0.0.3 area 0 !!??needed for r1-r5?
!
router BGP 65000
-------------------------------------------------------------------------neighbor 192.168.0.3 remote-as 65000
neighbor 192.168.0.3 update-source Loopback0
neighbor 192.168.0.3 next-hop-self
----------------------------------------------------------------------------neighbor 10.0.1.2 remote-as 65010
neighbor 192.168.0.5 remote-as
neighbor 192.168.0.5 update-source loopback 0
neighbor 192.168.0.5 next-hop self
network 192.168.2.0 mask 255.255.255.0
!
!
Router 3 BGP AS65000 OSPF 65000
interface Loop 0
ip address 192.168.0.3 255.255.255.255
interface Fx/x
description 10.0.1.x WAN R3 to R4
ip address 10.0.1.5 255.255.255.252

WS1

interface fx/x
description iBGP link R3 to R5
ip address 192.168.0.13 255.255.255.252
!
router ospf 65000
network 192.168.0.3 0.0.0.0 area 0 !loop
network 192.168.0.12 0.0.0.3 area 0 !!??needed for r3-r5?
!
router BGP 65000
neighbor 10.0.1.4 remote-as 65010
neighbor 192.168.0.5 remote-as 65000
neighbor 192.168.0.5 update-source loopback 0
neighbor 192.168.0.5 next-hop self
network 192.168.2.0 mask 255.255.255.0
!
Router 5 BGP AS65000 OSPF 65000
interface Loop 0
ip address 192.168.0.5 255.255.255.255
interface Fx/x
description iBGP link R3 to R5
ip address 192.168.0.14 255.255.255.252
interface fx/x
description iBGP link R1 to R5
ip address 192.168.0.10 255.255.255.252
interface int fx/x
description LAN WS2 connection 192.168.2.0/24
ip address 192.168.2.1 255.255.255.0
!
router ospf 65000
network 192.168.0.5 0.0.0.0 area 0 !loopback
network 192.168.2.0 0.0.0.255 area 0 ! LAN
network 192.168.0.8 0.0.0.3 area 0 !!??needed for r1-r5?
network 192.168.0.12 0.0.0.3 area 0 !!??needed for r3-r5?
!
router BGP 65000
neighbor 192.168.0.1 remote-as 65000
neighbor 192.168.0.1 update-source loopback 0
neighbor 192.168.0.1 next-hop self
neighbor 192.168.0.3 remote-as 65000
neighbor 192.168.0.3 update-source loopback 0
neighbor 192.168.0.3 next-hop self
!iBGP doesnt need network commands
!
***********************************************
!
Router 2 BGP AS65010 OSPF 65010
interface Loop 0
ip address 192.168.1.2 255.255.255.255
interface fx/x
description 10.0.1.x WAN R1 to R2
ip address 10.0.1.2 255.255.255.252
interface fx/x
description iBGP link R2 to R6
ip address 192.168.1.9 255.255.255.252
!
router ospf 65010
network 192.168.1.2 0.0.0.0 area 0 !loop
network 192.168.1.8 0.0.0.3 area 0 !wan R2 to R6
!
router bgp 65010

neighbor 10.0.1.1 remote-as 65000


neighbor 192.168.1.6 remote-as 65010
neighbor 192.168.1.6 update-source loopback 0
neighbor 192.168.1.6 next-hop self
network 192.168.3.0 mask 255.255.255.0
!
!
Router 4 BGP AS65010 OSPF 65010
interface Loop 0
ip address 192.168.1.4 255.255.255.255
interface fx/x
description iBGP link R4 to R6
ip address 192.168.1.13 255.255.255.252
interface Fx/x
description 10.0.1.x WAN R3 to R4
ip address 10.0.1.6 255.255.255.252
!
router ospf 65010
network 192.168.1.4 0.0.0.0 area 0 !loop
network 192.168.1.12 0.0.0.3 area 0 !wan R4 to R6
!
router bgp 65010
neighbor 10.0.1.5 remote-as 65000
neighbor 192.168.1.6 remote-as 65010
neighbor 192.168.1.6 update-source loopback 0
neighbor 192.168.1.6 next-hop self
network 192.168.3.0 mask 255.255.255.0
!
!
Router 6 BGP AS65010 OSPF 65010
interface Loop 0
ip address 192.168.1.6 255.255.255.255
interface fx/x
description iBGP link R2 to R6
ip address 192.168.1.10 255.255.255.252
interface fx/x
description iBGP link R4 to R6
ip address 192.168.1.14 255.255.255.252
interface int fx/x
description LAN WS1 connection 192.168.3.0/24
ip address 192.168.3.1 255.255.255.0
!
router ospf 65010
network 192.168.1.6 0.0.0.0 area 0 !loop
network 192.168.3.0 0.0.0.255 area 0 !lan
network 192.168.1.8 0.0.0.3 area 0 !wan R2 to R6
network 192.168.1.12 0.0.0.3 area 0 !wan R4 to R6
!
router bgp 65010
neighbor 192.168.1.2 remote-as 65010
neighbor 192.168.1.2 update-source loopback 0
neighbor 192.168.1.2 next-hop self'
neighbor 192.168.1.4 remote-as 65010
neighbor 192.168.1.4 update-source loopback 0
neighbor 192.168.1.4 next-hop self
!iBGP doesnt need network commands
!
*************************************************
verify

trace from ws2 to ws1


trace from ws1 to ws2
show ip bgp summary
sh ip bgp
sh ip bgp rib-failure
sh ip bgp ne
sh ip ospf ne
sh ip ospf data
sh ip route
*look from r5 or r6 to see path out of AS
look at path vectors and contents of paths
look at attributes
*try changing the
weight
local pref
as path
ospf cost of one interface
see if r5 or r6 changes path out of as, why
*************************************************
PART 2 Local Pref, this is a local attribute, non transitive and is not passed t
o other ASs.
This is used to determine best path out of an AS to a destination when more than
one path exists,
so this will be set on R1&R3 in AS65000 for routes to 192.168.1.0 from as65010
and on R2&R4 in AS65010 for routes to 192.168.0.0 from as65000
configure local pref on r1 and r3 to force the opposite path to be taken between
ws2 and ws1
trace ws1 to ws2
trace ws2 to ws1
*************************************************
Setting Local preference
Default for a router:
bgp default local-preference 200
Local preference on an interface:
Neighbor 192.68.5.2 remote-as 2
Neighbor 192.68.5.2 route-map SETLOCAL in
Route-map SETLOCAL permit 10
Set local-preference 300
Setting MED
This example sets MED on network 172.16.1.0 to 50
Neighbor 192.68.5.2 remote-as 2
Neighbor 192.68.5.2 route-map SETMETRIC out
Route-map SETMETRIC permit 10
Match ip address 1
Set metric 50
Access list 1 permit 172.16.1.0 0.0.0.255
If MED was to be set to 50 on all networks:
Access list 1 permit any
*************************************************

figure out which path ws1 takes to get to ws2


!!!IF ALL THINGS ARE EQUAL, the the tie breaker is route with lowest neighbor ip
address,
or lowest bgp rtr id
1 highest weight
2 highest local pref
3 originated by local router
4 shortest as-path
5 lowest origin code
6 lowest med
7 prefer ebgp over ibgp
8 prefer the closest igp neighbor
9 prefer the oldest route for ebgp paths
10 prefer the path with the lowest neighbor BGP router id
11 prefer the route with the lowest neighbor IP address

so it should prefer 10.) BGP router id or 11.) lowest neighbor IP address


R1 out of as65000
R2 out of as65010
so we should change it to prefer
r3
r4
VERFIY, look at sh ip bgp to see what the attributes are for r1, r2, r3, r4
PART 2.2 CONFIGURE LOCAL PREF FOR DEFAULT FOR ALL NETWORKS
2. Configure local preference on R1 and R3 to force the opposite path
to be taken between WS2 and WS1. Configure it using default local preference
for all networks. Clear the BGP process to force the changes to occur.
Route-map SETLOCAL permit 10
Set local-preference 200
!!match ip (use an acl to select routes?)
Route-map SETLOCAL permit 20
R1
router BGP 65000
!dont use?!neighbor 10.0.1.2 route-map SETLOCAL in
R3
router BGP 65000
neighbor 10.0.1.4 route-map SETLOCAL in
PART 2.4 SET LOCAL PREF FOR ONLY the WS2 LAN
4. Configure local preference on R2 and R4 for
WS1 and WS2. Configure it using route maps to
the
LAN with WS2 connected. Clear the BGP process
Verify the changes in path vectors and routing
access-list 10 permit 192.168.2.0

force the opposite path between


match the address range only for
to force the changes to occur.
table.

Route-map SETLOCAL permit 10


match ip-address 10
Set local-preference 300
Route-map SETLOCAL permit 20 !ALLOW ALL OTHER TO DEFAULT
R2
router bgp 65010
!dont use?!neighbor 10.0.1.1 route-map SETLOCAL in
!
R4
router bgp 65010
neighbor 10.0.1.5 route-map SETLOCAL in
*REMOVE local pref configs, retest
R1
router BGP 65000
no !dont use?!neighbor 10.0.1.2 route-map SETLOCAL in
R3
router BGP 65000
no neighbor 10.0.1.4 route-map SETLOCAL in
Route-map SETLOCAL permit 10
Set local-preference 300
R2
router bgp 65010
no !dont use?!neighbor 10.0.1.1 route-map SETLOCAL in
!
R4
router bgp 65010
no neighbor 10.0.1.5 route-map SETLOCAL in
*************************************************
Multi Exit Descriminator
MED is passed to other ASes, the local AS tells the adjacent AS which path it wa
nts its neighbor to use to access it,
so this attribute will be passed from as65000 to 65010 and vice versa
LOWEST MED is PREFERRED
traceroute, figure out which path is preferred, and switch it.
for AS65000 to tell AS65010 to prefer a path to 192.168.2.0
Route-map SETMETRIC permit 10
Match ip address 1
Set metric 50
Access list 1 permit 192.168.2.0 0.0.0.255
R1
router BGP 65000
Neighbor 10.0.1.2 route-map SETMETRIC out
R2
router BGP 65000
Neighbor 10.0.1.4 route-map SETMETRIC out
******

for AS65010 to tell AS65000 to prefer a path to 192.168.1.0


Route-map SETMETRIC permit 10
Match ip address 1
Set metric 50
Access list 1 permit 192.168.1.0 0.0.0.255
R2
router BGP 65010
Neighbor 10.0.1.1 route-map SETMETRIC out
R4
router BGP 65010
Neighbor 10.0.1.5 route-map SETMETRIC out
trace, prove that the path switched due to med
Leave configs in place
*************************************************
priority of local pref and med
local pref=3 in priority
med=6 in priority
LOCAL PREF WILL BE PREFERRED IN LOCAL AS, BUT IS NOT TRANSITIVE
MED IS TRANSITIVE, SO WILL BE PREFERRED IN REMOTE AS
replace local pref configs
R1
router BGP 65000
!dont use?!neighbor 10.0.1.2 route-map SETLOCAL in
R3
router BGP 65000
neighbor 10.0.1.4 route-map SETLOCAL in
Route-map SETLOCAL permit 10
Set local-preference 300
R2
router bgp 65010
!dont use?!neighbor 10.0.1.1 route-map SETLOCAL in
!
R4
router bgp 65010
neighbor 10.0.1.5 route-map SETLOCAL in
perform traceroute, the local pref shold override the MED,
so the local administrator can have control over his own AS, even if the remote
AS tries to specify path

Das könnte Ihnen auch gefallen