Path-attribute
一共10中属性(cisco11条)属性,weight ,origin ,as_path ,next_hop ,local_pref ,atomic_aggregate ,Aggregator ,community ,MED,originator_id ,cluster_list
分为4类 :
(1)Weihgt
Cisco 私有属性,对于离开AS的路由在路由器选择哪一条最优,本台路由器产生的值为32768,学习的值为0,不能传递给所有邻居,用于选路:适用于一台路由去往别的AS有两个以上出口时,选择weight值高的一条路。
(2)Origin
起源属性,0表示宣告(i),1表示EGP学到(E),3表示其他手段得到(重发布?)
值越低越好
具有多重功能:
① 本质上识别路由来源
② 用于选路(但很少使用)i > E > ?
(3)AS path
作用:
① 本质路径记录一条路由在传输过程中经历了那些AS(不算自己,每经过一个AS将AS号放在最右)
② 可用来防环
③ 用于选路(AS path越长开销越大)
Nei X.X.X.X allowas-in 允许和具有自己相同的AS的路由进入本AS
Nei x.x.x.x as-override 把具有和其他AS相同AS号的路由放入这个AS
(4)Next_hop
到达路由的下一跳路由器IP地址,EIBGP修改, IBGP不修改
通告路由器和接受路由器不在一个AS内,next_hop为通告路由器的更新地址
通告路由器和接受路由器在一个AS内,next_hop为通告邻居的更新地址
通告路由器和接受路由器在一个AS内且为邻居关系,则更新地址为不同AS,为外部更新地址
(5)Local_pref (专职选路)
最佳实施场景:用于本地AS选择离开且本地出口在多个路由器上
(6)MED
用于选择流入AS的入口路由器,可以在俩个AS之间传递,越低越好默认0
只有同一AS间传递的MED才有可比性
开启MED对比
(7)Atomic_aggregate
用来警告下游路由器路由聚合后产生的路由路径丢失。
BGP支持向BGP邻居传递重叠路由可以选择多种方式:
(8)Aggregator
用来通告汇总路由的汇聚路由器 BGP_ID(cisco)
(9)Community(路由标记)
操作方法:使用prefix-list 抓住路由通过route-map 更改属性值调用在BGP邻居关系上
R1:
router eigrp 1
network 10.1.1.1 0.0.0.0
network 10.1.12.0 0.0.0.255
auto-summary
!
router bgp 1
no synchronization
bgp router-id 10.1.1.1
bgp log-neighbor-changes
network 10.1.1.1 mask 255.255.255.255
neighbor 10.1.13.3 remote-as 2
neighbor 10.2.2.2 remote-as 1
neighbor 10.2.2.2 update-source Loopback0
neighbor 10.2.2.2 next-hop-self
no auto-summary
R2:
router eigrp 1
network 10.1.12.0 0.0.0.255
network 10.2.2.2 0.0.0.0
auto-summary
!
router bgp 1
no synchronization
bgp router-id 10.2.2.2
bgp log-neighbor-changes
network 10.2.2.2 mask 255.255.255.255
neighbor 10.1.1.1 remote-as 1
neighbor 10.1.1.1 update-source Loopback0
neighbor 10.1.1.1 next-hop-self
neighbor 10.1.24.4 remote-as 2
neighbor 10.1.24.4 route-map AS2 in
neighbor 10.1.25.5 remote-as 3
neighbor 10.1.26.6 remote-as 3
neighbor 10.1.26.6 route-map AS3 in
no auto-summary
!
ip prefix-list AS2 seq 5 permit 10.3.3.3/32
ip prefix-list AS2 seq 10 permit 10.4.4.4/32
!
ip prefix-list AS3 seq 5 permit 10.5.5.5/32
ip prefix-list AS3 seq 10 permit 10.6.6.6/32
ip prefix-list AS3 seq 15 permit 10.7.7.7/32
no cdp log mismatch duplex
!
route-map AS2 permit 10
match ip address prefix-list AS2
set local-preference 50
!
route-map AS2 permit 20
!
route-map AS3 permit 10
match ip address prefix-list AS3
set weight 100
!
route-map AS3 permit 20
R3:
router eigrp 2
network 10.1.34.0 0.0.0.255
network 10.3.3.3 0.0.0.0
auto-summary
!
router bgp 2
no synchronization
bgp router-id 10.3.3.3
bgp log-neighbor-changes
network 10.3.3.3 mask 255.255.255.255
neighbor 10.1.13.1 remote-as 1
neighbor 10.4.4.4 remote-as 2
neighbor 10.4.4.4 update-source Loopback0
neighbor 10.4.4.4 next-hop-self
no auto-summary
R4:
router eigrp 2
network 10.1.34.0 0.0.0.255
network 10.4.4.4 0.0.0.0
auto-summary
!
router bgp 2
no synchronization
bgp router-id 10.4.4.4
bgp log-neighbor-changes
network 10.4.4.4 mask 255.255.255.255
neighbor 10.1.24.2 remote-as 1
neighbor 10.1.24.2 route-map AS1 in
neighbor 10.1.45.5 remote-as 3
neighbor 10.1.45.5 route-map AS3 in
neighbor 10.1.46.6 remote-as 3
neighbor 10.1.46.6 route-map OR out
neighbor 10.3.3.3 remote-as 2
neighbor 10.3.3.3 update-source Loopback0
neighbor 10.3.3.3 next-hop-self
no auto-summary
!
ip forward-protocol nd
no ip http server
no ip http secure-server
!
ip prefix-list AS1 seq 5 permit 10.1.1.1/32
ip prefix-list AS1 seq 10 permit 10.2.2.2/32
!
ip prefix-list AS2 seq 5 permit 10.3.3.3/32
ip prefix-list AS2 seq 10 permit 10.4.4.4/32
!
ip prefix-list AS3 seq 5 permit 10.5.5.5/32
ip prefix-list AS3 seq 10 permit 10.6.6.6/32
ip prefix-list AS3 seq 15 permit 10.7.7.7/32
no cdp log mismatch duplex
!
route-map OR permit 10
match ip address prefix-list AS2
set origin incomplete
!
route-map OR permit 20
!
route-map AS3 permit 10
match ip address prefix-list AS3
set as-path prepend 3
!
route-map AS3 permit 20
!
route-map AS1 permit 10
match ip address prefix-list AS1
set metric 1
!
route-map AS1 permit 20
R5:
router eigrp 3
network 10.1.56.0 0.0.0.255
network 10.1.57.0 0.0.0.255
network 10.5.5.5 0.0.0.0
auto-summary
!
router bgp 3
no synchronization
bgp log-neighbor-changes
network 10.5.5.5 mask 255.255.255.255
neighbor IBGP peer-group
neighbor IBGP remote-as 3
neighbor IBGP update-source Loopback0
neighbor IBGP next-hop-self
neighbor 10.1.25.2 remote-as 1
neighbor 10.1.25.2 route-map AS1 in
neighbor 10.1.45.4 remote-as 2
neighbor 10.6.6.6 peer-group IBGP
neighbor 10.7.7.7 peer-group IBGP
no auto-summary
!
ip forward-protocol nd
no ip http server
no ip http secure-server
!
ip prefix-list AS1 seq 5 permit 10.1.1.1/32
ip prefix-list AS1 seq 10 permit 10.2.2.2/32
no cdp log mismatch duplex
!
route-map AS1 permit 10
match ip address prefix-list AS1
set ip next-hop 10.6.6.6
!
route-map AS1 permit 20
R6:
router eigrp 3
network 10.1.56.0 0.0.0.255
network 10.1.67.0 0.0.0.255
network 10.6.6.6 0.0.0.0
auto-summary
!
router bgp 3
no synchronization
bgp log-neighbor-changes
network 10.6.6.6 mask 255.255.255.255
neighbor IBGP peer-group
neighbor IBGP remote-as 3
neighbor IBGP update-source Loopback0
neighbor IBGP next-hop-self
neighbor 10.1.26.2 remote-as 1
neighbor 10.1.46.4 remote-as 2
neighbor 10.5.5.5 peer-group IBGP
neighbor 10.7.7.7 peer-group IBGP
no auto-summary
R7:
router eigrp 3
network 0.0.0.0
auto-summary
!
router bgp 3
no synchronization
bgp log-neighbor-changes
network 10.7.7.7 mask 255.255.255.255
neighbor IBGP peer-group
neighbor IBGP remote-as 3
neighbor IBGP update-source Loopback0
neighbor IBGP next-hop-self
neighbor 10.5.5.5 peer-group IBGP
neighbor 10.6.6.6 peer-group IBGP
no auto-summary