MPLS MBGP ××× 配置_MPLS

 
 
一.基本配置
R1#sh ip int br | in up
Serial0/0                  12.12.12.1      YES manual up                    up     
Serial0/1                  14.14.14.1      YES manual up                    up     
Serial0/2                  15.15.15.1      YES manual up                    up     
Loopback0                  1.1.1.1         YES manual up                    up
 
R2#sh ip int br | in up
Serial0/0                  12.12.12.2      YES manual up                    up     
Serial0/1                  23.23.23.2      YES manual up                    up     
Loopback0                  2.2.2.2         YES manual up                    up 
 
R3#sh ip int br | in up
Serial0/0                  23.23.23.3      YES manual up                    up     
Serial0/1                  36.36.36.3      YES manual up                    up     
Serial0/2                  37.37.37.3      YES manual up                    up     
Loopback0                  3.3.3.3         YES manual up                    up
 
R4#sh ip int br | in up
Serial0/0                  14.14.14.4      YES manual up                    up     
Loopback0                  192.168.0.1     YES manual up                    up 
 
R5#sh ip int br | in up  
Serial0/0                  15.15.15.5      YES manual up                    up     
Loopback0                  192.168.0.1     YES manual up                    up 
 
R6#sh ip int br | in up
Serial0/0                  36.36.36.6      YES manual up                    up     
Loopback0                  192.168.1.1     YES manual up                    up
 
R7#sh ip int br | in up
Serial0/0                  37.37.37.7      YES manual up                    up     
Loopback0                  192.168.1.1     YES manual up                    up
 
R1
router ospf 1
network 1.1.1.1 0.0.0.0 area 0
 network 12.12.12.1 0.0.0.0 area 0
 
R2
router ospf 1
network 2.2.2.2 0.0.0.0 area 0
 network 12.12.12.2 0.0.0.0 area 0
 network 23.23.23.2 0.0.0.0 area 0
 
R3
router ospf 1
 network 3.3.3.3 0.0.0.0 area 0
 network 23.23.23.3 0.0.0.0 area 0
 
二.MPLS基本配置
R1(config)#int s0/0
R1(config-if)#mpls label protocol ldp
R1(config-if)#mpls ip
 
R2(config)#int s0/0
R2(config-if)#mpls label protocol ldp
R2(config-if)#mpls ip
 
R3(config)#int s0/0
R3(config-if)#mpls label protocol ldp
R3(config-if)#mpls ip
 
三.vrf及相关配置
R1(config)#ip vrf v46
R1(config-vrf)#rd 100:46
R1(config-vrf)#route-target both 100:46
R1(config-vrf)#ip vrf v57
R1(config-vrf)#rd 100:57
R1(config-vrf)#route-target both 100:57
R1(config-vrf)#int s0/1
R1(config-if)#ip vrf forwarding v46  
% Interface Serial0/1 IP address 14.14.14.1 removed due to enabling VRF v46
R1(config-if)#ip add 14.14.14.1 255.255.255.0
R1(config-if)#int s0/2
R1(config-if)#ip vrf f
R1(config-if)#ip vrf forwarding v57
% Interface Serial0/2 IP address 15.15.15.1 removed due to enabling VRF v57
R1(config-if)#ip add 15.15.15.1 255.255.255.0
 
R3
ip vrf v46
 rd 100:46
 route-target export 100:46
 route-target import 100:46
!
ip vrf v57
 rd 100:57
 route-target export 100:57
 route-target import 100:57
!
interface Serial0/1
 ip vrf forwarding v46
 ip address 36.36.36.3 255.255.255.0
!
interface Serial0/2
 ip vrf forwarding v57
 ip address 37.37.37.3 255.255.255.0
 
四.配置普通BGP
R1(config)#router bgp 100
R1(config-router)#neighbor 3.3.3.3 remote-as 100
R1(config-router)#neighbor 3.3.3.3 update-source loopback 0
 
R3
!
router bgp 100
bgp log-neighbor-changes
 neighbor 1.1.1.1 remote-as 100
 neighbor 1.1.1.1 update-source Loopback0
 
五.配置PE-CE间路由协议
(1)R1与R4,R5之间
R1(config)#router rip 
R1(config-router)#no auto-summary
R1(config-router)#version 2
R1(config-router)#address-family ipv4 vrf v46
R1(config-router-af)#version 2
R1(config-router-af)#no auto-summary
R1(config-router-af)#network 14.0.0.0
R1(config-router-af)#redistribute bgp 100 metric 1
R1(config-router-af)#router os 2 vrf v57
R1(config-router)#router-id 15.15.15.1
R1(config-router)#network 15.15.15.1 0.0.0.0 a 0
R1(config-router)#redistribute bgp 100 subnets
 
R4
router rip
 version 2
 network 14.0.0.0
 network 192.168.0.0
 no auto-summary
 
R5
router ospf 1
 network 15.15.15.5 0.0.0.0 area 0
 network 192.168.0.1 0.0.0.0 area 0
 
(2)R3与R6,R7之间
R3(config)#router eigrp 1
R3(config-router)#no auto-summary
R3(config-router)#address-family ipv4 vrf v46
R3(config-router-af)#no auto-summary
R3(config-router-af)#autonomous-system 1
R3(config-router-af)#network 36.0.0.0
R3(config-router-af)#redistribute bgp 100 metric 10000 1000 255 100 1500
R3(config)#ip route vrf v57 192.168.1.1 255.255.255.255 37.37.37.7
 
R6
router eigrp 1
 network 36.0.0.0
 network 192.168.1.0
 no auto-summary
 
R7
ip route 192.168.0.1 255.255.255.255 37.37.37.3
 
六.配置MBGP
R1(config)#router bgp 100
R1(config-router)#address-family vpnv4
R1(config-router-af)#neighbor 3.3.3.3 activate
R1(config-router-af)#neighbor 3.3.3.3 send-community both
R1(config-router)#address-family ipv4 vrf v57
R1(config-router-af)#redistribute ospf 2 vrf v57
R1(config-router-af)#address-family ipv4 vrf v46
R1(config-router-af)#redistribute rip
 
R3(config)#router bgp 100
R3(config-router)#address-family vpnv4
R3(config-router-af)#neighbor 1.1.1.1 activate
R3(config-router-af)#neighbor 1.1.1.1 send-community both
R3(config-router-af)#address-family ipv4 vrf v46
R3(config-router-af)#redistribute eigrp 1
R3(config-router-af)#address-family ipv4 vrf v57
R3(config-router-af)#redistribute static
 
七.查看配置
R1#sh ip bgp vpnv4 vrf v46 | in /
*> 14.14.14.0/24    0.0.0.0                  0         32768 ?
*>i36.36.36.0/24    3.3.3.3                  0    100      0 ?
*> 192.168.0.1/32   14.14.14.4               1         32768 ?
*>i192.168.1.1/32   3.3.3.3            2297856    100      0 ?
R1#sh ip bgp vpnv4 vrf v57 | in /
*> 15.15.15.0/24    0.0.0.0                  0         32768 ?
*> 192.168.0.1/32   15.15.15.5              65         32768 ?
*>i192.168.1.1/32   3.3.3.3                  0    100      0 ?
 
R3#sh ip bgp vpnv4 vrf v46 | in /
*>i14.14.14.0/24    1.1.1.1                  0    100      0 ?
*> 36.36.36.0/24    0.0.0.0                  0         32768 ?
*>i192.168.0.1/32   1.1.1.1                  1    100      0 ?
*> 192.168.1.1/32   36.36.36.6         2297856         32768 ?
R3#sh ip bgp vpnv4 vrf v57 | in /
*>i15.15.15.0/24    1.1.1.1                  0    100      0 ?
*>i192.168.0.1/32   1.1.1.1                 65    100      0 ?
*> 192.168.1.1/32   37.37.37.7               0         32768 ?
 
R1#sh ip ro v v46 | in /
     36.0.0.0/24 is subnetted, 1 subnets
B       36.36.36.0 [200/0] via 3.3.3.3, 00:06:13
     192.168.0.0/32 is subnetted, 1 subnets
R       192.168.0.1 [120/1] via 14.14.14.4, 00:00:20, Serial0/1
     192.168.1.0/32 is subnetted, 1 subnets
B       192.168.1.1 [200/2297856] via 3.3.3.3, 00:06:13
     14.0.0.0/24 is subnetted, 1 subnets
C       14.14.14.0 is directly connected, Serial0/1
R1#sh ip ro v v57 | in /
     192.168.0.0/32 is subnetted, 1 subnets
O       192.168.0.1 [110/65] via 15.15.15.5, 00:38:21, Serial0/2
     192.168.1.0/32 is subnetted, 1 subnets
B       192.168.1.1 [200/0] via 3.3.3.3, 00:06:33
     15.0.0.0/24 is subnetted, 1 subnets
C       15.15.15.0 is directly connected, Serial0/2
 
R3#sh ip ro v v46 | in /
     36.0.0.0/24 is subnetted, 1 subnets
C       36.36.36.0 is directly connected, Serial0/1
     192.168.0.0/32 is subnetted, 1 subnets
B       192.168.0.1 [200/1] via 1.1.1.1, 00:08:03
     192.168.1.0/32 is subnetted, 1 subnets
D       192.168.1.1 [90/2297856] via 36.36.36.6, 00:30:39, Serial0/1
     14.0.0.0/24 is subnetted, 1 subnets
B       14.14.14.0 [200/0] via 1.1.1.1, 00:08:03
R3#sh ip ro v v57 | in /
     37.0.0.0/24 is subnetted, 1 subnets
C       37.37.37.0 is directly connected, Serial0/2
     192.168.0.0/32 is subnetted, 1 subnets
B       192.168.0.1 [200/65] via 1.1.1.1, 00:08:08
     192.168.1.0/32 is subnetted, 1 subnets
S       192.168.1.1 [1/0] via 37.37.37.7
     15.0.0.0/24 is subnetted, 1 subnets
B       15.15.15.0 [200/0] via 1.1.1.1, 00:08:08
 
 
在R6 R7上开启debug ip icmp
 
R5#ping 192.168.1.1 so 192.168.0.1 r 1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.0.1
!
Success rate is 100 percent (1/1), round-trip min/avg/max = 72/72/72 ms
 
R7#
*Mar 1 01:14:28.987: ICMP: echo reply sent, src 192.168.1.1, dst 192.168.0.1
 
--------------------------------------------------------------------------------------------------------
 
R4#ping 192.168.1.1 so 192.168.0.1 r 2
Type escape sequence to abort.
Sending 2, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
Packet sent with a source address of 192.168.0.1
!!
Success rate is 100 percent (2/2), round-trip min/avg/max = 60/100/140 ms
 
R6#
*Mar 1 01:15:30.839: ICMP: echo reply sent, src 192.168.1.1, dst 192.168.0.1
*Mar 1 01:15:30.975: ICMP: echo reply sent, src 192.168.1.1, dst 192.168.0.1