一.实验要求
全网可达!
二.实验步骤
1.配置好所有环回和路由的ip
R1
[r1]dis ip int brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.1.1.1/24 up up
LoopBack0 1.1.1.1/32 up up(s)
R2
[r2]dis ip int brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 12.1.1.2/24 up up
GigabitEthernet0/0/1 23.1.1.2/24 up up
LoopBack0 2.2.2.2/32 up up(s)
R3
[r3]dis ip int brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/1 23.1.1.3/24 up up
GigabitEthernet0/0/2 34.1.1.3/24 up up
LoopBack0 3.3.3.3/32 up up(s)
R4
[r4]dis ip int brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 45.1.1.4/24 up up
GigabitEthernet0/0/2 34.1.1.4/24 up up
LoopBack0 4.4.4.4/32 up up(s)
R5
[r5]dis ip int brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 45.1.1.5/24 up up
LoopBack0 5.5.5.5/32 up up(s)
2.配置IGP协议
在同一个AS内部,配置IGP(这里以OSPF为例)协议,实现内部网络互通,为BGP协议打底,因为想要建立起BGP的邻居关系,要跟邻居TCP可达,也就是能够通信。
[r2]
ospf 1
area 0.0.0.0
#
interface GigabitEthernet0/0/1
ospf enable 1 area 0.0.0.0
#
interface LoopBack0
ospf enable 1 area 0.0.0.0
[r3]
ospf 1
area 0.0.0.0
network 0.0.0.0 255.255.255.255
[r4]
ospf 1
area 0.0.0.0
#
interface GigabitEthernet0/0/2
ospf enable 1 area 0.0.0.0
#
interface LoopBack0
ospf enable 1 area 0.0.0.0
3.配置BGP协议
在R1上配置BGP进程和EBGP邻居关系。
[r1]
bgp 100
router-id 1.1.1.1
peer 12.1.1.2 as-number 200
在R2上配置BGP进程,EBGP邻居关系和IBGP邻居关系。
[r2]
bgp 200
router-id 2.2.2.2
peer 4.4.4.4 as-number 200
peer 4.4.4.4 connect-interface LoopBack0
peer 12.1.1.1 as-number 100
peer 4.4.4.4 next-hop-local
在R4上配置BGP进程,EBGP邻居关系和IBGP邻居关系
注意:r3上不需要配置bgp协议。
[r4]
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 45.1.1.5 as-number 300
peer 2.2.2.2 next-hop-local
在R5上配置BGP进程,EBGP邻居关系。
[R5]
bgp 300
router-id 5.5.5.5
peer 45.1.1.4 as-number 200
4.检查R1 R2 R4 R5的邻居关系是否起来。
r1
[r1]dis bgp peer
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
12.1.1.2 4 200 41 40 0 00:37:35 Established 2
r2
[r2]dis bgp peer
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
4.4.4.4 4 200 40 42 0 00:37:55 Established 1
12.1.1.1 4 100 41 43 0 00:38:23 Established 1
r4
[r4]dis bgp peer
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
2.2.2.2 4 200 42 41 0 00:38:24 Established 2
45.1.1.5 4 300 41 42 0 00:38:54 Established 1
r5
[r5]dis bgp peer
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
45.1.1.4 4 200 42 42 0 00:39:26 Established 1
状态为Established 表示邻居关系建立成功。