一、技术介绍
使用BGP协议要将两个网络建立邻居关系,因为卫星走的是单向链路,不能建立起邻居关系,为了使BGP协议建立起邻居关系,我们在路由器中使用了代表路由器本身地址的环路地址,环路地址是逻辑地址,这样在BGP要建立邻居是路由器间均使用环路地址,因为环路地址是双向的。
在建立BGP动态路由时,要使路由器间处在一个自治域中,建立邻居路由更新从环路地址更新。
由于BGP生成动态协议是建立在TCP的基础上,它通过环路地址的邻居关系建立双向握手,从而生成动态路由,它的级别是200,所以ISDN备份的动态路由级别要大于200,级别越大优先级越低。
策略路由在主站和小站之间都不是不须的,为了使配置易于理解,建议配置策略路由。
在BGP发出握手请求时,要有一条路由到达对方路由器,我们的配置中使用默认路由到达DBN24 (假如没有默认路由必须增加到对方环路地址的静态路有),所以在DBN24上要添加到对方(远程小站路由器)环路地址的静态路由。
远程小站路由器也必须配置一条到达主站环路地址的静态路由(假如小站没有默认路由)。
二、配置
路由器中建立环路地址:
Interface loopbackup 0
Ip address 172.31.254.1 255.255.255.0
路由器中建立BGP 自治域:
Router bgp 65500
Network 172.16.5.0 mask 255.255.255.0 (本地网络)
Network 172.16.6.0 mask 255.255.255.0 (本地网络)
Neighbor 172.25.10.1 remote-as 65500 (使邻居在同一个自治域)
Neighbor 172.25.10.1 update-source loopback0(设置邻居更新在环路接口0)
Neighbor 172.25.10.1 route-map jinhua in (使用策略路由)
策略路由样例:
route-map jinhua permit 5
macth ip address 30
set ip next-hop 172.16.5.200
策略路由观察的访问列表:
Access-list 30 permit ip 172.19.10.0 0.0.0.255
三、轻易忽略的地方及问题
1、轻易忽略的地方是:在路由器中有了路由,因为路由是到dbn24的,所以不能忘了在dbn24中的各远程点路由部分增加到对方环路地址的路由。
2、问题1:bgp中的network地址指的是什么地址?
答 :network地址指的是与邻居网络能建立通信的地址,在本网络中指本地两个网段地址。
3、问题2:为什么邻居与本地网络必须配置在同一个自治域内?
答:不在一个自治域的路由器必须是直接相联的才可以互相通信。
4、问题3:路由表中配置了默认路由,同时还有浮动静态ISDN路由,级别是201,那么静态路由比默认路由级别高,为什么在建立TCP会话中不使用浮动静态路由,而使用默认路由。
答:因为在BGP建立握手时,它寻找的目标地址是对方的环路地址,而ISDN的目标地址是对方的以太口地址,所以建立TCP握手使用默认路由(也可以设置一条指向对方环路地址的静态路由,级别明显高于ISDN路由,易于理解)。BGP建立动态路由的级别是200,在建立TCP握手后,它生成的路由表也是指向对方以太口地址,但它的优先级高于ISDN设置的路由级别201,而禁止ISDN路由生效,假如不能建立起指向对方以太口的BGP动态路由,那么在主站与小站的连接时,就是启用ISDN路由,引起ISDN拨号。
5、问题4:为什么配置串口的时候,必须加上ignore-dcd、no keepalive、ip igmp unidirectional-link、ip multicast ttl-threshold 14、ip pim dense-mode、ip igmp static-group 239.16.5.144。
答:因为在卫星链路中路由器串口不发送cd信号必须忽略,keepalive是指第二层的保持活动协议,假如让keepalive生效,那么它将监测某一链路的第二层双向是否保持活动,由于卫星链路在串口是单向的(小站指向主站),它将会是串口down掉,ip igmp unidirectional-link标示串口是单向链路,ip multicast ttl-threshold 14标示让小站的组播包的默认ttl-threshold为14,而让小站的组播包不至于未到主站就被丢失,也不能设大于14的值。ip pim dense-mode启用协议无关组播协议,ip igmp static-group 239.16.5.144标示小站的路由器加入239.16.5.144组播组。
四、BGP是否生效查询
1、使用命令:show ip bgp neighbors 查询bgp 状态。(注重黑体)
tongji#sh ip bgp neighbors
BGP neighbor is 172.25.10.1, remote AS 65500, internal link
BGP version 4, remote router ID 172.25.10.1
BGP state = Established, up for 00:41:10
Last read 00:00:11, hold time is 180, keepalive interval is 60 seconds
Neighbor capabilities:
Route refresh: advertised and received(new)
Address family IPv4 Unicast: advertised and received
Received 1763 messages, 0 notifications, 0 in queue
Sent 1766 messages, 0 notifications, 0 in queue
Route refresh request: received 0, sent 0
Default minimum time between advertisement runs is 5 seconds
For address family: IPv4 Unicast
BGP table version 4, neighbor version 4
Index 1, Offset 0, Mask 0x2
1 accepted prefixes consume 36 bytes
Prefix advertised 6, suppressed 0, withdrawn 2
Number of NLRIs in the update sent: max 2, min 0
Connections established 3; dropped 2
Last reset 00:41:43, due to User reset
Connection state is ESTAB, I/O status: 1, unread input bytes: 0
Local host: 172.31.254.1, Local port: 179
Foreign host: 172.25.10.1, Foreign port: 11045
Enqueued packets for retransmit: 0, input: 0 mis-ordered: 0 (0 bytes)
Event Timers (current time is 0x644BFAC):
Timer Starts Wakeups Next
Retrans 48 1 0x0
TimeWait 0 0 0x0
AckHold 45 39 0x0
SendWnd 0 0 0x0
KeepAlive 0 0 0x0
GiveUp 0 0 0x0
PmtuAger 0 0 0x0
DeadWait 0 0 0x0
iss: 1548750689 snduna: 1548751630 sndnxt: 1548751630 sndwnd: 15985
irs: 127891366 rcvnxt: 127892303 rcvwnd: 15985 delrcvwnd: 399
SRTT: 771 ms, RTTO: 806 ms, RTV: 35 ms, KRTT: 0 ms
minRTT: 568 ms, maxRTT: 1032 ms, ACK hold: 200 ms
Flags: passive open, nagle, gen tcbs
Datagrams (max data segment is 536 bytes):
Rcvd: 90 (out of order: 0), with data: 45, total data bytes: 936
Sent: 87 (retransmit: 1, fastretransmit: 0), with data: 46, total data bytes: 940
2、使用命令:show ip route (注重黑体)
tongji#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is 172.16.5.200 to network 0.0.0.0
172.16.0.0/24 is subnetted, 7 subnets
C 172.16.4.0 is directly connected, FastEthernet0/0.4
C 172.16.5.0 is directly connected, FastEthernet0/0.5
C 172.16.6.0 is directly connected, FastEthernet0/0.6
C 172.16.1.0 is directly connected, FastEthernet0/0.1
C 172.16.2.0 is directly connected, FastEthernet0/0.2
C 172.16.3.0 is directly connected, FastEthernet0/0.3
S 172.16.100.0 [1/0] via 172.16.5.200
172.19.0.0/16 is variably subnetted, 11 subnets, 2 masks
B 172.19.10.0/24 [200/0] via 172.25.10.1, 00:57:53
C 172.19.101.24/30 is directly connected, Serial4/2
C 172.19.101.28/30 is directly connected, Serial4/3
C 172.19.101.16/30 is directly connected, Serial4/0
C 172.19.101.20/30 is directly connected, Serial4/1
C 172.19.101.8/30 is directly connected, Serial3/2
C 172.19.101.12/30 is directly connected, Serial3/3
C 172.19.101.0/30 is directly connected, Serial3/0
C 172.19.101.4/30 is directly connected, Serial3/1
C 172.19.101.32/30 is directly connected, Serial5/0
C 172.19.101.36/30 is directly connected, Serial5/1
172.20.0.0/24 is subnetted, 1 subnets
S 172.20.2.0 [1/0] via 10.0.20.2
172.31.0.0/24 is subnetted, 1 subnets
C 172.31.254.0 is directly connected, Loopback0
203.91.153.0/29 is subnetted, 1 subnets
C 203.91.153.240 is directly connected, FastEthernet0/0.5
210.74.232.0/32 is subnetted, 1 subnets
S 210.74.232.178 [1/0] via 172.16.1.28
10.0.0.0/24 is subnetted, 2 subnets
C 10.0.20.0 is directly connected, Dialer20
C 10.0.254.0 is directly connected, Dialer10
S* 0.0.0.0/0 [1/0] via 172.16.5.200
S 192.168.0.0/16 [1/0] via 172.16.1.253
S 202.120.176.0/20 [1/0] via 172.16.1.253
3、 更改bgp后,必须更新,使用命令:
clear ip bgp *
上一篇 BGP:边界网关协议概述
下一篇 BGP路由的优化