实验拓扑

 

mpls 播放 mpls格式_OSPF

实验步骤

1:配置基本地址,以及使ISP中间运行OSPF,使两端PE可以互通。

2:内部起BGP,使用MPLS解决黑洞问题。

3:启用VRF。用来承载大量前缀以及负责路由导入导出。

4:启用扩展团体属性:××× V4,将需要做ipv4 vrf的放在一个属性内。

5:将IPv4 vrf的汇总和同步关掉。并将从CE学到的路由重分布进来。

6:将×××应用在接口,PE和CE相连的接口。注意IP地址。

7:CE端将相关路由写出来。

下边是一个简单的实验:

R5#show ip route 
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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
     1.0.0.0/24 is subnetted, 1 subnets
S       1.1.1.0 [1/0] via 45.1.1.4
     5.0.0.0/24 is subnetted, 1 subnets
C       5.5.5.0 is directly connected, Loopback10
     45.0.0.0/24 is subnetted, 1 subnets
C       45.1.1.0 is directly connected, Serial1/0
R5#ping 1.1.1.1 source 5.5.5.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 5.5.5.5 
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 72/90/104 ms
router ospf 110
 log-adjacency-changes
 network 2.2.2.0 0.0.0.255 area 1
 network 23.1.1.0 0.0.0.255 area 1
!
R2:router bgp 1
 no synchronization
 bgp log-neighbor-changes
 neighbor 4.4.4.4 remote-as 1
 neighbor 4.4.4.4 update-source Loopback10
 no auto-summary
 !
 address-family ***v4
 neighbor 4.4.4.4 activate
 neighbor 4.4.4.4 send-community both
 exit-address-family
 !
 address-family ipv4 vrf A
 redistribute static
 no auto-summary
 no synchronization
 exit-address-family

OSPF自动将环回口作为32位主机路由通告,所以在MPLS中传递时到终点并未有32位路由,可以手工修改为24为。

RD的作用是在VRF中指出“我是谁”,用来区分路由。

RT的作用是在VRF路由中引入和送出路由。

RD的格式

RD分为两种格式:

ASN:nn(常用)和IP-address:nn

ASN代表BGP AS号码,nn代表数字,数字可以随便定义,只要合理即可,但这个数字,对于一台路由器上的不同用户,肯定是不同的。

比如一个用户的网段是10.1.1.0/24,RD是100:1,那么用户的***v4为100:1:10.1.1.0/24

下一个实验:

内部PE1,P,PE2运行OSPF;CE1,PE1运行EIGRP;CE2,PE2运行RIPV2。

实验目的

全网使用MPLS,其他与上边相同,实现两端内部互通

实验拓扑

 

mpls 播放 mpls格式_mpls 播放_02

配置要点
CE1:router eigrp 90
 network 0.0.0.0
 no auto-summary
interface Serial1/1
 ip address 12.1.1.1 255.255.255.0
 tag-switching ip
PE1:interface Loopback10
 ip address 2.2.2.2 255.255.255.0
 ip ospf network point-to-point
interface Serial1/0
 ip vrf forwarding A
 ip address 12.1.1.2 255.255.255.0
 tag-switching ip
interface Serial1/1
 ip address 23.1.1.2 255.255.255.0
 tag-switching ip
router eigrp 90
 no auto-summary
 !
 address-family ipv4 vrf A
 redistribute bgp 1 metric 1544 20000 255 1 1500
 network 12.1.1.0 0.0.0.255
 no auto-summary
 autonomous-system 90
 exit-address-family
router ospf 110
 log-adjacency-changes
 network 2.2.2.0 0.0.0.255 area 0
 network 23.1.1.0 0.0.0.255 area 0
router bgp 1
 no synchronization
 bgp log-neighbor-changes
 neighbor 4.4.4.4 remote-as 1
 neighbor 4.4.4.4 update-source Loopback10
 no auto-summary
 address-family ***v4
 neighbor 4.4.4.4 activate
 neighbor 4.4.4.4 send-community extended
 exit-address-family
 address-family ipv4 vrf A
 redistribute eigrp 90
 no auto-summary
 no synchronization
 exit-address-family
P:router ospf 110
 log-adjacency-changes
 network 0.0.0.0 255.255.255.255 area 0
interface Serial1/1
 ip address 34.1.1.3 255.255.255.0
 tag-switching ip
interface Serial1/0
 ip address 23.1.1.3 255.255.255.0
 tag-switching ip
interface Loopback10
 ip address 3.3.3.3 255.255.255.0
实验验证
CE2#traceroute 
Protocol [ip]: 
Target IP address: 1.1.1.1
Source address: 5.5.5.5
  1 34.1.1.4 [MPLS: Label 19 Exp 0] 124 msec 112 msec 100 msec
  2 34.1.1.3 [MPLS: Labels 16/18 Exp 0] 80 msec 104 msec 104 msec
  3 12.1.1.2 [MPLS: Label 18 Exp 0] 124 msec 72 msec 96 msec
  4 12.1.1.1 80 msec *  228 msec
CE1#ping 5.5.5.5 source 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 5.5.5.5, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1 
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 84/95/116 ms

看一下PE端的MPLS表:

PE2#show mpls forwarding-table 
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface              
16     16          2.2.2.0/24        0          Se1/0      point2point  
17     Untagged    3.3.3.3/32        0          Se1/0      point2point  
18     Pop tag     23.1.1.0/24       0          Se1/0      point2point  
19     16          1.1.1.0/24[V]     2600       Se1/0      point2point  
20     16          12.1.1.0/24[V]    0          Se1/0      point2point  
21     Pop tag     5.5.5.0/24[V]     3760       Se1/1      point2point  
22     Aggregate   45.1.1.0/24[V]    0

                  

转载于:https://blog.51cto.com/xidaner/621873