BGP协议练习

实验题目

 

根据题目构建拓扑结构及划分ip地址

第一步:配置IP地址和环回

[r1]int lo0
[r1-LoopBack0]ip address 1.1.1.1 24
[r1-LoopBack0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip address 22.1.1.1 24
Jan 21 2022 11:04:28-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r1-GigabitEthernet0/0/1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
Jan 21 2022 11:04:40-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r2]int lo0
[r2-LoopBack0]ip address 2.2.2.2 24
[r2-LoopBack0]int g0/0/0    
[r2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
Jan 21 2022 11:05:22-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip address 23.1.1.1 24
Jan 21 2022 11:06:24-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r2-GigabitEthernet0/0/1]int g0/0/2
[r2-GigabitEthernet0/0/2]ip address 13.1.1.1 24
Jan 21 2022 11:06:44-08:00 r2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r3]int lo0
[r3-LoopBack0]ip address 3.3.3.3 24
[r3-LoopBack0]int g0/0/0
[r3-GigabitEthernet0/0/0]ip address 13.1.1.2 24
Jan 21 2022 11:07:33-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip address 24.1.1.1 24
Jan 21 2022 11:07:53-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r3-GigabitEthernet0/0/1]int g0/0/2
[r3-GigabitEthernet0/0/2]ip address 14.1.1.1 24
Jan 21 2022 11:08:15-08:00 r3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 
[r4]int lo0
[r4-LoopBack0]ip address 4.4.4.4 24
[r4-LoopBack0]int g0/0/0
[r4-GigabitEthernet0/0/0]ip address 14.1.1.2 24
Jan 21 2022 11:08:46-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r4-GigabitEthernet0/0/0]int g0/0/1
[r4-GigabitEthernet0/0/1]ip address 25.1.1.1 24
Jan 21 2022 11:09:06-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r4-GigabitEthernet0/0/1]int g0/0/2
[r4-GigabitEthernet0/0/2]ip address 15.1.1.1 24
Jan 21 2022 11:09:23-08:00 r4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 
[r4-GigabitEthernet0/0/2]int g4/0/0
[r4-GigabitEthernet4/0/0]ip address 16.1.1.1 24
Jan 21 2022 11:09:37-08:00 r4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP 
on the interface GigabitEthernet4/0/0 has entered the UP state. 
[r5]int lo0
[r5-LoopBack0]ip address 5.5.5.5 24
[r5-LoopBack0]int g0/0/0
[r5-GigabitEthernet0/0/0]ip address 15.1.1.2 24
Jan 21 2022 11:10:30-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r5-GigabitEthernet0/0/0]int g0/0/2
[r5-GigabitEthernet0/0/2]ip address 16.1.1.2 24
Jan 21 2022 11:10:49-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 
[r5-GigabitEthernet0/0/2]int g0/0/1
[r5-GigabitEthernet0/0/1]ip address 26.1.1.1 24
Jan 21 2022 11:11:03-08:00 r5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 

第二步:在AS2中宣告OSPF

[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]area 0
[r2-ospf-1-area-0.0.0.0]network 23.1.1.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 13.1.1.1 0.0.0.0
[r2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 13.1.1.2 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 14.1.1.1 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 24.1.1.1 0.0.0.0
[r4]ospf 1 router-id 4.4.4.4	
[r4-ospf-1]area 0
[r4-ospf-1-area-0.0.0.0]network 14.1.1.2 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r4-ospf-1-area-0.0.0.0]network 25.1.1.1 0.0.0.0

建邻成功:

 第三步:R1于R2建邻

[r1]bgp 1
[r1-bgp]router-id 1.1.1.1	
[r1-bgp]peer 12.1.1.2 as-number 2
Jan 21 2022 11:56:29-08:00 r1 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
 peer 12.1.1.2 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, St
ateChangeReason=Up)
[r2]bgp 2	
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 12.1.1.1 as-number 1
Jan 21 2022 11:56:29-08:00 r2 %%01BGP/3/STATE_CHG_UPDOWN(l)[0]:The status of the
 peer 12.1.1.1 changed from OPENCONFIRM to ESTABLISHED. (InstanceName=Public, St
ateChangeReason=Up)

第四步:AS2中建立IGP

[r2]bgp 2
[r2-bgp]peer 3.3.3.3 as-number 2
[r2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
 
[r3]bgp 2	
[r3-bgp]router-id 3.3.3.3
[r3-bgp]peer 2.2.2.2 as-number 2
[r3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
 
[r3]bgp 2
[r3-bgp]peer 4.4.4.4 as-number 2
[r3-bgp]peer 4.4.4.4 connect-interface  LoopBack 0
 
[r4]bgp 2
[r4-bgp]router-id 4.4.4.4
[r4-bgp]peer 3.3.3.3 as-number 2
[r4-bgp]peer 3.3.3.3 connect-interface LoopBack 0

第五步:R4和R5建邻:

#写R4到R5的静态路由
[r4]ip route-static 5.5.5.0 24 15.1.1.2
[r4]ip route-static 5.5.5.0 24 16.1.1.2
 
[r5]ip route-static 4.4.4.0 24 15.1.1.1 
[r5]ip route-static 4.4.4.0 24 16.1.1.1
 
[r4]bgp 2
[r4-bgp]peer 5.5.5.5 as-number 3	
[r4-bgp]peer 5.5.5.5 connect-interface LoopBack 0
[r4-bgp]peer 5.5.5.5 ebgp-max-hop 2
 
[r5]bgp 3
[r5-bgp]router-id 5.5.5.5
[r5-bgp]peer 4.4.4.4 as-number 2	
[r5-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[r5-bgp]peer 4.4.4.4 ebgp-max-hop 2

 第六步:宣告

R1上宣告

[r1]bgp 1
[r1-bgp]network 22.1.1.0 24
 
[r2-bgp]peer 3.3.3.3 next-hop-local 
 
#因为水平分割问题,R3无法将路由发布到R4,只能将R2与R4建立邻居,让R2将路由发给R4
[r2]bgp 2
[r2-bgp]peer 4.4.4.4 as-number 2	
[r2-bgp]peer 4.4.4.4 connect-interface LoopBack 0
[r2-bgp]peer 4.4.4.4 next-hop-local 
 
[r4]bgp 2
[r4-bgp]peer 2.2.2.2 as-number 2	
[r4-bgp]peer 2.2.2.2 connect-interface LoopBack 0

R2上宣告

[r2]int lo0
[r2-LoopBack0]ip address 2.2.2.2 24
[r2-LoopBack0]int g0/0/0	
[r2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
Jan 21 2022 11:05:22-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip address 23.1.1.1 24
Jan 21 2022 11:06:24-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[r2-GigabitEthernet0/0/1]int g0/0/2
[r2-GigabitEthernet0/0/2]ip address 13.1.1.1 24
Jan 21 2022 11:06:44-08:00 r2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 

R5上宣告:

[r5]bgp 3
[r5-bgp]network 26.1.1.0 24
 
[r4-bgp]peer 3.3.3.3 next-hop-local 
[r4-bgp]peer 2.2.2.2 next-hop-local

在R2/R3/R4上宣告:

r2-bgp]network 23.1.1.0 24
 
[r3-bgp]network 24.1.1.0 24
 
[r4-bgp]network 25.1.1.0 24

测试:

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值