Question - 1 Explain BGP MED attribute.
- Always lowest MED will be preferable.
- It is Optional non-transitive attribute.
- MED is exchanged between AS.
- It can be used to advertise to your neighbors to influence how they should enter in your AS
- Always MED is advertised to all router within the neighboring AS, note that it will not advertised to any other AS
Question - 2 How can we configure BGP MED attribute ?
Router3 and Router2 are both in AS 20 and advertising same network (5.5.5.0/24) to Router1.
Initially we will configure the BGP between three routers.
- Router1 Configuration -
Router1#show running-config
interface Ethernet1/0
ip address 192.167.23.1 255.255.255.0
half-duplex
!
interface Ethernet2/0
ip address 192.167.24.1 255.255.255.0
half-duplex
!
router bgp 10
no synchronization
bgp log-neighbor-changes
neighbor 192.167.23.2 remote-as 20
neighbor 192.167.24.3 remote-as 20
no auto-summary
- Router2 Configuration -
Router2#show running-config
!
interface Loopback1
ip address 5.5.5.2 255.255.255.0
!
interface Ethernet1/0
ip address 192.167.23.2 255.255.255.0
half-duplex
!
router bgp 20
no synchronization
bgp log-neighbor-changes
network 5.5.5.0 mask 255.255.255.0
neighbor 192.167.23.1 remote-as 10
no auto-summary
- Router3 Configuration -
Router3#show running-config
interface Loopback1
ip address 5.5.5.3 255.255.255.0
!
interface Ethernet2/0
ip address 192.167.24.3 255.255.255.0
half-duplex
!
router bgp 20
no synchronization
bgp log-neighbor-changes
network 5.5.5.0 mask 255.255.255.0
neighbor 192.167.24.1 remote-as 10
no auto-summary
Output -
You can see in this output, Router1 prefer 192.167.23.2 as its path to reach network 5.5.5.0/24, right now MED is 0.
Now we will change the MED value
Router2#configure terminal
Router2(config)#route-map MED-VALUE permit 10
Router2(config-route-map)#set metric 800
Router2(config-route-map)#exit
Router2(config)#router bgp 20
Router2(config-router)#neighbor 192.167.23.1 route-map MED-VALUE out
Router3#configure terminal
Router3(config)#route-map MED-VALUE permit 10
Router3(config-route-map)#set metric 700
Router3(config-route-map)#exit
Router3(config)#router bgp 20
Router3(config-router)#neighbor 192.167.24.1 route-map MED-VALUE out
Output -
You can see in this output, now Router1 prefer 192.167.24.3 as its path to reach network 5.5.5.0/24, because it has lower MED - 700
- Router1 Configuration -
interface Ethernet1/0
ip address 192.167.23.1 255.255.255.0
half-duplex
!
interface Ethernet2/0
ip address 192.167.24.1 255.255.255.0
half-duplex
!
router bgp 10
no synchronization
bgp log-neighbor-changes
neighbor 192.167.23.2 remote-as 20
neighbor 192.167.24.3 remote-as 20
no auto-summary
- Router2 Configuration -
Router2#show running-config
!
interface Loopback1
ip address 5.5.5.2 255.255.255.0
!
interface Ethernet1/0
ip address 192.167.23.2 255.255.255.0
half-duplex
!
router bgp 20
no synchronization
bgp log-neighbor-changes
network 5.5.5.0 mask 255.255.255.0
neighbor 192.167.23.1 remote-as 10
no auto-summary
- Router3 Configuration -
interface Loopback1
ip address 5.5.5.3 255.255.255.0
!
interface Ethernet2/0
ip address 192.167.24.3 255.255.255.0
half-duplex
!
router bgp 20
no synchronization
bgp log-neighbor-changes
network 5.5.5.0 mask 255.255.255.0
neighbor 192.167.24.1 remote-as 10
no auto-summary
Output -
You can see in this output, Router1 prefer 192.167.23.2 as its path to reach network 5.5.5.0/24, right now MED is 0.
Now we will change the MED value
Router2#configure terminal
Router2(config)#route-map MED-VALUE permit 10
Router2(config-route-map)#set metric 800
Router2(config-route-map)#exit
Router2(config)#router bgp 20
Router2(config-router)#neighbor 192.167.23.1 route-map MED-VALUE out
Router3#configure terminal
Router3(config)#route-map MED-VALUE permit 10
Router3(config-route-map)#set metric 700
Router3(config-route-map)#exit
Router3(config)#router bgp 20
Router3(config-router)#neighbor 192.167.24.1 route-map MED-VALUE out
Output -
You can see in this output, now Router1 prefer 192.167.24.3 as its path to reach network 5.5.5.0/24, because it has lower MED - 700
0 comments:
Post a Comment
If you like my posts then please comment and if you don’t like then please suggest me to improve, and if you have any query related to post then please text me through the comment box or mail me on upadhyayambition@gmail.com , I will try my best to solve your queries as soon as possible.