配置LOCAL_PREF和MED属性
原创
©著作权归作者所有:来自51CTO博客作者24547463的原创作品,请联系作者获取转载授权,否则将追究法律责任
使用LOCAL_PREF和MED属性
一、 实验目的
使用local_pref 和med属性改变bgp行为,并且实现路由选择策略。
二、 拓扑结构图
三、 实验步骤
1. 基本接口配置
步骤略
实验结果
isp1b#ping 10.1.1 .1 isp1b#ping 172.24.1.17 通
isp1a #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
isp1a
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. 配置本地优先级属性
isp1a #show ip route
B 200.100.50.0/24 [20/0] via 192.168.1.6, 00:00:21
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
isp1a #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
通过配置本地优先级属性,是路由器采用另一条路径
isp1a (config)#route-map viaAS400
isp1a (config-route-map)#set local-preference 150
isp1a (config-route-map)#router bgp 200
isp1a (config-router)#neigh 10.1.1 .2 route-map viaAS400 in
查看结果:
isp1a #show ip route
B 200.100.50.0/24 [20/0] via 10.1.1 .2, 00:00:06
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
isp1a #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
isp1a #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
Origin IGP, localpref 150, valid, external, best 可以发现本地优先级改变!!确实可以启动改变路由选择的作用,从本地优先级高的走!!
4. 配置MED属性
配置sanjose3的med值使它向不同到AS发送不同的度量值,改变路由选择
isp1a (config)#route-map badmetric
isp1a (config-route-map)#set metric 150
isp1a (config-route-map)#router bgp 200
isp1a (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
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的路由选择!
上一篇:常用各种命令
下一篇:BGP路由反射器实验
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
linux-local.repo 搭建
linux本地repo 搭建
CentOS repo -
Configuring IBGP and EBGP Sessions, Local Preference and MED
ISP#show run Building configuration... Current configuration : 1476 bytes ! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! ho
Configuring IBGP and Local Preference an