BGP 地址族分析 - Address-family

来源:互联网 发布:希拉里 邮件门 岛 知乎 编辑:程序博客网 时间:2024/06/06 17:57

BGP 地址族分析 - Address-family

所谓地址族,就是把ipv4ipv6vpnv4分成不同的,对每个单独进行配置,如下所示:

Redback(config-router)#address-family ?
ipv4   Address family
ipv6   Address family
vpnv4  Address family

如果大家配置过MPLS VPN,那么对ipv4vpnv4这两个地址族应该有些了解。 
其实如果不是有特殊应用(MPLSIpv6),也不会用到这些地址族的概念,直接默认建立全局BGP邻居及属性就可以了。所以可以理解地址组是BGP的一个扩展。 下面我们就这两个地址族进行分析。

 

Ipv4vpnv4地址族的分析:

 

特殊说明:“no bgp default ipv4-unicast” 命令是在全局BGP下禁用单播的传播,在MPLS中,正确的配置就是打上此命令,然后如果需要全局BGP连接或在BGP vpnv4连接,那么就在各个地址族中激活此邻居就可以了。 
但有些全局命令是可以被继承到各个地址族中的。

以下分别分析几种常见的情况

1、如果没有配置“no bgp default ipv4-unicast”,直接在全局配置BGP邻居关系,这样ipv4地址族会默认被激活的,但是不会显示在“show run”中,如下所示:

Redback#config ter
Enter configuration commands, one per line.  End with CNTL/Z.
Redback(config)#router bgp 1
Redback(config-router)#bgp router-id 150.1.1.1
Redback(config-router)#
nei 150.1.2.2 remote-as 1
 
Redback(config-router)#
nei 150.1.2.2 update-source lo0 
Redback(config-router)#address-family vpnv4

Redback(config-router-af)#nei 150.1.2.2 activate
Redback(config-router-af)#nei 150.1.2.2 send-community ex
Redback(config-router-af)#exit
Redback(config-router)#end
Redback#
Redback#sh run | b r b
router bgp 1
no synchronization
bgp router-id 150.1.1.1
neighbor 150.1.2.2 remote-as 1
neighbor 150.1.2.2 update-source Loopback0
no auto-summary
  >>>>>
 没有ipv4地址族
 
address-family vpnv4
neighbor 150.1.2.2 activate
neighbor 150.1.2.2 send-community extended
exit-address-family
!

2、此时如果打上“no bgp default ipv4-unicast” address-family ipv4地址族就会自动显示出来,此时如果再建立BGP全局邻居,这条命令就会生效:

Redback#config ter
Enter configuration commands, one per line.  End with CNTL/Z.
Redback(config)#router bgp 1
Redback(config-router)#
no bgp default ipv4-unicast
 
Redback(config-router)#end
Redback#
Redback#sh run | b r b
router bgp 1
bgp router-id 150.1.1.1
no bgp default ipv4-unicast
neighbor 150.1.2.2 remote-as 1
neighbor 150.1.2.2 update-source Loopback0
!
address-family ipv4
neighbor 150.1.2.2 activate
no auto-summary
 >>>>> 这些命令从全局BGP配置中继承到了ipv4的地址族中
 
no synchronization
exit-address-family
 
!
address-family vpnv4
neighbor 150.1.2.2 activate
neighbor 150.1.2.2 send-community extended
exit-address-family

再加一个全局BGP邻居会怎么样呢?

Rack1R1#config ter
Enter configuration commands, one per line.  End with CNTL/Z.
Redback(config)#router bgp 1
Redback(config-router)#
nei 150.1.3.3 remot 1
 
Redback(config-router)#
nei 150.1.3.3 update-source lo0 
Redback(config-router)#end
Redback#
Redback#sh run | b r b
router bgp 1
bgp router-id 150.1.1.1
no bgp default ipv4-unicast
neighbor 150.1.2.2 remote-as 1
neighbor 150.1.2.2 update-source Loopback0
neighbor 150.1.3.3 remote-as 1
neighbor 150.1.3.3 update-source Loopback0
!
address-family ipv4     >>>>>
 ipv4地址族中没有150.1.3.3 的邻居 
neighbor 150.1.2.2 activate
no auto-summary
no synchronization
exit-address-family
!
address-family vpnv4
neighbor 150.1.2.2 activate
neighbor 150.1.2.2 send-community extended
exit-address-family
!

由于“no bgp default ipv4-unicast”命令的关系,虽然建立了全局BGP的邻居,但它是不会出现在任何地址族中的。如果想在ipv4vpnv4中起效果,就得在地址族中用“nei 150.1.3.3 active”把邻居激活:

Redback(config-router)#address-family ipv4 
Redback(config-router-af)#
nei 150.1.3.3 activate 
Redback(config-router-af)#exit
Redback(config-router)#end
Redback#
Redback#sh run | b r b
router bgp 1
bgp router-id 150.1.1.1
no bgp default ipv4-unicast
neighbor 150.1.2.2 remote-as 1
neighbor 150.1.2.2 update-source Loopback0
neighbor 150.1.3.3 remote-as 1
neighbor 150.1.3.3 update-source Loopback0
!
address-family ipv4
neighbor 150.1.2.2 activate
neighbor 150.1.3.3 activate 
no auto-summary
no synchronization
exit-address-family
!
address-family vpnv4
neighbor 150.1.2.2 activate
neighbor 150.1.2.2 send-community extended
exit-address-family
0 0
原创粉丝点击