1.BGP基础配置
![图片[1]-7.3 BGP配置详解-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片73-1024x241.png)
1)基本配置
[R1]bgp 12
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 12.1.1.2 as-number 12
[R2]bgp 12
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 12.1.1.1 as-number 12
[R2-bgp]peer 23.1.1.3 as-number 300
[R3]bgp 300
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 23.1.1.2 as-number 12
[R3-bgp]network 3.0.0.0 8
2)查看R1的BGP邻接信息
[R1]display bgp peer
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
12.1.1.2 4 12 3 4 0 00:01:43 Established 0
3)查看R3的BGP路由表
[R3]display bgp routing-table
BGP Local router ID is 3.3.3.3
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 3.0.0.0 0.0.0.0 0 0 i
4)查看R2的BGP路由表
<R2>dis bgp routing-table
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 3.0.0.0 23.1.1.3 0 0 300i
<R2>display ip routing-table protocol bgp
Destination/Mask Proto Pre Cost Flags NextHop Interface
3.0.0.0/8 EBGP 255 0 D 23.1.1.3 GigabitEthernet0/0/1
5)查看R1的BGP路由表(BGP路由不可用)
<R1>dis bgp routing-table
Network NextHop MED LocPrf PrefVal Path/Ogn
i 3.0.0.0 23.1.1.3 0 100 0 300i
6)配置R2的next-hop-local属性解决R1的BGP路由不可用问题,查看R1路由表(BGP路由可用)
[R2]bgp 12
[R2-bgp]peer 12.1.1.1 next-hop-local
7)查看R1路由表(BGP路由可用)
<R1>display bgp routing-table
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 3.0.0.0 12.1.1.2 0 100 0 300i
2.指定BGP更新源IP地址
![图片[2]-7.3 BGP配置详解-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片74-1024x286.png)
1)OSPF基本配置
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.255
2)BGP基本配置
[R1]bgp 12
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 2.2.2.2 as-number 12
[R1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R2]bgp 12
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 1.1.1.1 as-number 12
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R2-bgp]peer 23.1.1.3 as-number 300
[R3]bgp 300
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 23.1.1.2 as-number 12
3)R1的1.1.1.1/24和R的33.3.3.3/24宣告到BGP(3.3.3.3/24网络不可达)
[R1-bgp]network 1.1.1.1 24
[R3-bgp]network 3.3.3.3 24
[R1]display bgp routing-table Network
NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.0/24 0.0.0.0 0 0 i
i 3.3.3.0/24 23.1.1.3 0 100 0 300i
4)解决R3的3.3.3.3/24网络不可达
[R2-bgp]peer 1.1.1.1 next-hop-local
[R1]display bgp routing-table Network
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.0/24 0.0.0.0 0 0 i
*>i 3.3.3.0/24 2.2.2.2 0 100 0 300i
3.BGP同步及路由黑洞
![图片[3]-7.3 BGP配置详解-大赛人网](https://www.dsrw.com/wp-content/uploads/2023/03/图片75-1024x256.png)
1)OSPF基本配置
[R1]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
2)BGP基本配置(同时宣告1.1.1.1/24、4.4.4.4/24到BGP)
[R1]bgp 12
[R1-bgp]router-id 1.1.1.1
[R1-bgp]peer 2.2.2.2 as-number 12
[R1-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R1-bgp]network 1.1.1.1 24
[R2]bgp 12
[R2-bgp]router-id 2.2.2.2
[R2-bgp]peer 1.1.1.1 as-number 12
[R2-bgp]peer 1.1.1.1 connect-interface LoopBack 0
[R2-bgp]peer 3.3.3.3 as-number 12
[R2-bgp]peer 3.3.3.3 connect-interface LoopBack 0
[R3]bgp 12
[R3-bgp]router-id 3.3.3.3
[R3-bgp]peer 2.2.2.2 as-number 12
[R3-bgp]peer 2.2.2.2 connect-interface LoopBack 0
[R3-bgp]peer 34.1.1.4 as-number 400
[R4]bgp 400
[R4-bgp]peer 34.1.1.3 as-number 12
[R4-bgp]network 4.4.4.4 24
3)无R4的4.4.4.4/24网络
[R1-bgp]display bgp routing-table
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.0/24 0.0.0.0 0 0 i
4)向R2通告路由,把下一跳属性设为自身的IP地址
[R3-bgp]peer 2.2.2.2 next-hop-local
[R1-bgp]display bgp routing-table
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.0/24 0.0.0.0 0 0 i
i 4.4.4.0/24 34.1.1.4 0 100 0 400i
5)R4的4.4.4.4/24网络不可达,向R1通告路由,把下一跳属性设为自身的IP地址
[R3-bgp]peer 1.1.1.1 next-hop-local
[R1]display bgp routing-table
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 1.1.1.0/24 0.0.0.0 0 0 i
*>i 4.4.4.0/24 3.3.3.3 0 100 0 400i
6)BGP路由跟踪
<R1>ping -a 1.1.1.1 4.4.4.4
PING 4.4.4.4: 56 data bytes, press CTRL_C to break
Reply from 4.4.4.4: bytes=56 Sequence=1 ttl=253 time=30 ms
<R4>ping -a 4.4.4.4 1.1.1.1
PING 1.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=253 time=30 ms
1 2
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
请登录后查看评论内容