Service Professional Outstanding Teamwork Obtain
PE1(config-router)#no bgp default ipv4-unicast //在全局BGP进程下,禁用单播的传播 PE1(config-router)#neighbor 3.3.3.3 remote-as 1
PE1(config-router)#neighbor 3.3.3.3 update-source lo0 PE1(config-router)#address-family vpnv4 //进入MP-BGP的VPNv4地址族
PE1(config-router-af)#neighbor 3.3.3.3 activate //手动激活BGP邻居,支持VPNv4路由的传播 PE1(config-router-af)#neighbor 3.3.3.3 send-community extended //默认支持扩展MP-BGP社团属
性,用于支持RT的传播,如果同时需要支持标准社团属性,那么将关键字改为both
PE2(config)#router bgp 1
PE2(config-router)#no bgp default ipv4-unicast PE2(config-router)#neighbor 2.2.2.2 remote-as 1
PE2(config-router)#neighbor 2.2.2.2 update-source lo0 PE2(config-router)#address-family vpnv4
PE2(config-router-af)#neighbor 2.2.2.2 activate
在MPLS中,应配置no bgp default ipv4-unicast命令。此时,BGP的策略应在其地址族中配置,而不是在全局BGP中配置。
如果没有配置该命令,直接在全局配置BGP邻居关系,默认会把全局BGP邻居关系继承到IPv4的地址族中,但不会显示在show run中。
3.2.5 配置PE-CE路由
PE1(config)#ip route vrf cisco 192.168.1.0 255.255.255.0 10.1.1.1 //配置VRF静态路由 PE1(config-router)#address-family ipv4 vrf cisco //进入BGP的VRF地址族 PE1(config-router-af)#redistribute static //将客户静态路由发布到MP-BGP中
CE1(config)#ip route 172.16.1.0 255.255.255.0 10.1.1.2
PE2(config)#ip route vrf cisco 172.16.1.0 255.255.255.0 10.2.1.4 PE2(config-router)#address-family ipv4 vrf cisco PE2(config-router-af)#redistribute static
CE1(config)#ip route 192.168.1.0 255.255.255.0 10.2.1.3
静态路由的配置是最简单的。要支持VRF,静态路由需要能够被VRF识别,以便能够将其配置在PE上实现VRF中的流量转发。要确保静态路由能够在其他PE路由器上以VPNv4路由的形式被学习到,必须在指定VRF中将静态路由重发布进BGP的地址族。
3.2.6 查看VRF
PE1#show ip protocols vrf cisco SPOTO 全球 培训 ● 项目 ● 人才
6 / 9
//查看与VRF中所绑定的路由协议
Service Professional Outstanding Teamwork Obtain
Routing Protocol is \
Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set IGP synchronization is disabled
Automatic route summarization is disabled Redistributing: static Maximum path: 1
Routing Information Sources:
Gateway Distance Last Update 3.3.3.3 200 00:13:53 Distance: external 20 internal 200 local 20
PE1#show ip route vrf cisco
172.16.0.0/24 is subnetted, 1 subnets
B 172.16.1.0 [200/0] via 3.3.3.3, 00:14:55 10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0 S 192.168.1.0/24 [1/0] via 10.1.1.1
PE2#show ip route vrf cisco
172.16.0.0/24 is subnetted, 1 subnets S 172.16.1.0 [1/0] via 10.2.1.4 10.0.0.0/24 is subnetted, 1 subnets
C 10.2.1.0 is directly connected, FastEthernet0/0 B 192.168.1.0/24 [200/0] via 2.2.2.2, 00:22:40
3.2.7 查看LFIB
PE1#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop tag tag or VC or Tunnel Id switched interface
16 Pop tag 3.3.3.3/32 0 Fa0/1 23.1.1.3 17 Untagged 192.168.1.0/24[V] 912 Fa0/0 10.1.1.1
PE2#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop tag tag or VC or Tunnel Id switched interface
16 Pop tag 2.2.2.2/32 0 Fa0/1 23.1.1.2 17 Untagged 172.16.1.0/24[V] 912 Fa0/0 10.2.1.4
SPOTO 全球 培训 ● 项目 ● 人才
7 / 9
Service Professional Outstanding Teamwork Obtain
3.2.8 查看MP-BGP
PE1#show ip bgp vpnv4 all labels //查看VPNv4所关联的标签 Network Next Hop In label/Out label Route Distinguisher: 1:1 (cisco)
172.16.1.0/24 3.3.3.3 nolabel/17 192.168.1.0 10.1.1.1 17/nolabel
PE1#show ip bgp vpnv4 rd 1:1 //查看MP-BGP RD为1:1的路由信息 BGP table version is 15, local router ID is 2.2.2.2
Network Next Hop Metric LocPrf Weight Path Route Distinguisher: 1:1 (default for vrf cisco)
*>i172.16.1.0/24 3.3.3.3 0 100 0 ? *> 192.168.1.0 10.1.1.1 0 32768 ?
PE1#show ip bgp vpnv4 all 172.16.1.0
BGP routing table entry for 1:1:172.16.1.0/24, version 5 Paths: (1 available, best #1, table cisco) Not advertised to any peer Local
3.3.3.3 (metric 11) from 3.3.3.3 (3.3.3.3)
Origin incomplete, metric 0, localpref 100, valid, internal, best Extended Community: RT:1:1 //MP-BGP所携带的扩展社团属性 mpls labels in/out nolabel/17
3.2.9 结果测试
CE1#show ip route
172.16.0.0/24 is subnetted, 1 subnets S 172.16.1.0 [1/0] via 10.1.1.2 10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, FastEthernet0/0 C 192.168.1.0/24 is directly connected, Loopback0
CE2#show ip route
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, Loopback0 10.0.0.0/24 is subnetted, 1 subnets
C 10.2.1.0 is directly connected, FastEthernet0/0 S 192.168.1.0/24 [1/0] via 10.2.1.3
SPOTO 全球 培训 ● 项目 ● 人才
8 / 9
Service Professional Outstanding Teamwork Obtain
PE1#ping vrf cisco 192.168.1.1 Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds: !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/36/64 ms
PE2#ping vrf cisco 172.16.1.1 Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds: !!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/44/68 ms
CE1#traceroute 172.16.1.1 source lo0 Type escape sequence to abort. Tracing the route to 172.16.1.1
1 10.1.1.2 48 msec 28 msec 32 msec
2 10.2.1.3 [MPLS: Label 17 Exp 0] 88 msec 36 msec 68 msec 3 10.2.1.4 136 msec * 156 msec
CE2#traceroute 192.168.1.1 source lo0 Type escape sequence to abort. Tracing the route to 192.168.1.1
1 10.2.1.3 32 msec 60 msec 32 msec
2 10.1.1.2 [MPLS: Label 17 Exp 0] 64 msec 64 msec 60 msec 3 10.1.1.1 96 msec * 124 msec
SPOTO 全球 培训 ● 项目 ● 人才
9 / 9