实验要求
使用BGP,按照真实的网络环境的逻辑配置,实现所有PC间可以进行相互通讯。
实验拓扑图
配置IP地址
r1]int lo0
[r1-LoopBack0]ip ad
[r1-LoopBack0]ip address 1.1.1.1 24
[r1-LoopBack0]int g0/0/0
[r1-GigabitEthernet0/0/0]ip ad 12.1.1.1 24
[r1]int g0/0/1
[r1-GigabitEthernet0/0/1]ip ad
[r1-GigabitEthernet0/0/1]ip address 1.1.2.1 24
注:其它路由器进行类似配置
在R1与R2之间启用EBGP
R2与R3,R3与R4之间启用IBGP
通过换回路由进行建邻,并且在所得IBGP中启用OSPF动态路由协议
R1:
[r1]bgp 1
[r1-bgp]router-id 1.1.1.1
[r1-bgp]peer 12.1.1.2 as-number 2
R2(EBGP):
[r2]bgp 2
[r2-bgp]router-id 2.2.2.2
[r2-bgp]peer 12.1.1.1 as-number 1
IBGP:
[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(IBGP):
[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]peer 4.4.4.4 connect-interface LoopBack 0
OSPF:
[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.0
[r3-ospf-1-area-0.0.0.0]network 3.3.4.3 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 23.1.1.2 0.0.0.0
[r3-ospf-1-area-0.0.0.0]network 34.1.1.1 0.0.0.0
R4:
[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:
[r4]ip route-static 5.5.5.0 24 45.1.1.2
[r4]ip route-static 5.5.5.0 24 54.1.1.2
R5:
[r5]ip route-static 4.4.4.0 24 45.1.1.1
[r5]ip route-static 4.4.4.0 24 54.1.1.1
通过环回建设EBGP
R4:
[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:
[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
进行BGP路由宣告
R1:
[r1]bgp 1
[r1-bgp]network 1.1.2.0 24
R5:
[r5-bgp]network 5.5.6.0 24
到此,该实验就基本完成了!!!