Recently, with MPLS, we found that many people only write a simple command for configuring MPLS, and there is little explanation of the specific principle. Let's talk about this article.
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/0302103I7-0.png "/>
This is a basic topology.
1. Why is MPLS technology different from traditional ip technology?
We know that the traditional ip forwarding technology is based on the route table, that is to say, a packet route from the entry needs to check the ip route table for forwarding. Such an IP packet network, when a network device transmits data packets, it exchanges the IP packet header information, that is, the network device determines which interface to forward data packets from Based on the destination IP address in the packet header. Therefore, IP address information is used to instruct the device to correctly forward data packets, while IP address is only an identifier of the data packets! So why can't we directly add a label so that the route can identify the tag through hardware and forward it from where it is, so it doesn't save much time for the router to process data packets. This is why MPLS is generated. However, at that time, there was a technology like cef mls.
2: MPLS Label
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/030210B17-1.png "/>
EXP is about qos.
The bos value indicates the tag stack. A flow can have multiple tags with a value of 0. If it is the bottom of the stack, it is 1. During tag interaction, only the top tag is viewed, note:
3. Basic MPLS concepts
Inbound LSR: Receive untagged data packets, tag and send
Outbound LSR: Receives, removes, and sends tagged data packets. Both the outbound and inbound LSR are edge LSR, so they are connected to both the IP network and MPLS network.
LSR in link: Receives a packet with a label, performs operations on it, and then exchanges it according to the correct interface. Therefore, The lsr in the link only performs tag forwarding.
LSR operation processLSR can perform three operations: Extract, add, and exchange.
ExtractThat is, remove one or more labels from the top of the tag stack. Removing all labels is required by the outbound LSR.
AddTo add tags to the message. If there is no tag, add the new one, which must be done by the inbound LSR.
ExchangeReceives a tagged packet, switches it to the top with a new tag, and then sends it again. This is done by the LSR in the link.
4. LDP Workflow
LDP is the protocol responsible for tag forwarding,
1) LSR discovery for running LDP
2) Session creation and maintenance
3) Tag ing Notice 4) LDP needs to be managed using notifications like OSPF. Use the hello packet to discover and maintain the neighbor relationship, LDP will send hello to the neighbor on the enabled interface, send hello to UDP 646, the destination is 224.0.0.2, the hello time and the retention time are 5 seconds and 15 seconds respectively. This hello packet cannot be transmitted across network segments, and this hello packet is called LDP Link Hello. R3 # show mpls ldp parameters
Protocol version: 1
Downstream label generic region: min label: 16; max label: 100000
Session hold time: 180 sec; keep alive interval: 60 sec
Discovery hello: holdtime: 15 sec; interval: 5 sec
Discovery targeted hello: holdtime: 90 sec; interval: 10 sec
Downstream on Demand max hop count: 255
Downstream on Demand Path Vector Limit: 255
LDP for targeted sessions
LDP initial/maximum backoff: 15/120 sec
LDP loop detection:
5. Tag Exchange Process
650) this. width = 650; "border =" 0 "alt =" "src =" http://www.bkjia.com/uploads/allimg/131227/030210F39-2.png "/>
Understanding of upstream and downstream and data-Layer Routing
Run mpls and R1267ip in R345
R1 has a 6.6.6.6 label exchange from 1.1.1.1 to R6.
There are three tables running the MPLS Router, And the label forwarding table of the route table cef
R3 # show ip route
Codes: C-connected, S-static, R-RIP, M-mobile, B-BGP
D-OSPF, EX-VPN 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, su-IS summary, L1-IS-level-1, L2-IS level-2
Ia-IS inter area, *-candidate default, U-per-user static route
O-ODR, P-periodic downloaded static route
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets
C 34.1.1.0 is directly connected, Serial0/3
1.0.0.0/32 is subnetted, 1 subnets
D 1.1.1.1 [90/2297856] via 13.1.1.1, 00:43:06, Serial0/0
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
4.0.0.0/32 is subnetted, 1 subnets
D 4.4.4.4 [90/2297856] via 34.1.1.4, 00:41:57, Serial0/3
5.0.0.0/32 is subnetted, 1 subnets
D 5.5.5.5 [90/2809856] via 34.1.1.4, 00:41:17, Serial0/3
6.0.0.0/32 is subnetted, 1 subnets
D 6.6.6.6 [90/3321856] via 34.1.1.4, 00:41:09, Serial0/3
56.0.0.0/24 is subnetted, 1 subnets
D 56.1.1.0 [90/3193856] via 34.1.1.4, 00:41:18, Serial0/3
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial0/0
45.0.0.0/24 is subnetted, 1 subnets
D 45.1.1.0 [90/2681856] via 34.1.1.4, 00:41:23, Serial0/3
R3 # show ip cef
Prefix Next Hop Interface
0.0.0.0/0 drop Null0 (default route handler entry)
0.0.0.0/32 receive
1.1.1.1/32 13.1.1.1 Serial0/0
3.3.3.3/32 receive
4.4.4.4/32 34.1.1.4 Serial0/3
5.5.5.5/32 34.1.1.4 Serial0/3
6.6.6.6/32 34.1.1.4 Serial0/3
13.1.1.0/24 attached Serial0/0
13.1.1.0/32 receive
13.1.1.3/32 receive
13.1.1.255/32 receive
34.1.1.0/24 attached Serial0/3
34.1.1.0/32 receive
34.1.1.3/32 receive
34.1.1.255/32 receive
45.1.1.0/24 34.1.1.4 Serial0/3
56.1.1.0/24 34.1.1.4 Serial0/3
224.0.0.0/4 drop
224.0.0.0/24 receive
255.255.255.255/32 receive
R3 # show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
Tag or VC or Tunnel Id switched interface
16 Untagged 1.1.1.1/32 0 Se0/0 point2point
17 Pop tag 4.4.4.4/32 0 Se0/3 point2point
18 Pop tag 45.1.1.0/24 0 Se0/3 point2point
19 19 5.5.5.5/32 0 Se0/3 point2point
20 20 56.1.1.0/24 0 Se0/3 point2point
22 22 6.6.6.6/32 0 Se0/3 point2point
Although multiple labels can be applied to a route, the LSR in the middle can be forwarded only based on the top label. However, the forwarding table of each LSR will display two labels for one route, one for the local label and the other for the remote label. The two labels must be displayed because after one LSR receives the data packet, check the top tag of the tag. If the tag is a corresponding local tag, it is sent from the corresponding interface, change the top label of the data packet to the remote label corresponding to the local label.
Let's start from R5.
R5 # show mpls
Local Outgoing Prefix Bytes tag Outgoing Next Hop
Tag or VC or Tunnel Id switched interface
16 Pop tag 4.4.4.4/32 0 Se0/2 point2point
17 Pop tag 34.1.1.0/24 0 Se0/2 point2point
18 16 3.3.3.3/32 0 Se0/2 point2point
19 17 13.1.1.0/24 0 Se0/2 point2point
20 18 1.1.1.1/32 0 Se0/2 point2point
21 Untagged 6.6.6.6/32 1224 Se0/0 point2point
The local label is 21, while the outbound label is untagged because R6 is an IP network.
R4 # show mpls
Local Outgoing Prefix Bytes tag Outgoing Next Hop
Tag or VC or Tunnel Id switched interface
16 Pop tag 3.3.3.3/32 0 Se0/3 point2point
17 Pop tag 13.1.1.0/24 1152 Se0/3 point2point
18 16 1.1.1.1/32 0 Se0/3 point2point
19 Pop tag 5.5.5.5/32 0 Se0/2 point2point
20 Pop tag 56.1.1.0/24 0 Se0/2 point2point
22 21 6.6.6.6/32 432 Se0/2 point2point
About 6.6.6.6, the route entry is 22 outbound label 21 on R4, which means that when the router entry 6.6.6.6.6 is received, the outbound label is 21 and the route entry is forwarded from s0/2, we found that the output label of R4 is the local label of R5, which is the location of the LDP protocol.
R3 # show mpls
Local Outgoing Prefix Bytes tag Outgoing Next Hop
Tag or VC or Tunnel Id switched interface
16 Untagged 1.1.1.1/32 0 Se0/0 point2point
17 Pop tag 4.4.4.4/32 0 Se0/3 point2point
18 Pop tag 45.1.1.0/24 0 Se0/3 point2point
19 19 5.5.5.5/32 0 Se0/3 point2point
20 20 56.1.1.0/24 0 Se0/3 point2point
22 22 6.6.6.6/32 0 Se0/3 point2point
The reason is two 22, and the local 22 is random routing. What is the actual meaning of wood?
6. Label Definition
Implicitly empty 3 tag
In an MPLS network, the P router completely switches according to the label, while the edge router PE connects both the MPLS network and the IP network. Therefore, when a data packet is transmitted to the PE router in the MPLS network, the PE router's job is to end the label exchange process and transfer the packet to the IP network. The IP address is searched for when the packet is transferred to the IP network. Then we can see that after a label packet arrives at the PE router, the first step of the PE router is to search for the LFIB table based on the packet label. After finding the LFIB, we find that it is no longer a label exchange, the second step is immediately transferred to the IP route table, and finally the results are found in the IP route table, and are sent out from the IP network. Obviously, since it is impossible for a PE router to use label exchange, but IP exchange is required, why check the LFIB table to know the result. Therefore, let's take into account a method. Can we make the last hop router of the PE do not label the data packet and simply change it to an IP data packet? In this way, the last hop router does not write a label, then, after receiving the data packet, PE can immediately query the IP route table and forward it. Here, you need to let the PE's previous hop router not label the data but directly change it to an IP packet, which requires the PE to tell it. Under normal circumstances, the PE router tells the normal label of the previous hop and changes the label to a remote label. But now, the PE router should not tell the normal label of the previous hop, it tells you that the implicit null label number is 3), so the LSR with the label 3 is not tagged when the packet is sent to the next hop. This end point uses an implicit null tag to tell the last hop not to tag. This behavior is called the last hop to Remove PHP.) Therefore, an LSR that receives the implicit null tag, the corresponding egress is no longer a remote tag, but should be displayed as pop in outgoing. The removal of the previous hop tag is called the tag pop-up.
Note:In IOS, PHP is the default behavior, but it only advertises implicit null 3 for direct connection routes and aggregate routes, but 3 is not explicitly written.
Show empty labelsThe function of displaying null is based on Implicit null. The IPv4 label is 0 and the IPv6 label is 2. Because the EXP in the label is used for QOS, the information will be lost after the first hop is removed and may be retained. Therefore, the label will be changed to 0 in the previous hop to tell the end point not to look for LFIB for 0, it only depends on EXP, so it only cares about QOS effect, which saves time. Router alarm label 1, which only requires special attention and is forwarded by software. Unretained labels can be used. 20 bits are 16-1048575, and the default value is 16-10 0000 for IOS. IGP is enough, but BGP may not be enough. You can view and modify the label range.
7. The last is the configuration command.
Mpls label protocol ldp
Interface Loopback0
Ip address 3.3.3.3 255.255.255.255
Interface Serial0/0
Ip address 13.1.1.3 255.255.255.0
Serial restart-delay 0
Interface Serial0/1
Ip address 23.1.1.3 255.255.255.0
Serial restart-delay 0
Interface Serial0/3
Ip address 34.1.1.3 255.255.255.0
Mpls ip
Serial restart-delay 0
Router VPN 100
Network 3.3.3.0 0.0.0.255
Network 13.1.1.0 0.0.255
Network 23.1.1.0 0.0.255
Network 34.1.1.0 0.0.255
No auto-summary
Mpls ldp router-id Loopback0 force
R3 # show mpls int
Interface IP Tunnel Operational
Serial0/3 Yes (ldp) No Yes
Another point is that
R3 # show mpls ldp discovery de
Local LDP Identifier:
3.3.3.3: 0
Discovery Sources:
Interfaces:
Serial0/3 (ldp): xmit/recv
Enabled: Interface config
Hello interval: 5000 MS; Transport IP addr: 3.3.3.3 must be accessible)
LDP Id: 4.4.4: 0
Src IP addr: 34.1.1.4; Transport IP addr: 4.4.4.4
Hold time: 15 sec; Proposed local/peer: 15/15 sec
Reachable via 4.4.4.4/32
This article is from the cisco network blog, please be sure to keep this source http://liangrui.blog.51cto.com/1510945/594451