内容配置
R1
interface GigabitEthernet0/0/0
ip address 12.0.0.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
bgp 100 ----启用BGP协议,其AS号为100
router-id 1.1.1.1 ----配置其路由器RID
peer 12.0.0.2 as-number 200 ----手工配置去往其邻居的下一跳地址何邻居所在AS区域的AS号为200
#
ipv4-family unicast
undo synchronization
network 1.1.1.1 255.255.255.255 ----在BGP协议内宣告R1的环回地址,并通过BGP协议将其路由信息送往其它的AS域
peer 12.0.0.2 enable ----允许从IP地址为12.0.0.2的接口接收数据
R2
interface GigabitEthernet0/0/0
ip address 12.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 23.0.0.1 255.255.255.0
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
bgp 200
router-id 2.2.2.2
peer 3.3.3.3 as-number 200
peer 3.3.3.3 connect-interface LoopBack0 ----当RID为3.3.3.3的路由设备想要和本地设备建邻时,设置其建立TCP连接的IP地址为环回接口0的IP地址
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0 ----配置其为全联结构
peer 12.0.0.1 as-number 100
#
ipv4-family unicast
undo synchronization
peer 3.3.3.3 enable
peer 3.3.3.3 next-hop-local ----将传递给RID为3.3.3.3的邻居的路由信息的下一跳IP地址修改为本地
peer 4.4.4.4 enable
peer 4.4.4.4 next-hop-local
peer 12.0.0.1 enable
#
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 23.0.0.1 0.0.0.0
R3
interface GigabitEthernet0/0/0
ip address 23.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 34.0.0.1 255.255.255.0
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
bgp 200
router-id 3.3.3.3
peer 2.2.2.2 as-number 200
peer 2.2.2.2 connect-interface LoopBack0
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable
peer 4.4.4.4 enable
#
ospf 1 router-id 3.3.3.3
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 23.0.0.2 0.0.0.0
network 34.0.0.1 0.0.0.0
R4
interface GigabitEthernet0/0/0
ip address 34.0.0.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 45.0.0.1 255.255.255.0
#
interface LoopBack0
ip address 4.4.4.4 255.255.255.255
#
bgp 200
router-id 4.4.4.4
peer 2.2.2.2 as-number 200
peer 2.2.2.2 connect-interface LoopBack0
peer 3.3.3.3 as-number 200
peer 3.3.3.3 connect-interface LoopBack0
peer 5.5.5.5 as-number 300
peer 5.5.5.5 ebgp-max-hop 2 ----修改其TTL值为2,因为此时EBGP对等体关系中,其启用了BGP协议的设备中,配置的下一跳地址为其对端BGP设备的环回接口地址,为非直连连接
peer 5.5.5.5 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable
peer 2.2.2.2 next-hop-local
peer 3.3.3.3 enable
peer 3.3.3.3 next-hop-local
peer 5.5.5.5 enable
#
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 34.0.0.2 0.0.0.0
#
ip route-static 5.5.5.5 255.255.255.255 45.0.0.2 ----手工配置其路由信息,使其EBGP对等体关系中的两台BGP设备能够通信 ----因为在手工配置其BGP设备的邻居时,配置的下一跳地址为非直连IP地址
R5
interface GigabitEthernet0/0/0
ip address 45.0.0.2 255.255.255.0
#
interface LoopBack0
ip address 5.5.5.5 255.255.255.255
#
interface LoopBack1
ip address 55.55.55.55 255.255.255.0
#
bgp 300
router-id 5.5.5.5
peer 4.4.4.4 as-number 200
peer 4.4.4.4 ebgp-max-hop 2
peer 4.4.4.4 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
network 55.55.55.0 255.255.255.0
peer 4.4.4.4 enable
#
ip route-static 4.4.4.4 255.255.255.255 45.0.0.1
练习结果
R1
BGP邻居表
BGP路由信息
R2
BGP邻居表
BGP路由信息
R3
BGP邻居表
BGP路由信息
R4
BGP邻居表
BGP路由信息
R5
BGP邻居表
BGP路由信息