1.设备互联地址如图所示;所有设备开设Loopback0接口,该接口IP地址为x.x.x.x/32,其中x为设备编号。Loopback0的IP地址作为OSPF RouterID以及LSR ID、LDP传输地址;
2.R1、R2、R3、R4运行OSPF,通告直连接口及Loopback0;
3.所有设备激活MPLS,基于直连建立LDP邻居,观察标签的分发情况;
4.观察1.1.1.1访问4.4.4.4数据包,分析数据包穿越MPLS网络的过程。
1.R1、R2、R3及R4完成接口IP地址的配置,并运行OSPF
R1的配置如下:
[R1] interface GigabitEthernet0/0/0
[R1-GigabitEthernet0/0/0] ip address 12.1.1.1 24
[R1] interface loopback0
[R1-Loopback0] ip address 1.1.1.1 32
[R1] ospf 1 router-id 1.1.1.1
[R1-ospf-1] area 0
[R1-ospf-1-0.0.0.0] network 12.1.1.0 0.0.0.255
[R1-ospf-1-0.0.0.0] network 1.1.1.1 0.0.0.0
R2的配置如下:
[R2] interface GigabitEthernet0/0/0
[R2-GigabitEthernet0/0/0] ip address 12.1.1.2 24
[R2] interface GigabitEthernet0/0/1
[R2-GigabitEthernet0/0/1] ip address 23.1.1.2 24
[R2] interface loopback0
[R2-Loopback0] ip address 2.2.2.2 32
[R2] ospf 1 router-id 2.2.2.2
[R2-ospf-1] area 0
[R2-ospf-1-0.0.0.0] network 12.1.1.0 0.0.0.255
[R2-ospf-1-0.0.0.0] network 23.1.1.0 0.0.0.255
[R2-ospf-1-0.0.0.0] network 2.2.2.2 0.0.0.0
R3的配置如下:
[R3] interface GigabitEthernet0/0/0
[R3-GigabitEthernet0/0/0] ip address 23.1.1.3 24
[R3] interface GigabitEthernet0/0/1
[R3-GigabitEthernet0/0/1] ip address 34.1.1.3 24
[R3] interface loopback0
[R3-Loopback0] ip address 3.3.3.3 32
[R3] ospf 1 router-id 3.3.3.3
[R3-ospf-1] area 0
[R3-ospf-1-0.0.0.0] network 23.1.1.0 0.0.0.255
[R3-ospf-1-0.0.0.0] network 34.1.1.0 0.0.0.255
[R3-ospf-1-0.0.0.0] network 1.1.1.1 0.0.0.0
R4的配置如下:
[R4] interface GigabitEthernet0/0/0
[R4-GigabitEthernet0/0/0] ip address 34.1.1.4 24
[R4] interface loopback0
[R4-Loopback0] ip address 4.4.4.4 32
[R4] ospf 1 router-id 4.4.4.4
[R4-ospf-1] area 0
[R4-ospf-1-0.0.0.0] network 34.1.1.0 0.0.0.255
[R4-ospf-1-0.0.0.0] network 4.4.4.4 0.0.0.0
2.R1、R2、R3及R4激活MPLS,并在接口上激活LDP
R1的配置如下:
[R1] mpls lsr-id 1.1.1.1 #配置MPLS LSR ID
[R1] mpls #全局激活MPLS
[R1-mpls] quit
[R1] mpls ldp #全局激活LDP
[R1-mpls-ldp] quit
[R1] Interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0] mpls #在接口上激活MPLS
[R1-GigabitEthernet0/0/0] mpls ldp #在接口上激活LDP
R2的配置如下:
[R2] mpls lsr-id 2.2.2.2
[R2] mpls
[R2-mpls] quit
[R2] mpls ldp
[R2-mpls-ldp] quit
[R2] Interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0] mpls
[R2-GigabitEthernet0/0/0] mpls ldp
[R2] Interface GigabitEthernet 0/0/1
[R2-GigabitEthernet0/0/1] mpls
[R2-GigabitEthernet0/0/1] mpls ldp
R3的配置如下:
[R3] mpls lsr-id 3.3.3.3
[R3] mpls
[R3-mpls] quit
[R3] mpls ldp
[R3-mpls-ldp] quit
[R3] Interface GigabitEthernet 0/0/0
[R3-GigabitEthernet0/0/0] mpls
[R3-GigabitEthernet0/0/0] mpls ldp
[R3] Interface GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1] mpls
[R3-GigabitEthernet0/0/1] mpls ldp
R4的配置如下:
[R4] mpls lsr-id 4.4.4.4
[R4] mpls
[R4-mpls] quit
[R4] mpls ldp
[R4-mpls-ldp] quit
[R4] Interface GigabitEthernet 0/0/0
[R4-GigabitEthernet0/0/0] mpls
[R4-GigabitEthernet0/0/0] mpls ldp
完成上述配置后,我们来做一些查看和验证:
[SW1] display mpls ldp peer
LDP Peer Information in Public network
A '*' before a peer means the peer is being deleted.
------------------------------------------------------------------------------
PeerID TransportAddress DiscoverySource
------------------------------------------------------------------------------
2.2.2.2:0 2.2.2.2 GigabitEthernet0/0/0
------------------------------------------------------------------------------
TOTAL: 1 Peer(s) Found.
以上输出的是R1的LDP邻居表,从表中可以看出R1已经发现了一个LDP邻居,那就是R2。
[SW1] display mpls ldp session
LDP Session(s) in Public Network
------------------------------------------------------------------------------
Peer LDP ID : 2.2.2.2:0 Local LDP ID : 1.1.1.1:0
TCP Connection : 1.1.1.1 <- 2.2.2.2
Session State : Operational Session Role : Passive
Session FT Flag : Off MD5 Flag : Off
Reconnect Timer : --- Recovery Timer : ---
Keychain Name : ---
Negotiated Keepalive Hold Timer : 45 Sec
Configured Keepalive Send Timer : ---
Keepalive Message Sent/Rcvd : 20/20 (Message Count)
Label Advertisement Mode : Downstream Unsolicited
Label Resource Status(Peer/Local) : Available/Available
Session Age : 000004 (DDDDMM)
Session Deletion Status : No
Capability:
Capability-Announcement : Off
P2MP Capability : Off
Outbound&Inbound Policies applied : NULL
Addresses received from peer: (Count: 3)
2.2.2.2 12.1.1.2 23.1.1.2
------------------------------------------------------------------------------
以上输出的是LDP会话的详细信息,邻居的状态必须为Operational才是最终的稳态,另外从TCP连接1.1.1.1 < 2.2.2.2可以验证一点,LDP的会话建立是由传输地址大的一方发起的。
display mpls lsp
-------------------------------------------------------------------------------
LSP Information: LDP LSP
-------------------------------------------------------------------------------
FEC In/Out Label In/Out IF Vrf Name
1.1.1.1/32 3/NULL -/-
2.2.2.2/32 NULL/3 -/GE0/0/0
2.2.2.2/32 1024/3 -/GE0/0/0
3.3.3.3/32 NULL/1025 -/GE0/0/0
3.3.3.3/32 1025/1025 -/GE0/0/0
4.4.4.4/32 NULL/1026 -/GE0/0/0
4.4.4.4/32 1026/1026 -/GE0/0/0
以上输出的是R1的LFIB(标签转发信息库),可以看到已经建立好的LSP。
实际上,当我们再R1、R2、R3、R4上运行OSPF后,全网的路由已经被打通,也就是每台路由器都拥有全网的路由,其中包括互联网段的路由,以及各设备的Loopback路由。随后我们激活各设备的MPLS和LDP,每台设备会基于自己的路由表中的路由前缀进行标签捆绑,并且将为路由前缀(FEC)所捆绑的标签分发给自己的LDP邻居。默认情况下在我司的设备上,仅为/32的主机路由分发标签,并且默认水平分割规则并未打开,所以,R2及R3之间的标签分发可能是这样的:
现在,来测试一下,从R1去tracert 4.4.4.4:
tracert lsp ip 4.4.4.4 32
LSP Trace Route FEC: IPV4 PREFIX 4.4.4.4/32 , press CTRL_C to break.
TTL Replier Time Type Downstream
0 Ingress 12.1.1.2 / [1026]
1 12.1.1.2 200 ms Transit 23.1.1.3 / [1028]
2 23.1.1.3 170 ms Transit 34.1.1.4 / [3]
3 4.4.4.4 100 ms Egress
从tracert的结果我们可以看到数据包行走的路径,以及被压入的标签。
报文的转发过程实际上类似下面这样:
审核编辑 :李倩
全部0条评论
快来发表一下你的评论吧 !