博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CCNP路由实验(4) -- BGP
阅读量:6580 次
发布时间:2019-06-24

本文共 12102 字,大约阅读时间需要 40 分钟。

基本配置:

enable
conf t
no ip do lo
enable pass cisco
line con 0
logg sync
exec-t 0 0
line vty 0 4
pass cisco
logg sync
exit
host
BGP基本配置:
------------------------------------------------------------------------------

-------------------------------------------------------------------------------

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit
router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 11.1.1.0 0.0.0.255
exit
R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit
router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 22.1.1.0 0.0.0.255
exit
R1:
end
ping 22.1.1.1 source 11.1.1.1
conf t
router bgp 100
no synchronization
no auto-summary
bgp router-id 11.1.1.1
neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
exit
R2:
router bgp 100
bgp router-id 22.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
router bgp 100
neighbor 23.1.1.3 remote-as 200
exit
R3:
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
router bgp 200
bgp router-id 33.1.1.1
neighbor 23.1.1.2 remote-as 100
exit
R2:
end
show ip bgp summary
conf t
路由信息的通告:
----------------------------------------------------
R3:
int l0
ip add 33.1.1.1 255.255.255.0
exit
router bgp 200
network 33.1.1.0 mask 255.255.255.0
exit
R1:
router bgp 100
redistribute eigrp 1
exit
R2:
end
show ip bgp
conf t
R1:
end
show ip bgp
conf t
R2:
router bgp 100
neighbor 11.1.1.1 next-hop-self
exit
R1:
end
show ip bgp
conf t

理解同步以及解决路由黑洞:

--------------------------------------------------------------------------------------

---------------------------------------------------------------------------------------

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit
router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 11.1.1.0 0.0.0.255
exit
R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 23.1.1.0 0.0.0.255
exit
R3:
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
int l0
ip add 33.1.1.1 255.255.255.0
no shut
exit
router eigrp 1
no auto-summary
network 23.1.1.0 0.0.0.255
network 33.1.1.0 0.0.0.255
exit
------------------------------------------
R1:
router bgp 100
bgp router-id 11.1.1.1
neighbor 33.1.1.1 remote-as 100
neighbor 33.1.1.1 update-source l0
neighbor 33.1.1.1 next-hop-self
exit
R3:
router bgp 100
bgp router-id 33.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 next-hop-self
exit
int f1/0
ip add 34.1.1.3 255.255.255.0
no shut
exit
router bgp 100
neighbor 34.1.1.4 remote-as 200
exit
R4:
int f0/0
ip add 34.1.1.4 255.255.255.0
no shut
exit
router bgp 200
bgp router-id 44.1.1.1
neighbor 34.1.1.3 remote-as 100
exit
-----------------------------------------------------
R1:
int l1
ip add 100.1.1.1 255.255.255.0
no shut
exit
router bgp 100
network 100.1.1.0 mask 255.255.255.0
exit
R3:
end
show ip bgp
show ip route bgp
conf t
R4:
end
show ip bgp
conf t
R3:
end
ping 100.1.1.1
conf t
R2:
end
shwo ip route
conf t
R3:
router bgp 100
synchronization
end
clear ip bgp *
shwo ip bgp
conf t
R4:
end
show ip bgp
conf t
-----------------------------------------
R2:
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit
router eigrp 1
network 22.1.1.0 0.0.0.255
exit
router bgp 100
bgp router-id 22.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 next-hop-self
neighbor 33.1.1.1 remote-as 100
neighbor 33.1.1.1 update-source l0
neighbor 33.1.1.1 next-hop-self
exit
R1:
router bgp 100
neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 next-hop-self
exit
R3:
router bgp 100
neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 next-hop-self
no synchronization
exit
-----------------------------------------------
R3:
end
clear ip bgp *
shwo ip bgp
conf t
R4:
end
show ip bgp
conf t
R3:
end
ping 100.1.1.1
conf t
R4:
int l0
ip add 44.1.1.1 255.255.255.0
exit
router bgp 200
network 44.1.1.0 mask 255.255.255.0
exit
end
ping 100.1.1.1 source 44.1.1.1
conf t
用peer-group的方法建立邻居关系
-----------------------------------------------
R1:
router bgp 100
bgp router-id 11.1.1.1
neighbor IBGP peer-group
neighbor IBGP remote-as 100
neighbor IBGP update-source l0
neighbor IBGP next-hop-self
neighbor 22.1.1.1 peer-group IBGP
neighbor 33.1.1.1 peer-group IBGP
exit
R2:
router bgp 100
bgp router-id 22.1.1.1
neighbor IBGP peer-group
neighbor IBGP remote-as 100
neighbor IBGP update-source l0
neighbor IBGP next-hop-self
neighbor 11.1.1.1 peer-group IBGP
neighbor 33.1.1.1 peer-group IBGP
exit
R3:
router bgp 100
bgp router-id 33.1.1.1
neighbor IBGP peer-group
neighbor IBGP remote-as 100
neighbor IBGP update-source l0
neighbor IBGP next-hop-self
neighbor 22.1.1.1 peer-group IBGP
neighbor 11.1.1.1 peer-group IBGP
exit

BGP的自动汇总:

---------------------------------------------------------------------------------

---------------------------------------------------------------------------------

R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit
router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 11.1.1.0 0.0.0.255
exit
R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 22.1.1.0 0.0.0.255
exit
R1:
router bgp 100
bgp router-id 11.1.1.1
neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 next-hop-self
exit
R2:
router bgp 100
bgp router-id 22.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 next-hop-self
neighbor 23.1.1.3 remote-as 200
exit
R3:
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
router bgp 200
bgp router-id 33.1.1.1
neighbor 23.1.1.2 remote-as 100
exit
R3:
int l1
ip add 100.1.1.1 255.255.255.0
no shut
exit
int l2
ip add 100.1.2.1 255.255.255.0
no shut
exit
int l3
ip add 100.1.3.1 255.255.255.0
no shut
exit
router bgp 200
auto-summary
network 100.1.1.0 mask 255.255.255.0
network 100.1.2.0 mask 255.255.255.0
network 100.1.3.0 mask 255.255.255.0
exit
R2:
end
show ip bgp
conf t
R3:
router bgp 200
network 100.0.0.0
exit
R2:
end
show ip bgp
conf t
router bgp 100
auto-summary
redistribute eigrp 1
exit

BGP的手动汇总:

-----------------------------------------------------
R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit
router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 11.1.1.0 0.0.0.255
exit
R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 22.1.1.0 0.0.0.255
exit
R1:
router bgp 100
bgp router-id 11.1.1.1
neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 next-hop-self
exit
R2:
router bgp 100
bgp router-id 22.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 next-hop-self
neighbor 23.1.1.3 remote-as 200
exit
R3:
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
router bgp 200
bgp router-id 33.1.1.1
neighbor 23.1.1.2 remote-as 100
exit
R3:
int l1
ip add 100.1.1.1 255.255.255.0
no shut
exit
int l2
ip add 100.1.2.1 255.255.255.0
no shut
exit
int l3
ip add 100.1.3.1 255.255.255.0
no shut
exit
router bgp 200
network 100.1.1.0 mask 255.255.255.0
network 100.1.2.0 mask 255.255.255.0
network 100.1.3.0 mask 255.255.255.0
exit
R2:
end
show ip bgp
conf t
router bgp 100
aggregate-add 100.1.0.0 255.255.0.0
exit
end
show ip bgp
conf t
R1:
end
show ip bgp
conf t
R2:
router bgp 100
aggregate-add 100.1.0.0 255.255.0.0 summary-only
exit
R1:
end
show ip bgp
conf t

路由器选路原则:

---------------------------------------------------------------------

Well-Known Mandatory:

    Origin,
    AS-Path,
    Next_Hop
Well-Known Discretionary:
    Local_Pref,
    Atomic_Aggregate
Optional Transitive:
    Aggregator,
    Community
Optional Nontransitive:
    Med,
    Originator_Id,
    Cluster_List
Weight(最大) -- Local_Pref(最高) -- 本路由器 -- As_Path(最短) -- Origin(最低IGP<BGP<INCOMPLETE) -- MED(最低) -- (EBGP路由>联盟EGBP路由>IBGP路由) -- (离IGP邻居最近) -- (配置了maximum-path(IBGP),负载均衡) -- 更老的RBGP路由条目 -- BGP路由器ID(最低) -- Cluster-List(最短) -- BGP邻居地址(neighbor)

优选Weight值更高的路由:

-----------------------------------------------------------------------------------------
R1:
int f0/0
ip add 12.1.1.1 255.255.255.0
no shut
exit
int f1/0
ip add 13.1.1.1 255.255.255.0
no shut
exit
int l0
ip add 11.1.1.1 255.255.255.0
no shut
exit
router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 11.1.1.0 0.0.0.255
exit

router bgp 100
bgp router-id 11.1.1.1
neighbor 22.1.1.1 remote-as 100
neighbor 22.1.1.1 update-source l0
neighbor 22.1.1.1 next-hop-self
neighbor 13.1.1.3 remote-as 200
exit
R2:
int f0/0
ip add 12.1.1.2 255.255.255.0
no shut
exit
int f1/0
ip add 23.1.1.2 255.255.255.0
no shut
exit
int l0
ip add 22.1.1.1 255.255.255.0
no shut
exit
router eigrp 1
no auto-summary
network 12.1.1.0 0.0.0.255
network 22.1.1.0 0.0.0.255
exit
router bgp 100
bgp router-id 22.1.1.1
neighbor 11.1.1.1 remote-as 100
neighbor 11.1.1.1 update-source l0
neighbor 11.1.1.1 next-hop-self
neighbor 23.1.1.3 remote-as 200
exit
R3:
int f1/0
ip add 13.1.1.3 255.255.255.0
no shut
exit
int f0/0
ip add 23.1.1.3 255.255.255.0
no shut
exit
int l0
ip add 33.1.1.1 255.255.255.0
no shut
exit
router bgp 200
bgp router-id 33.1.1.1
neighbor 13.1.1.1 remote-as 100
neighbor 23.1.1.2 remote-as 100
network 33.1.1.0 mask 255.255.255.0
exit
-------------------------------------------------------------
R1:
end
show ip bgp
conf t
router bgp 100
neighbor 22.1.1.1 weight 1000
exit
end
clear ip bgp *
show ip bgp
conf t
ip prefix-list 33.1 permit 33.1.1.0/24
route-map wei permit 10
match ip add prefix-list 33.1
set weight 200
exit
route-map wei permit 9999
exit
router bgp 100
neighbor 22.1.1.1 route-map wei in
exit
end
clear ip bgp * in
show ip bgp
conf t
R3:
int l1
ip add 33.1.2.1 255.255.255.0
no shut
exit
router bgp 200
network 33.1.2.0 mask 255.255.255.0
exit
R1:
end
show ip bgp
conf t

优选Local Preference值更高的路由:

-----------------------------------------------------
R1:
end
show ip bgp summary
show ip bgp
show ip bgp 33.1.1.0
conf t
ip prefix-list 33.1 permit 33.1.1.0/24
route-map LOC permit 10
match ip add prefix-list 33.1
set local-preference 200
exit
route-map Loc permit 9999
exit
router bgp 100
neighbor 22.1.1.1 route-map LOC in
exit
end
clear ip bgp * in
show ip bgp
conf t
router bgp 100
bgp default local-preference 300
exit
end
show ip bgp
show ip bgp 33.1.1.0
conf t
R2:
end
show ip bgp
conf t

优选从本地路由器始发的路由:
---------------------------------------------------------------
R1:
int l100
ip add 100.1.1.1 255.255.255.0
exit
router bgp 100
network 100.1.1.0 mask 255.255.255.0
exit
R2:
int l100
ip add 100.1.1.1 255.255.255.0
exit
ip prefix-list 100 permit 100.1.1.0/24
route-map WEI permit 10
match ip add prefix-list 100
set weight 0
exit
router bgp 100
network 100.1.1.0 mask 255.255.255.0 route-map WEI
exit
end
show ip bgp
conf t

优选有最短AS-Path的BGP路由条目

--------------------------------------------------------------
R1:
end
show ip bgp
conf t
ip prefix-list 33.1 permit 33.1.1.0/24
route-map AS permit 10
match ip add prefix-list 33.1
set as-path prepend 10 20 30
exit
route-map AS permit 9999
exit
router bgp 100
neighbor 13.1.1.3 route-map AS in
exit
end
clear ip bgp * in
show ip bgp
conf t

选择更低Origin属性的路由

--------------------------------------------------------------
R1:
end
show ip bgp
conf t
ip prefix-list 33.1 permit 33.1.1.0/24
route-map ORI permit 10
match ip add prefix-list 33.1
set origin incomplete
exit
route-map ORI permit 9999
exit
router bgp 100
neighbor 13.1.1.3 route-map ORI in
exit
end
clear ip bgp * in
show ip bgp
conf t

转载于:https://www.cnblogs.com/thlzhf/p/3144538.html

你可能感兴趣的文章
使用模板将Web服务的结果转换为标记语言
查看>>
inno setup 打包脚本学习
查看>>
php 并发控制中的独占锁
查看>>
React Native 0.20官方入门教程
查看>>
JSON for Modern C++ 3.6.0 发布
查看>>
Tomcat9.0部署iot.war(环境mysql8.0,centos7.2)
查看>>
我的友情链接
查看>>
监听在微信中打开页面时的自带返回按钮事件
查看>>
第一个php页面
查看>>
世界各国EMC认证大全
查看>>
最优化问题中黄金分割法的代码
查看>>
在JS中使用Ajax
查看>>
Jolt大奖获奖图书
查看>>
android中webview空间通过Img 标签显示sd卡中 的图片
查看>>
ubuntu 16.04 安装PhpMyAdmin
查看>>
安卓开启多个服务
查看>>
设置分录行按钮监听事件
查看>>
C Primer Plus 第5章 运算符、表达式和语句 5.2基本运算符
查看>>
java并发库之Executors常用的创建ExecutorService的几个方法说明
查看>>
23种设计模式(1):单例模式
查看>>