实验拓扑
实验配置
建立两个AS 65001、65000
AS65000内跑OSPF,并在R1上发布三个网段100.1.1.1 100.1.2.1 100.1.3.1 在R3 R5上聚合后发布给R4。
每台路由器都有一个对应的loopback地址。
实验过程
Total Number of Routes: 10
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
* i 1.1.1.1/32 1.1.4.1 1562 100 0 ?
* i 1.1.5.1 1562 100 0 ?
* i 1.1.4.0/30 1.1.5.1 3124 100 0 ?
* i 1.1.5.0/30 1.1.4.1 3124 100 0 ?
* i 3.3.3.3/32 1.1.5.1 1562 100 0 ?
*>i 4.4.4.4/32 1.1.4.1 0 100 0 65001i
* i 1.1.5.1 0 100 0 65001i
* i 5.5.5.5/32 1.1.4.1 1562 100 0 ?
*>i 100.1.0.0/16 1.1.4.1 0 100 0 ?
* i 1.1.5.1 0 100 0 ?
% Current terminal debugging is on
% Current terminal monitor is on
X.X.X.X Specify ipv4 peer address
X:X::X:X Specify ipv6 peer address
all All information
bfd BFD Information
detail Detail Information
event FSM Event
graceful-restart Graceful Restart
keepalive Keepalive packet
open Open packet
packet All packet information
raw-packet Dump raw packets BGP read from or send to sockets
route-refresh Route Refresh packet
timer Dump debugging information of bgp timers
update Update packet
*Apr 7 10:54:17:875 2013 R1 RM/6/RMDEBUG:
BGP.: 1.1.5.1 Recv KEEPALIVE
Length: 19
*Apr 7 10:54:31:907 2013 R1 RM/6/RMDEBUG:
BGP.: 1.1.4.1 Recv KEEPALIVE
Length: 19
*Apr 7 10:54:34:485 2013 R1 RM/6/RMDEBUG:
BGP.: 1.1.5.1 Send KEEPALIVE
Length 19
更改默认的 local-preference
[R3-bgp]default local-preference 80
*Apr 7 10:54:45:813 2013 R1 RM/6/RMDEBUG:
BGP.: Recv UPDATE from peer 1.1.4.1 with following destinations :
Update message length : 56
Local Pref : 80
MED : 1562
Origin : Incomplete
AS Path :
Next Hop : 1.1.4.1
1.1.1.1/32,
*Apr 7 10:54:45:954 2013 R1 RM/6/RMDEBUG:
BGP.: Recv UPDATE from peer 1.1.4.1 with following destinations :
Update message length : 56
Local Pref : 80
MED : 3124
Origin : Incomplete
AS Path :
Next Hop : 1.1.4.1
1.1.5.0/30,
*Apr 7 10:54:45:954 2013 R1 RM/6/RMDEBUG:
BGP.: Recv UPDATE from peer 1.1.4.1 with following destinations :
Update message length : 56
Local Pref : 80
MED : 1562
Origin : Incomplete
AS Path :
Next Hop : 1.1.4.1
5.5.5.5/32,
*Apr 7 10:54:45:954 2013 R1 RM/6/RMDEBUG:
BGP.: Recv UPDATE(Withdraw) from peer 1.1.4.1 for destinations :
100.1.0.0/16,
*Apr 7 10:54:45:954 2013 R1 RM/6/RMDEBUG:
BGP.: Recv UPDATE from peer 1.1.4.1 with following destinations :
Update message length : 60
Local Pref : 80
MED : 0
Origin : IGP
AS Path : 65001
Next Hop : 1.1.4.1
4.4.4.4/32,
*Apr 7 10:54:45:954 2013 R1 RM/6/RMDEBUG:
BGP.: Recv UPDATE from peer 1.1.4.1 with following destinations :
Update message length : 66
Local Pref : 80
MED : 0
Origin : Incomplete
AS Path :
Next Hop : 1.1.4.1
100.1.0.0/16,
*Apr 7 10:54:51:282 2013 R1 RM/6/RMDEBUG:
BGP.: 1.1.4.1 Send KEEPALIVE
Length 19
Routing Tables: Public
Destinations : 17 Routes : 18
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
1.1.3.0/30 OSPF 10 3124 1.1.5.1 S0/6/3
OSPF 10 3124 1.1.4.1 S0/6/1
1.1.4.0/30 Direct 0 0 1.1.4.2 S0/6/1
1.1.4.1/32 Direct 0 0 1.1.4.1 S0/6/1
1.1.4.2/32 Direct 0 0 127.0.0.1 InLoop0
1.1.5.0/30 Direct 0 0 1.1.5.2 S0/6/3
1.1.5.1/32 Direct 0 0 1.1.5.1 S0/6/3
1.1.5.2/32 Direct 0 0 127.0.0.1 InLoop0
3.3.3.3/32 OSPF 10 1562 1.1.4.1 S0/6/1
4.4.4.4/32 BGP 255 0 1.1.5.1 S0/6/3
5.5.5.5/32 OSPF 10 1562 1.1.5.1 S0/6/3
100.1.0.0/16 BGP 255 0 1.1.5.1 S0/6/3
100.1.1.1/32 Direct 0 0 127.0.0.1 InLoop0
100.1.2.1/32 Direct 0 0 127.0.0.1 InLoop0
100.1.3.1/32 Direct 0 0 127.0.0.1 InLoop0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
*Apr 7 10:55:02:922 2013 R1 RM/6/RMDEBUG:
BGP.: 1.1.5.1 Recv KEEPALIVE
Length: 19 dis
*Apr 7 10:55:05:235 2013 R1 RM/6/RMDEBUG:
BGP.: 1.1.4.1 Recv KEEPALIVE
Length: 19 bgp ro
Total Number of Routes: 10
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
* i 1.1.1.1/32 1.1.4.1 1562 80 0 ?
* i 1.1.5.1 1562 100 0 ?
* i 1.1.4.0/30 1.1.5.1 3124 100 0 ?
* i 1.1.5.0/30 1.1.4.1 3124 80 0 ?
* i 3.3.3.3/32 1.1.5.1 1562 100 0 ?
*>i 4.4.4.4/32 1.1.5.1 0 100 0 65001i
* i 1.1.4.1 0 80 0 65001i
* i 5.5.5.5/32 1.1.4.1 1562 80 0 ?
*>i 100.1.0.0/16 1.1.5.1 0 100 0 ?
* i 1.1.4.1 0 80 0 ?
*Apr 7 10:55:11:94 2013 R1 RM/6/RMDEBUG:
BGP.: 1.1.5.1 Send KEEPALIVE
Length 19
-------------------------------------------------------------------------------------------
改MED后
[R4]dis bgp ro
Total Number of Routes: 9
BGP Local router ID is 4.4.4.4
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
*> 1.1.1.1/32 1.1.6.2 10 0 65000?
* 1.1.2.2 12 0 65000?
*> 1.1.4.0/30 1.1.2.2 12 0 65000?
*> 1.1.5.0/30 1.1.6.2 10 0 65000?
*> 3.3.3.3/32 1.1.2.2 12 0 65000?
*> 4.4.4.4/32 0.0.0.0 0 0 i
*> 5.5.5.5/32 1.1.6.2 10 0 65000?
*> 100.1.0.0/16 1.1.6.2 10 0 65000?
* 1.1.2.2 12 0 65000?
[R4]
发现 1.1.1.1 的下一跳是1.1.6.2
[R5-bgp]default med 5
[R4]dis bgp ro
Total Number of Routes: 9
BGP Local router ID is 4.4.4.4
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
*> 1.1.1.1/32 1.1.2.2 5 0 65000?
* 1.1.6.2 10 0 65000?
*> 1.1.4.0/30 1.1.2.2 5 0 65000?
*> 1.1.5.0/30 1.1.6.2 10 0 65000?
*> 3.3.3.3/32 1.1.2.2 5 0 65000?
*> 4.4.4.4/32 0.0.0.0 0 0 i
*> 5.5.5.5/32 1.1.6.2 10 0 65000?
*> 100.1.0.0/16 1.1.2.2 5 0 65000?
* 1.1.6.2 10 0 65000?
如上,改了后下一跳变动了