雏鹰部落

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 4863|回复: 8

[讨论/求助] BGP 的配置命令

[复制链接]
发表于 2007-12-11 11:36:48 | 显示全部楼层 |阅读模式
BGP 的配置命令
1)Router(config)# router bgp (autonomous-system)
   [ex] Router(config)#router bgp 100
一个路由器只可以属于一个自治系统。
(可以实验一下在一个路由器上如果配了router bgp 100后再配置 router bgp 200 会如何?)
2)Router(config-router)#neighbor {ip-address | peer-group-name} remote-as autonomous-system
[ex]  Router(config-router)#neighbor 22.22.22.22 remote-as 200
这个命令通过remote-as号来区分到底邻居是内部的还是外部的邻居。
前提是必须要有可以到达邻居的路由。
如果没有到达邻居的路由的话,有什么办法?(手工指定静态路由)
show ip bgp summary查看一下状态应该是idle(?)
对方收到你的open 消息包后,它要查找一下他的bgp邻居表,如果邻居表中的ip地址匹配发包的源ip地址,则对方会进open confirm 的确认。
3)两个想建立bgp邻居的路由器有多条链路连接的时候,一般可以用环回接口作为建立邻居的地址。(有什么好处?)
命令:Router(config-router)#neighbor {ip-address | peer-group-name} **-source
interface-type interface-number
[ex] Router(config-router)#neighbor 22.22.22.22 **-source loopback 1
如果是建立ibgp邻居,一般没有什么问题(一般有igp保证了!)
但是想建立ebgp邻居,会有以下两个问题。
A)关于TTL的问题
   建立ebgp邻居报文的ttl=1,如果是使用环回接口建立的话,必须修改其ttl值,至少要改成2
Router(config-router)#neighbor {ip-address | peer-group-name} ebgp-multihop [ttl]
[ex]Router(config-router)#neighbor 22.22.22.22 ebgp-multihop 2
   但是注意如果ttl的值改的太大了也会产生其他问题。
B) 双方的路由存在吗?
   ebgp邻居跨越两个自制系统,如果不是直连接口是没有路由的。(这时候什么解决办法最好?)
4)关于[下一跳]next-hop:
在bgp中,下一跳不是指下一跳的路由器,而是指的是到达下一个as的ip地址
默认在ibgp中的缺省情况下,是不修改下一跳的地址的。(有什么好处?)
但是会带来问题:ibgp内部路由器中,根本没有到达另外那个as的路由器的路由。所以一般,都会把发给ibgp邻居的报文中的下一跳改成自己。
命令:Router(config-router)#neighbor {ip-address | peer-group-name} next-hop-self
[ex]Router(config-router)#neighbor 22.22.22.22 next-hop-self
总体配置示例:
router bgp 100
neighbor 22.22.22.22 remote-as 200
neighbor 22.22.22.22 **-source loopback 1
neighbor 22.22.22.22 next-hop-self
next-hop的设置对多路访问网络的影响
a)如果是在以太网环境中,防止多余的转发。
b)如果是在帧中继网络中,如果没有建立虚电路的话。
5)使用Peer Group
好处:简化配置,避免重复计算。
6)宣告网段
Router(config-router)#network network-number [mask network-mask] [route-map map-tag]
[ex] Router(config-router)#network 12.168.0.1 255.255.0.0
可以通告任何只要在路由表中能查找到的路由。如果不带掩码,则通告主类网络,带掩码表示通告一个精确匹配的网络。

7)同步原则
如果一个通过ibgp学习到的路由,如果没有通过igp学习到,是不会使用和通告的。(较先进的版本是默认关闭的----但要保证全互连,预防路由黑洞。)

一个具体的总体配置示例:
1. RouterB(config)# router bgp 65000
2. RouterB(config-router)# neighbor 10.1.1.2 remote-as 64520
3. RouterB(config-router)# neighbor 192.168.2.2 remote-as 65000
4. RouterB(config-router)# neighbor 192.168.2.2 **-source Loopback 0
5. RouterB(config-router)# neighbor 192.168.2.2 next-hop-self
6. RouterB(config-router)# network 172.16.10.0 mask 255.255.255.0
7. RouterB(config-router)# network 192.168.1.0
8. RouterB(config-router)# network 192.168.3.0
9. RouterB(config-router)# no synchronization
BGP的几种状态
1。idle:在路由表中试图查找到达某个邻居的路由
2。connect:找到路由后进行tcp的三次握手
3。open sent:发送open报文,夹带bgp会话的参数
4。open confirm:受到来自对方的open报文。
(如果在open sent后没有收到对方的确认的话,会到active状态)
5。established:连接建立,开始路由。
用什么命令看目前状态?show ip bgp summary 或者 show ip bgp neighbors(详细的)
如果表现为idle,或者是active一般是什么原因?(对方没有返回的路由,对方的邻居建立错误,as号错误等)
BGP邻居的验证
Router(config-router)#neighbor {ip-address | peer-group-name} password string
[ex]neighbor 10.64.0.2 password v3535534%@#
重启BGP的会话
  硬重启(hard reset)
       router#clear ip bgp */[neighor-address]
  软重启(soft reset)
Router#clear ip bgp {*|neighbor-address} [soft out]   //改变出口策略时,使用。

Router(config-router)#neighbor [ip-address] soft-reconfiguration inbound //旧版本的
Router#clear ip bgp {*|neighbor-address} soft in //改变入口策略时,使用。
发表于 2007-12-11 13:09:50 | 显示全部楼层
我发现楼主最近发的几个技术贴都很不错啊~~~

顶!!!
发表于 2007-12-11 13:26:00 | 显示全部楼层
我来顶下啊    BGP  很不错啊
发表于 2007-12-11 13:27:11 | 显示全部楼层
我发现楼主的技术帖好象课件里面的内容。
发表于 2007-12-11 14:14:21 | 显示全部楼层
又有人占了..嗨..来晚了...
发表于 2009-8-27 19:09:51 | 显示全部楼层
thank you !!!!!!!!!!!!!!!!!!!!!
发表于 2009-11-21 20:21:37 | 显示全部楼层
thank you!!!!!!!!1
发表于 2010-8-23 14:35:59 | 显示全部楼层
精辟!!!
发表于 2013-7-27 20:13:53 | 显示全部楼层
太感谢啦
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|熊猫同学技术论坛|小黑屋| 网络工程师论坛 ( 沪ICP备09076391 )

GMT+8, 2024-4-26 22:29 , Processed in 0.078043 second(s), 18 queries , Gzip On.

快速回复 返回顶部 返回列表