实验拓扑:

图片

mpls-***步骤:

1.RIP
2.MPLS
3.VRF
4.ip vrf forwarding
5.PE-CE间的路由协议
6.MP-BGP
7.不同VRF间通信,所需配置
8.测试成功
使用到的show 命令
show ip route
show ip int br
show ip bgp ***v4  vrf A
show ip bgp ***v4 all
show ip route vrf A
show ip vrf A
show mpls ldp neighbor
show mpls forwarding-table
show mpls ldp neighbor
show ip bgp all summary
R1#ping vrf A 8.8.8.8
R5#ping 8.8.8.8
9.有可能有的步骤和命令,没有写出来,大体思路是这样!




R1#sh run
!
version 15.1
!
hostname R1
!
ip vrf A
rd 1:100
route-target export 1:100
route-target export 2:100
route-target import 1:100
route-target import 2:100
!        
ip cef
no ipv6 cef
!
mpls label range 100 199
mpls label protocol ldp
mpls ldp neighbor 2.2.2.2 targeted ldp
multilink bundle-name authenticated
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Ethernet1/0
ip address 10.1.12.1 255.255.255.0
duplex full
mpls ip
!
interface Ethernet1/1
ip vrf forwarding A
ip address 10.1.14.1 255.255.255.0
duplex full
!
router ospf 1 vrf A
router-id 1.1.1.1
redistribute bgp 1 subnets
network 1.1.1.0 0.0.0.255 area 1
network 10.1.14.0 0.0.0.255 area 1
!
router rip
version 2
network 1.0.0.0
network 10.0.0.0
no auto-summary
!
router bgp 1
bgp router-id 1.1.1.1
bgp log-neighbor-changes
neighbor 3.3.3.3 remote-as 1
neighbor 3.3.3.3 update-source Loopback0
!        
address-family ***v4
 neighbor 3.3.3.3 activate
 neighbor 3.3.3.3 send-community extended
exit-address-family
!
address-family ipv4 vrf A
 redistribute ospf 1
exit-address-family
!
ip forward-protocol nd
!
mpls ldp router-id Loopback0 force
!
control-plane
!
end
R1#ping vrf A 8.8.8.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/94/128 ms
R1#ping vrf A 7.7.7.7
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 7.7.7.7, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/94/120 ms
R1#ping vrf A 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/76/112 ms

R2#sh run
version 15.1
hostname R2
!
ip cef
no ipv6 cef
!
mpls label range 200 299
mpls label protocol ldp
mpls ldp neighbor 1.1.1.1 targeted ldp
multilink bundle-name authenticated
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Ethernet1/0
ip address 10.1.23.2 255.255.255.0
duplex full
mpls ip
!
interface Ethernet1/1
ip address 10.1.12.2 255.255.255.0
duplex full
mpls ip
!
router rip
version 2
network 2.0.0.0
network 10.0.0.0
no auto-summary
!
ip forward-protocol nd
!
mpls ldp router-id Loopback0 force
!
control-plane
!
end

R3#sh run
version 15.1
!
hostname R3
!
no aaa new-model
!
ip vrf A
rd 1:100
route-target export 1:100
route-target export 2:100
route-target import 1:100
route-target import 2:100
!        
ip vrf B
rd 2:100
route-target export 2:100
route-target import 2:100
!
ip cef
no ipv6 cef
!
mpls label range 300 399
mpls label protocol ldp
multilink bundle-name authenticated
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Loopback1
ip address 33.3.3.3 255.255.255.255
!
interface Ethernet1/0
ip vrf forwarding A
ip address 10.1.36.3 255.255.255.0
duplex full
!
interface Ethernet1/1
ip address 10.1.23.3 255.255.255.0
duplex full
mpls ip
!
interface Ethernet1/2
ip vrf forwarding B
ip address 10.1.38.3 255.255.255.0
duplex full
!
router ospf 1 vrf A
router-id 3.3.3.3
redistribute bgp 1 subnets
network 3.3.3.0 0.0.0.255 area 1
network 10.1.36.0 0.0.0.255 area 1
!
router ospf 2 vrf B
router-id 33.3.3.3
redistribute bgp 1 subnets
network 10.1.38.0 0.0.0.255 area 2
network 33.3.3.0 0.0.0.255 area 2
!
router rip
version 2
network 3.0.0.0
network 10.0.0.0
no auto-summary
!
router bgp 1
bgp router-id 3.3.3.3
bgp log-neighbor-changes
neighbor 1.1.1.1 remote-as 1
neighbor 1.1.1.1 update-source Loopback0
!
address-family ***v4
 neighbor 1.1.1.1 activate
 neighbor 1.1.1.1 send-community extended
exit-address-family
!
address-family ipv4 vrf A
 redistribute ospf 1
exit-address-family
!
address-family ipv4 vrf B
 redistribute ospf 2
exit-address-family
!
ip forward-protocol nd
!
mpls ldp router-id Loopback0 force
!
control-plane
!
end
R3#ping vrf A 8.8.8.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 44/60/80 ms
R3#ping vrf A 7.7.7.7
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 7.7.7.7, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/55/80 ms
R3#ping vrf A 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 88/110/136 ms

R4#sh run
version 15.1
!
hostname R4
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface Ethernet1/0
ip address 10.1.14.4 255.255.255.0
duplex full
!
interface Ethernet1/1
ip address 10.1.45.4 255.255.255.0
duplex full
!
router ospf 1
router-id 4.4.4.4
network 4.4.4.0 0.0.0.255 area 1
network 10.1.14.0 0.0.0.255 area 1
network 10.1.45.0 0.0.0.255 area 1
!        
router rip
version 2
network 4.0.0.0
network 10.0.0.0
no auto-summary
!
end
R4#ping 8.8.8.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 88/112/136 ms
R4#ping 7.7.7.7
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 7.7.7.7, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 76/103/124 ms
R4#ping 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/46/68 ms
R5#sh run
version 15.1
!
hostname R5
!
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface FastEthernet0/0
no ip address
shutdown
duplex full
!        
interface Ethernet1/0
ip address 10.1.45.5 255.255.255.0
duplex full
!
interface Ethernet1/1
no ip address
shutdown
duplex full
!
interface Ethernet1/2
no ip address
shutdown
duplex full
!
interface Ethernet1/3
no ip address
shutdown
duplex full
!
router ospf 1
router-id 5.5.5.5
network 5.5.5.0 0.0.0.255 area 1
network 10.1.45.0 0.0.0.255 area 1
!
router rip
version 2
network 5.0.0.0
network 10.0.0.0
no auto-summary
!
ip forward-protocol nd
!
end
R5#ping 8.8.8.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 112/120/132 ms
R5#ping 7.7.7.7
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 7.7.7.7, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 108/139/164 ms

R6#sh run
version 15.1
!
hostname R6
!
interface Loopback0
ip address 6.6.6.6 255.255.255.255
!
interface Ethernet1/0
ip address 10.1.67.6 255.255.255.0
duplex full
!
interface Ethernet1/1
ip address 10.1.36.6 255.255.255.0
duplex full
!
router ospf 1
router-id 6.6.6.6
network 6.6.6.0 0.0.0.255 area 1
network 10.1.36.0 0.0.0.255 area 1
network 10.1.67.0 0.0.0.255 area 1
!
router rip
version 2
network 6.0.0.0
network 10.0.0.0
no auto-summary
!
end
R6#ping 7.7.7.7
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 7.7.7.7, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/52/88 ms
R6#ping 8.8.8.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/60/72 ms
R6#ping 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 76/111/140 ms
R7#sh run
version 15.1
!
hostname R7
!
interface Loopback0
ip address 7.7.7.7 255.255.255.255
!
interface Ethernet1/1
ip address 10.1.67.7 255.255.255.0
duplex full
!
router ospf 1
router-id 7.7.7.7
network 7.7.7.0 0.0.0.255 area 1
network 10.1.67.0 0.0.0.255 area 1
!        
router rip
version 2
network 7.0.0.0
network 10.0.0.0
no auto-summary
!
end
R7#ping 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 116/144/172 ms
R7#ping 8.8.8.8
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/73/108 ms

R8#sh run
version 15.1
!
hostname R8
!
interface Loopback0
ip address 8.8.8.8 255.255.255.255
!
interface Ethernet1/0
ip address 10.1.38.8 255.255.255.0
duplex full
!
router ospf 2
router-id 8.8.8.8
network 8.8.8.0 0.0.0.255 area 2
network 10.1.38.0 0.0.0.255 area 2
!        
end
R8#ping 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 88/110/132 ms
R8#ping 7.7.7.7
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 7.7.7.7, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 56/81/104 ms