MPLS 基础MPLS-VPN 标签分析
R1---(R2---R3---R4)--R5
|__EBGP__|_____IBGP______|__EBGP_|
12.0/24 23.0/24 34.0/24 45.0/24
R2-R 4是MPLs和MPLS-VPN域
R2和R4上的vrf:
ip vrf vpn1
rd 100:1
route-target export 100:1
route-target import 100:1
r4#sh ip vrf d
VRF vpn1; default RD 100:1; default VPNID
Interfaces:
Serial2/0
Connected addresses are not in global routing table
Export VPN route-target communities
RT:100:1
Import VPN route-target communities
RT:100:1
No import route-map
No export route-map
============================================
两边ce学到的路由如下:
r1#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Serial1/0
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
O E2 192.168.45.0/24 [110/1] via 192.168.12.2, 00:27:32, Serial1/0
5.0.0.0/32 is subnetted, 1 subnets
O E2 5.5.5.5 [110/65] via 192.168.12.2, 00:27:32, Serial1/0
O E2 192.168.56.0/24 [110/128] via 192.168.12.2, 00:27:32, Serial1/0
------------------------------------------------------------------------------------------
r5#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
O E2 192.168.12.0/24 [110/1] via 192.168.45.4, 00:28:10, Serial2/0
1.0.0.0/32 is subnetted, 1 subnets
O E2 1.1.1.1 [110/65] via 192.168.45.4, 00:28:10, Serial2/0
C 192.168.45.0/24 is directly connected, Serial2/0
5.0.0.0/32 is subnetted, 1 subnets
C 5.5.5.5 is directly connected, Loopback0
C 192.168.56.0/24 is directly connected, Serial1/0
=============================================
R2上的vpnv4路由如下
r2#sh ip b v all
BGP table version is 11, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
Route Distinguisher: 100:1 (default for vrf vpn1)
*> 1.1.1.1/32 192.168.12.1 65 32768 ?
*>i5.5.5.5/32 4.4.4.4 65 100 0 ?
*> 192.168.12.0 0.0.0.0 0 32768 ?
*>i192.168.45.0 4.4.4.4 0 100 0 ?
*>i192.168.56.0 4.4.4.4 128 100 0 ?
r2#sh ip rou vrf vpn1
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Serial1/0
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/65] via 192.168.12.1, 00:21:37, Serial1/0
B 192.168.45.0/24 [200/0] via 4.4.4.4, 00:17:34
5.0.0.0/32 is subnetted, 1 subnets
B 5.5.5.5 [200/65] via 4.4.4.4, 00:17:34
B 192.168.56.0/24 [200/128] via 4.4.4.4, 00:17:34
r2#show ip cef detail
4.4.4.4/32, version 8, epoch 0, cached adjacency to Serial2/0
0 packets, 0 bytes
tag information set
local tag: 201
fast tag rewrite with Se2/0, point2point, tags imposed: {301}
via 192.168.23.3, Serial2/0, 3 dependencies
next hop 192.168.23.3, Serial2/0
valid cached adjacency
tag rewrite with Se2/0, point2point, tags imposed: {301}
r2#sh ip cef vrf vpn1 detail
5.5.5.5/32, version 6, epoch 0, cached adjacency to Serial2/0
0 packets, 0 bytes
tag information set
local tag: VPN-route-head
fast tag rewrite with Se2/0, point2point, tags imposed: {301 405}
via 4.4.4.4, 0 dependencies, recursive
next hop 192.168.23.3, Serial2/0 via 4.4.4.4/32
valid cached adjacency
tag rewrite with Se2/0, point2point, tags imposed: {301 405}
顶层标签是借用global中关于到4.4.4.4这条igp路由的标签
r2#sh ip b vpnv4 all tag
Network Next Hop In tag/Out tag
Route Distinguisher: 100:1 (vpn1)
1.1.1.1/32 192.168.12.1 205/notag
5.5.5.5/32 4.4.4.4 notag/405
192.168.12.0 0.0.0.0 206/aggregate(vpn1)
192.168.45.0 4.4.4.4 notag/404
192.168.56.0 4.4.4.4 notag/406
[1] [2] [3] 下一页
文章录入:csh 责任编辑:csh
r2#sh tag f
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
200 Pop tag 3.3.3.3/32 0 Se2/0 point2point
201 301 4.4.4.4/32 0 Se2/0 point2point
202 Pop tag 192.168.34.0/24 0 Se2/0 point2point
205 Untagged 1.1.1.1/32[V] 0 Se1/0 point2point
206 Aggregate 192.168.12.0/24[V] \
0
r3#sh tag f
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
300 Pop tag 2.2.2.2/32 63 Se2/0 point2point
301 Pop tag 4.4.4.4/32 107 Se1/0 point2point
次末跳弹出
r4#sh tag f
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
400 300 2.2.2.2/32 0 Se1/0 point2point
401 Pop tag 3.3.3.3/32 0 Se1/0 point2point
402 300 192.168.12.0/24[V] \
0 Se1/0 point2point
403 300 1.1.1.1/32[V] 0 Se1/0 point2point
404 Aggregate 192.168.45.0/24[V] \
0
405 Untagged 5.5.5.5/32[V] 0 Se2/0 point2point
406 Untagged 192.168.56.0/24[V] \
0 Se2/0 point2point
407 Pop tag 192.168.23.0/24 0 Se1/0 point2point
对于pe路由器的直连vpn路由是Aggregate操作
非直连vpn路由是Untagged操作
--------------------------------------
最后的测试效果:
r5#p 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/19/20 ms
r5#
r5#trac
r5#traceroute 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
1 192.168.45.4 32 msec 20 msec 32 msec
2 192.168.34.3 [MPLS: Labels 300/205 Exp 0] 40 msec 20 msec 20 msec
3 192.168.12.2 [MPLS: Label 205 Exp 0] 20 msec 20 msec 28 msec
4 192.168.12.1 20 msec * 20 msec
---------------------------------------
r1#p 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 = 20/20/20 ms
r1#trace
r1#traceroute 5.5.5.5
Type escape sequence to abort.
Tracing the route to 5.5.5.5
1 192.168.12.2 20 msec 28 msec 28 msec
2 192.168.23.3 [MPLS: Labels 301/405 Exp 0] 28 msec 20 msec 20 msec
3 192.168.45.4 [MPLS: Label 405 Exp 0] 20 msec 20 msec 20 msec
4 192.168.45.5 20 msec * 20 msec
=============================================
最后是各台路由器的配置:
r1#sh ru
Building configuration...
Current configuration : 722 bytes
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r1
!
!
clock timezone CET 1
ip subnet-zero
no ip domain lookup
!
!
!
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface Ethernet0/0
no ip address
shutdown
!
interface Serial1/0
ip address 192.168.12.1 255.255.255.0
!
interface Serial2/0
no ip address
shutdown
!
interface Serial3/0
no ip address
shutdown
!
router ospf 1
router-id 1.1.1.1
log-adjacency-changes
passive-interface Loopback0
network 0.0.0.0 255.255.255.255 area 0
!
ip classless
no ip http server
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!
end
上一页 [1] [2] [3] 下一页
文章录入:csh 责任编辑:csh
-------------------------------------------
r2#sh ru
Building configuration...
Current configuration : 1524 bytes
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r2
!
!
clock timezone CET 1
ip subnet-zero
no ip domain lookup
!
!
ip vrf vpn1
rd 100:1
route-target export 100:1
route-target import 100:1
ip cef
mpls label range 200 299
tag-switching tdp router-id Loopback0
!
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Ethernet0/0
no ip address
shutdown
!
interface Serial1/0
ip vrf forwarding vpn1
ip address 192.168.12.2 255.255.255.0
!
interface Serial2/0
ip address 192.168.23.2 255.255.255.0
tag-switching ip
!
interface Serial3/0
no ip address
shutdown
!
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
passive-interface Loopback0
network 2.2.2.2 0.0.0.0 area 0
network 192.168.23.0 0.0.0.255 area 0
!
router ospf 22 vrf vpn1
log-adjacency-changes
redistribute bgp 1 subnets
network 192.168.12.0 0.0.0.255 area 0
!
router bgp 1
no synchronization
bgp router-id 2.2.2.2
bgp log-neighbor-changes
neighbor 4.4.4.4 remote-as 1
neighbor 4.4.4.4 update-source Loopback0
no auto-summary
!
address-family ipv4 vrf vpn1
redistribute ospf 22 match internal external 1 external 2
no auto-summary
no synchronization
exit-address-family
!
address-family vpnv4
neighbor 4.4.4.4 activate
neighbor 4.4.4.4 send-community both
no auto-summary
exit-address-family
!
ip classless
no ip http server
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!
end
------------------------------------
r3#sh ru
Building configuration...
Current configuration : 842 bytes
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r3
!
!
clock timezone CET 1
ip subnet-zero
no ip domain lookup
!
ip cef
mpls label range 300 399
tag-switching tdp router-id Loopback0
!
!
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Ethernet0/0
no ip address
shutdown
!
interface Serial1/0
ip address 192.168.34.3 255.255.255.0
tag-switching ip
!
interface Serial2/0
ip address 192.168.23.3 255.255.255.0
tag-switching ip
!
interface Serial3/0
no ip address
shutdown
!
router ospf 1
router-id 3.3.3.3
log-adjacency-changes
passive-interface Loopback0
network 0.0.0.0 255.255.255.255 area 0
!
ip classless
no ip http server
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!
end
-----------------------------------------
r4#sh ru
Building configuration...
Current configuration : 1542 bytes
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r4
!
!
clock timezone CET 1
ip subnet-zero
no ip domain lookup
!
!
ip vrf vpn1
rd 100:1
route-target export 100:1
route-target import 100:1
ip cef
mpls label range 400 499
tag-switching tdp router-id Loopback0
!
!
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface Ethernet0/0
no ip address
shutdown
!
interface Serial1/0
ip address 192.168.34.4 255.255.255.0
tag-switching ip
!
interface Serial2/0
ip vrf forwarding vpn1
ip address 192.168.45.4 255.255.255.0
tag-switching ip
!
interface Serial3/0
no ip address
shutdown
!
router ospf 1
router-id 4.4.4.4
log-adjacency-changes
passive-interface Loopback0
network 4.4.4.4 0.0.0.0 area 0
network 192.168.34.0 0.0.0.255 area 0
!
router ospf 44 vrf vpn1
log-adjacency-changes
redistribute bgp 1 subnets
network 192.168.45.0 0.0.0.255 area 0
!
router bgp 1
no synchronization
bgp router-id 4.4.4.4
bgp log-neighbor-changes
neighbor 2.2.2.2 remote-as 1
neighbor 2.2.2.2 update-source Loopback0
no auto-summary
!
address-family ipv4 vrf vpn1
redistribute ospf 44 match internal external 1 external 2
no auto-summary
no synchronization
exit-address-family
!
address-family vpnv4
neighbor 2.2.2.2 activate
neighbor 2.2.2.2 send-community both
no auto-summary
exit-address-family
!
ip classless
no ip http server
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!
end
----------------------------------------------
r5#sh ru
Building configuration...
Current configuration : 736 bytes
!
version 12.2
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname r5
!
!
clock timezone CET 1
ip subnet-zero
no ip domain lookup
!
!
!
!
interface Loopback0
ip address 5.5.5.5 255.255.255.255
!
interface Ethernet0/0
no ip address
shutdown
!
interface Serial1/0
ip address 192.168.56.7 255.255.255.0
!
interface Serial2/0
ip address 192.168.45.5 255.255.255.0
!
interface Serial3/0
no ip address
shutdown
!
router ospf 1
router-id 5.5.5.5
log-adjacency-changes
passive-interface Loopback0
network 0.0.0.0 255.255.255.255 area 0
!
ip classless
no ip http server
!
!
!
!
!
line con 0
exec-timeout 0 0
logging synchronous
line aux 0
line vty 0 4
login
!
end
上一页 [1] [2] [3]
文章录入:csh 责任编辑:csh