BGP的MED试验

拓扑:

 

 

MED是指在本地配置影响EBGP对等体进站

(默认值是 0 ,越小越优,)

现在要求在R1 R2上做流量分行,即R3 R4到达网络100.100.100.0/24 都是从R1

而到达200.200.200.0/24都是从R2

基本配置之前配置过了,与BGPLP试验是一样的

在没做MED配置前先查看R3 R4bgp路由表

R3#sh  ip bgp

BGP table version is 3, local router ID is 3.3.3.3

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

* i100.100.100.0/24    1.1.1.1                  0    100      0 100 i

*>                  2.2.2.2                                0 100 i

* i200.200.200.0       1.1.1.1                  0    100      0 100 i

*>                  2.2.2.2                  0             0 100 i

 

R4#sh ip bgp

BGP table version is 4, local router ID is 4.4.4.4

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

* i100.100.100.0/24   2.2.2.2                  0    100      0 100 i

*>                  1.1.1.1                  0             0 100 i

*> 200.200.200.0      1.1.1.1                                0 100 i

* i                  2.2.2.2                  0    100      0 100 i

可以看到R3到达100.100.100.0/24以及200.200.200.0/24的下一跳都是2.2.2.2

 

可以看到R4到达100.100.100.0/24以及200.200.200.0/24的下一跳都是1.1.1.1

这是因为EBGP优与IBGP

现在要在R1 R2上做流量分行,R3 R4到达网络100.100.100.0/24 都是从R1即下一跳是(1.1.1.1

而到达200.200.200.0/24都是从R2即下一跳是(2.2.2.2

R1配置:

R1(config)#access-list 1 per 200.200.200.0 0.0.0.255   (在R1上标示出要施加策略的网络)

R1(config)#route-map ccxx per 10

R1(config-route-map)#ma ip add 1

R1(config-route-map)#set metric 1

R1(config-route-map)#exi

R1(config)#route-map ccxx per 20                  (书写空route-map,相当与permit any

R1(config-route-map)#exi

R1(config)#router bgp 100

R1(config-router)#nei 4.4.4.4 route-map ccxx out     (在BGP进程下套用策略)

 

R2配置

R2(config)#access-list 1 per 100.100.100.0 0.0.0.255

R2(config)#route-map ccxx per 10

R2(config-route-map)#match ip address 1

R2(config-route-map)#set metric 1

R2(config-route-map)#exi

R2(config)#route-map ccxx per 20

R2(config-route-map)#exi

R2(config)#router bgp 100

R2(config-router)#nei 3.3.3.3 route-map ccxx out

 

做好后再查看R3 R4BGP路由表:

R3#sh ip bgp

BGP table version is 4, local router ID is 3.3.3.3

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*>i100.100.100.0/24    1.1.1.1                  0    100      0 100 i

*                    2.2.2.2                  1             0 100 i

*> 200.200.200.0       2.2.2.2                  0             0 100 i

 

R4#sh ip bgp

BGP table version is 5, local router ID is 4.4.4.4

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

*> 100.100.100.0/24   1.1.1.1                  0             0 100 i

*  200.200.200.0     1.1.1.1                  1             0 100 i

*>i                 2.2.2.2                  0    100      0 100 i

与想要的结果完全一致!!1 (*^__^*) 嘻嘻……

你可能感兴趣的:(网络,table,Path,NetWork)