全部博文(102)
分类: 系统运维
2008-09-08 11:43:00
如下图所示,所有路由器均为BGP路由器,RouterA和RouterB之间建立EBGP连接,RouterB、RouterC和RouterD之间建立IBGP全连接。
具体的配置步骤
步骤1 配置各个接口的地址
对于 RouterA
interface GE1/0/0
ip add 8.1.1.1 8
interface pos2/0/0
ip add 200.1.1.2 24
对于RouterB
interface pos2/0/0
ip add 200.1.1.1 24
interface pos3/0/0
ip add 9.1.3.1 24
interface pos1/0/0
ip add 9.1.1.1 24
对于RouterC
interface pos3/0/0
ip add 9.1.3.2 24
interface pos2/0/0
ip add 9.1.2.1 24
对于RouterD
interface pos2/0/0
ip add 9.1.2.2 24
interface pos1/0/0
ip add 9.1.1.2 24
步骤2 配置iBGP连接
首先来配置RouterB
[RouterB]bgp 65009
[RouterB-bgp] router-id 2.2.2.2
[RouterB-bgp]peer 9.1.1.2 as-number 65009
[RouterB-bgp]peer 9.1.3.2 as-number 65009
再配置RouterC
[RouterC]bgp 65009
[RouterC-bgp]router-id 3.3.3.3
[RouterC-bgp]peer 9.1.3.1 as-number 65009
[RouterC-bgp]peer 9.1.2.2 as-number 65009
最后配置RouterD
[RouterD]bgp 65009
[RouterD-bgp]router-id 4.4.4.4
[RouterC-bgp]peer 9.1.1.1 as-number 65009
[RouterC-bgp]peer 9.1.2.1 as-number 65009
步骤3 配置eBGP
对于RouterA具体的配置如下
[RoueterA]bgp 65008
[RouterA-bgp]router-id 1.1.1.1
[RouterA-bgp]peer 200.1.1.1 as-number 65009
对于路由器RouterB
[RouterB-bgp]peer 200.1.1.2 as-number 65008
再路由器RouterB上查看BGP对等提的连接状态
[RouterB] display bgp peer
BGP local router ID : 2.2.2.2
Local AS number : 65009
Total number of peers : 3 Peers in established state : 3
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
9.1.3.2 4 65009 56 56 0 00:40:54 Established 0
9.1.1.2 4 65009 49 62 0 00:44:58 Established 0
200.1.1.2 4 65008 49 65 0 00:44:03 Established 1
可以看出,RouterB到其他路由器的BGP连接均已建立。
步骤4 配置RouterA 发布路由8.0.0.0/8
再RouterA上配置具体的发布路由信息
[RouterA-bgp]ipv4-family unicast
[RouterA-bgp-af-ipv4]network 8.0.0.0 255.0.0.0
查看RouterA上的BGP路由表信息
[RouterA] display bgp routing-table
Total Number of Routes: 1
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 8.0.0.0 0.0.0.0 0 0 i
# 查看RouterB的BGP路由表信息。
[RouterB] display bgp routing-table
Total Number of Routes: 1
BGP Local router ID is 2.2.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 8.0.0.0 200.1.1.2 0 0 65008i
# 显示RouterC的BGP路由表。
[RouterC] display bgp routing-table
Total Number of Routes: 1
BGP Local router ID is 3.3.3.3
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
i 8.0.0.0 200.1.1.2 0 100 0 65008i
说明
从路由表可以看出,RouterC虽然学到了AS65008中的8.0.0.0的路由,但因为下一跳200.1.1.2不可达,所以也不是有效路由。
步骤5 配置BGP引入直连路由
[RouterB-bgp]ipv4-family unicast
[RouterB-bgp-af-ipv4]import-route direct
# 显示RouterA的BGP路由表。
[RouterA] display bgp routing-table
Total Number of Routes: 7
BGP Local router ID is 1.1.1.1
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 8.0.0.0 0.0.0.0 0 0 i
*> 9.1.1.0/24 200.1.1.1 0 0 65009?
*> 9.1.1.2/32 200.1.1.1 0 0 65009?
*> 9.1.3.0/24 200.1.1.1 0 0 65009?
*> 9.1.3.2/32 200.1.1.1 0 0 65009?
* 200.1.1.0 200.1.1.1 0 0 65009?
* 200.1.1.2/32 200.1.1.1 0 0 65009?
# 显示RouterC的BGP路由表。
[RouterC] display bgp routing-table
Total Number of Routes: 7
BGP Local router ID is 3.3.3.3
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 8.0.0.0 200.1.1.2 0 100 0 65008i
*>i 9.1.1.0/24 9.1.3.1 0 100 0 ?
*>i 9.1.1.2/32 9.1.3.1 0 100 0 ?
* i 9.1.3.0/24 9.1.3.1 0 100 0 ?
* i 9.1.3.2/32 9.1.3.1 0 100 0 ?
*>i 200.1.1.0 9.1.3.1 0 100 0 ?
*>i 200.1.1.2/32 9.1.3.1 0 100 0 ?
可以看出,到8.0.0.0的路由变为有效路由,下一跳为RouterA的地址。
如果配置成功,则:
RouterC有到8.1.1.1的路由,使用Ping进行验证。
[RouterC] ping 8.1.1.1
PING 8.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 8.1.1.1: bytes=56 Sequence=1 ttl=254 time=31 ms
Reply from 8.1.1.1: bytes=56 Sequence=2 ttl=254 time=47 ms
Reply from 8.1.1.1: bytes=56 Sequence=3 ttl=254 time=31 ms
Reply from 8.1.1.1: bytes=56 Sequence=4 ttl=254 time=16 ms
Reply from 8.1.1.1: bytes=56 Sequence=5 ttl=254 time=31 ms
--- 8.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 16/31/47 ms
#
sysname RouterA
#
interface GigabitEthernet1/0/0
ip address 8.1.1.1 255.0.0.0
#
interface Pos2/0/0
link-protocol ppp
ip address 200.1.1.2 255.255.255.0
#
bgp 65008
router-id 1.1.1.1
peer 200.1.1.1 as-number 65009
#
ipv4-family unicast
undo synchronization
network 8.0.0.0
peer 200.1.1.1 enable
#
return
#
sysname RouterB
#
interface Pos1/0/0
link-protocol ppp
ip address 9.1.1.1 255.255.255.0
#
interface Pos2/0/0
link-protocol ppp
ip address 200.1.1.1 255.255.255.0
#
interface Pos3/0/0
link-protocol ppp
ip address 9.1.3.1 255.255.255.0
#
bgp 65009
router-id 2.2.2.2
peer 9.1.1.2 as-number 65009
peer 200.1.1.2 as-number 65008
peer 9.1.3.2 as-number 65009
#
ipv4-family unicast
undo synchronization
import-route direct
peer 9.1.1.2 enable
peer 200.1.1.2 enable
peer 9.1.3.2 enable
#
return
#
sysname RouterC
#
interface Pos2/0/0
link-protocol ppp
ip address 9.1.2.1 255.255.255.0
#
interface Pos3/0/0
link-protocol ppp
ip address 9.1.3.2 255.255.255.0
#
bgp 65009
router-id 3.3.3.3
peer 9.1.2.2 as-number 65009
peer 9.1.3.1 as-number 65009
#
ipv4-family unicast
undo synchronization
peer 9.1.2.2 enable
peer 9.1.3.1 enable
#
return
#
sysname RouterD
#
interface Pos1/0/0
link-protocol ppp
ip address 9.1.1.2 255.255.255.0
#
interface Pos2/0/0
link-protocol ppp
ip address 9.1.2.2 255.255.255.0
#
bgp 65009
router-id 4.4.4.4
peer 9.1.1.1 as-number 65009
peer 9.1.2.1 as-number 65009
#
ipv4-family unicast
undo synchronization
peer 9.1.1.1 enable
peer 9.1.2.1 enable
#
return