拓撲如下
R1
enable 進入特權模式
config 進入全局模式
hostname R1 修改名稱
interface l0 進入端口
ip address 192.168.3.254 255.255.255.0 設置IP地址
interface s0/1 進入端口
ip address 192.168.1.1 255.255.255.0 設置IP地址
physical-layer speed 64000 設置同步時鍾
exit 返回上一級
router bgp 200 啟動BGP協議
neighbor 192.168.1.2 remote-as 100 指明EBGP鄰居
network 192.168.1.0 添加直連網段到BGP
network 192.168.3.0 添加直連網段到BGP
R2
enable 進入特權模式
config 進入全局模式
hostname R2 修改名稱
interface s0/2 進入端口
ip address 192.168.1.2 255.255.255.0 設置IP地址
physical-layer speed 64000 設置同步時鍾
interface s0/1 進入端口
ip address 192.168.2.1 255.255.255.0 設置IP地址
physical-layer speed 64000 設置同步時鍾
exit 返回上一級
router bgp 100 啟動BGP協議
neighbor 192.168.1.1 remote-as 200 指明EBGP鄰居
neighbor 192.168.2.2 remote-as 100 指明IBGP鄰居
network 192.168.1.0 添加直連網段到BGP
network 192.168.2.0 添加直連網段到BGP
no synchronization 取消IBGP同步
neighbor 192.168.2.2 next-hop-self 修改發送給IBGP鄰居的路由條目,將下一跳改為自己
R3
enable 進入特權模式
config 進入全局模式
hostname R3 修改名稱
interface s0/2 進入端口
ip address 192.168.2.2 255.255.255.0 設置IP地址
physical-layer speed 64000 設置同步時鍾
interface l0 進入端口
ip address 192.168.4.254 255.255.255.0 設置IP地址
exit 返回上一級
router bgp 100 啟動BGP協議
neighbor 192.168.2.1 remote-as 100 指明IBGP鄰居
network 192.168.2.0 添加直連網段到BGP
network 192.168.4.0 添加直連網段到BGP
no synchronization 取消IBGP同步
注意事項:
當ABR收到EBGP鄰居發來的條目時,不會修改其條目的下一跳,會直接發送給IBGP鄰居,所以需要手動修改下一跳地址
相關命令
router bgp [自治系統ID] 啟動bgp協議
neighbor [IP地址] remote-as [自治系統ID] 指明鄰居和其所在自治系統
no synchronization 關閉同步