BGP MED for inbound and outbound traffic

#BGP#MED#Filter#IN#OUT #Upload#Download#control

#applied manipulation in Router1 only

router bgp 1
bgp log-neighbor-changes
network 0.0.0.0
neighbor 192.168.12.2 remote-as 2
neighbor 192.168.12.2 route-map PRM-IN in
neighbor 192.168.12.2 route-map PRM-OUT out
neighbor 192.168.21.2 remote-as 2
neighbor 192.168.21.2 route-map SCN-IN in
neighbor 192.168.21.2 route-map SCN-OUT out

ip prefix-list PRM-IN seq 5 permit 2.2.2.2/32
ip prefix-list PRM-OUT seq 5 permit 0.0.0.0/0
ip prefix-list SCN-IN seq 5 permit 2.2.2.2/32
ip prefix-list SCN-OUT seq 5 permit 0.0.0.0/0

route-map PRM-OUT permit 10
match ip address prefix-list PRM-OUT
set metric 10
route-map SCN-OUT permit 10
match ip address prefix-list SCN-OUT
set metric 1
route-map PRM-IN permit 10
match ip address prefix-list PRM-IN
set metric 10
route-map SCN-IN permit 10
match ip address prefix-list SCN-IN
set metric 1

#Router 2 applied configuration

router bgp 2
bgp log-neighbor-changes
network 2.2.2.2 mask 255.255.255.255
neighbor 192.168.12.1 remote-as 1
neighbor 192.168.21.1 remote-as 1

#verification from R1 and R2

R1

R1#show ip bgp summary
192.168.12.2 4 2 16 16 4 0 0 00:11:01 1
192.168.21.2 4 2 17 16 4 0 0 00:11:00 1

R1#show ip bgp
Network          Next Hop             Metric     LocPrf     Weight    Path
*> 0.0.0.0         0.0.0.0                   0                                   32768        i
*> 2.2.2.2/32  192.168.21.2        1                                    0             2 i
*                         192.168.12.2        10                                  0             2 i

R1#show ip route
B 2.2.2.2 [20/1] via 192.168.21.2, 00:10:18

#R2 Verification

R2#show ip bgp summary
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
192.168.12.1 4 1 25 25 3 0 0 00:19:01 1
192.168.21.1 4 1 24 25 3 0 0 00:19:00 1

R2#show ip bgp
Network Next Hop Metric LocPrf Weight Path
*> 0.0.0.0 192.168.21.1 1 0 1 i
* 192.168.12.1 10 0 1 i
*> 2.2.2.2/32 0.0.0.0 0 32768 i

R2#show ip route
B* 0.0.0.0/0 [20/1] via 192.168.21.1, 00:18:07
2.0.0.0/32 is subnetted, 1 subnets

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *