CCNP路由实验(4) -- BGP

基本配置:
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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值