配置LOCAL_PREF和MED属性

使用 LOCAL_PREF MED 属性
一、 实验目的
使用 local_pref med 属性改变 bgp 行为,并且实现路由选择策略。
二、 拓扑结构图
三、 实验步骤
1.       基本接口配置
步骤略
实验结果
isp1b#ping  10.1.1 .1  isp1b#ping 172.24.1.17
isp 1a #ping 192.168.1.6
 
2.       配置 bgp
sanjose3(config-if)#router bgp 100
sanjose3(config-router)#neigh 192.168.1.5 remote-as 200
sanjose3(config-router)#neigh 172.24.1.18 remote-as 400
sanjose3(config-router)#net 200.100.50.0
isp 1a
router bgp 200
network 10.1.1 .0 mask 255.255.255.252
 neighbor 10.1.1 .2 remote-as 200
 neighbor 192.168.1.6 remote-as 100
 
isp1b
router bgp 400
network 10.1.1 .0 mask 255.255.255.252
 neighbor 10.1.1 .1 remote-as 200
 neighbor 172.24.1.17 remote-as 100
 
3.       配置本地优先级属性
isp 1a #show ip route
B    200.100.50.0/24 [20/0] via 192.168.1.6, 00:00:21
     10.0.0 .0/30 is subnetted, 1 subnets
C       10.1.1 .0 is directly connected, Serial0/1
     192.168.1.0/30 is subnetted, 1 subnets
C       192.168.1.4 is directly connected, Serial0/0
 
isp 1a #show ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*> 10.1.1 .0/30      0.0.0 .0                  0         32768 i
*                   192.168.1.6                            0 100 400 i
*                   10.1.1 .2                 0             0 400 i
*> 200.100.50.0     192.168.1.6              0             0 100 i
*                   10.1.1 .2                               0 400 100 i
通过配置本地优先级属性,是路由器采用另一条路径
 
isp 1a (config)#route-map viaAS400         
isp 1a (config-route-map)#set local-preference 150
isp 1a (config-route-map)#router bgp 200
isp 1a (config-router)#neigh 10.1.1 .2 route-map viaAS 400 in
 
查看结果:
isp 1a #show ip route
B    200.100.50.0/24 [20/0] vi a 10.1.1 .2, 00:00:06
     10.0.0 .0/30 is subnetted, 1 subnets
C       10.1.1 .0 is directly connected, Serial0/1
     192.168.1.0/30 is subnetted, 1 subnets
C       192.168.1.4 is directly connected, Serial0/0
 
isp 1a #show ip bgp
 
   Network          Next Hop            Metric LocPrf Weight Path
*  10.1.1 .0/30      192.168.1.6                            0 100 400 i
*                   10.1.1 .2                 0    150      0 400 i
*>                  0.0.0 .0                  0         32768 i
*  200.100.50.0     192.168.1.6              0             0 100 i
 
isp 1a #show ip bgp 200.100.50.0
BGP routing table entry for 200.100.50.0/24, version 3
Paths: (2 available, best #2, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  192.168.1.6
  100
    192.168.1.6 from 192.168.1.6 (200.100.50.1)
      Origin IGP, metric 0, localpref 100, valid, external
  400 100
    10.1.1 .2 from 10.1.1.2 (172.24.1.18)
      Origin IGP, localpref 150, valid, external, best  可以发现本地优先级改变!!确实可以启动改变路由选择的作用,从本地优先级高的走!!
4.       配置 MED 属性
配置 sanjose3 med 值使它向不同到 AS 发送不同的度量值,改变路由选择
isp 1a (config)#route-map badmetric
isp 1a (config-route-map)#set metric 150
isp 1a (config-route-map)#router bgp 200
isp 1a (config-router)#nei 192.168.1.6 route-map badmetric out
 
isp1b(config)#route-map badmetric
isp1b(config-route-map)#set metric 200
isp1b(config-route-map)#router bgp 400
isp1b(config-router)#neigh 172.24.1.17 route
isp1b(config-router)#neigh 172.24.1.17 route-map badmetric out
 
sanjose3(config)#router bgp 100
sanjose3(config-router)#bgp always-compare-med
 
查看实验结果:
sanjose3#show ip bgp
   Network          Next Hop            Metric LocPrf Weight Path
*  10.1.1 .0/30      172.24.1.18            200             0 400 i
*>                  192.168.1.5            150             0 200 i
*> 200.100.50.0     0.0.0 .0                  0         32768 i
 
sanjose3#show ip route
C    200.100.50.0/24 is directly connected, FastEthernet1/0
     172.24.0.0/30 is subnetted, 1 subnets
C       172.24.1.16 is directly connected, Serial0/1
     10.0.0 .0/30 is subnetted, 1 subnets
B       10.1.1 .0 [20/150] via 192.168.1.5, 00:00:44
     192.168.1.0/30 is subnetted, 1 subnets
C       192.168.1.4 is directly connected, Serial0/0
实验成功,从 med 值低的走,改变 med 值可以改变 ebgp 的路由选择!
 

你可能感兴趣的:(Cisco,实验,思科,BGP,ccnp,bgp属性)