Technical Overview of L2TPv3This section contains a brief overview of the L2TPv3. As noted in the introduction, there are three different L2TPv3 tunneling models: LAC to LNS, LNS to LNS, and LAC to LAC. This chapter discusses L2TPv3 deployed using the LAC to LAC pseudowire configuration. L2TP can operate directly over several packet switched network types, including IP, MPLS, Frame Relay, and ATM. This chapter focuses on operation over an IP backbone network. Internet Draft draft-ietf-l2tpext-l2tp-base discusses two methods of transporting L2TPv3 over an IP network:
Cisco's current LAC to LAC implementation supports L2TPv3 over IP, so this method of transport is assumed in this chapter. Note that L2TPv3 over IP has less overhead, but L2TPv3 over UDP can be useful in environments where an L2TP tunnel has to traverse a Network Address Translation (NAT) device or firewall. L2TPv3 Message TypesThere are two different types of L2TPv3 message:
L2TPv3 Control MessagesAs previously mentioned, control messages are used for the establishment, maintenance, and teardown of L2TPv3 control connections and data sessions. A control connection is not essential to the operation of data sessions between peer LACs. However, unless otherwise stated, this chapter assumes the existence of a control connection. Figure 5-4 illustrates the overall packet format of L2TPv3 control messages. Figure 5-4. L2TPv3 Control Message Packet Format
Note that there is one control message that consists of only the IP and control message headers. This is called the Zero-Length-Body Acknowledgment (ZLB Ack) and is used to acknowledge explicitly other control message types. The ZLB Ack is used in the absence of another control messages that provide implicit acknowledgment. The ZLB Ack can be used only if authentication is disabled. In cases where authentication is enabled, an Explicit Acknowledgment message is used instead. Figure 5-5 shows the format of the L2TPv3 control message. Figure 5-5. L2TPv3 Control Message Header (over IP)
The first thing you will notice if you have read Chapter 4, "Troubleshooting Layer 2 Tunneling Protocol Version 2 VPNs," is that the header looks pretty similar (see Figure 4-5 in Chapter 4). One or two differences do exist, however. The bulleted list that follows discusses the bits and fields in the L2TPv3 control message:
Following the control message header is the control message itself. Control Message TypesTable 5-1 lists the 14 different types of control messages as defined by L2TPv3.
Note that the OCRQ, OCRP, and OCCN messages are not used in the LAC to LAC model and are, therefore, not discussed further in this chapter. Also, the Explicit Acknowledgment message type value is yet to be announced at the time of this writing. The composition and function of each of the other message types listed in Table 5-1 are discussed in the following few sections. AVPsControl messages are made up of a number of AVPs. AVPs are used to describe a particular variable (the attribute) and its associated value. These AVPs allow great protocol extensibility. AVPs have a common encoding format, which is shown in Figure 5-7. Note that this encoding format is carried over from L2TPv2. Figure 5-7. AVP Encoding Format
The bits and fields in the AVP encoding format are defined as follows:
Internet Draft draft-ietf-l2tpext-l2tp-base (L2TPv3) defines a number of different AVPs. These fall into five categories:
The sections that follow cover these AVPs in more detail. General Control Message AVPsThe four general control message AVPs are Message Type, Message Digest, Control Message Authentication Nonce, and Random Vector. Table 5-2 summarizes general control message AVPs.
The Message Type, Message Digest, and Control Message Authentication Nonce AVPs are of particular significance. The Message Type AVP is used to define the control message type (described in Table 5-1) itself. The Message Digest and Control Message Authentication Nonce AVPs are both used for L2TPv3 message authentication. The Message Digest AVP additionally provides an integrity check over the whole control message. Note that the attribute type values for these two AVPs are yet to be announced at the time of this writing. L2TPv3 message authentication is described later in this chapter in the section entitled "Control Connection Establishment." Result Code AVPThe Result Code AVP is functionally in its own category. This AVP is contained in the Call-Disconnect-Notify (CDN) and Stop-Control-Connection-Notification (StopCCN) messages. It is used to describe the reason for session or control channel teardown. The Result Code AVP contains the result code itself, together with an optional Error Code and Error Message. These collectively describe the reason for session or control connection teardown. Table 5-3 describes the Result Code AVP.
When included with a StopCCN message, the result code values are as shown in Table 5-4.
When included with a CDN message, the result code values are as shown in Table 5-5.
Note result codes values TBA1-4. These are result code values that are yet to be announced (at the time of this writing). A Result Code AVP can also optionally include Error Code and Error Message fields. If the Error Code field is included, the Error Code values are those shown in Table 5-6.
Finally, the optional Error Message field in the Result Code AVP contains human-readable text describing the error condition. The mechanics of session and control connection teardown are discussed in the sections entitled "Session Teardown" and "Control Connection Teardown" later in this chapter. Control Connection Management AVPsControl connection management AVPs are carried in messages used to establish and tear down control connections between LCCEs. Table 5-7 shows control connection management AVPs.
Note that some attribute type values (marked TBA) are yet to be announced at the time of writing. Of particular note is the Pseudowire Capabilities List AVP. This is used to inform the remote LCCE about which pseudowire types are supported by the local LCCE. Session Management AVPsCall management AVPs are carried in messages used for session establishment and teardown between peer LCCEs. Table 5-8 summarizes session management AVPs.
Note that the Remote End ID AVP is used to carry the Virtual Circuit ID (VCID) value, which is discussed in the following sections. Also note the Data Sequencing AVP. This is used if sequencing is enabled for data sessions. Circuit Status AVPsThe final category is circuit status AVPs. These are carried in messages to communicate attachment circuit active/inactive (up/down) or attachment circuit error information. Table 5-9 summarizes call status AVPs.
L2TPv3 Data MessagesL2TPv3 data messages are used to transport frames received on a local attachment circuit to a peer LAC. Figure 5-8 shows the overall session data message format. Figure 5-8. Session Data Message Format
The session data message header used by L2TPv3 over IP is very simple and is shown in Figure 5-9. Figure 5-9. Session Data Message Header
The 32-bit nonzero session ID carried in the data message header is used to associate incoming data messages with a particular local attachment circuit. Note that one L2TPv3 session corresponds to one pseudowire. Following the session ID is an optional variable length random cookie value (maximum 64 bits). This cookie value can be used in addition to the session ID and adds an extra level of assurance that the incoming data messages are correctly associated with the local attachment circuit. Furthermore, a randomly chosen cookie provides protection against blind insertion attacks. That is, an attacker would find it very difficult, if not impossible, to insert packets into a data stream (pseudowire) if the attacker is unable to sniff packets transiting the network between peer LCCEs. This is because of the difficulty of guessing the correct cookie value (0 to 264 if the cookie is 64 bits in length). Session IDs and cookie values are locally significant to an LCCE. They are communicated to the peer LCCE during session setup using the Local Session ID and Assigned Cookie AVPs (see Table 5-8). Once the locally significant session ID and cookie values have been communicated to the remote peer, the remote peer can forward data messages with those values to the local peer. Figure 5-10 illustrates the function of session IDs and cookies. Figure 5-10. Session IDs and Cookies![]() In Figure 5-10, Layer 2 frames received by London_LCCE from mjlnet_CE1 are forwarded to Frankfurt_LCCE using session ID 11 and cookie 110. Layer 2 frames received by Frankfurt_LCCE from mjlnet_CE2 are forwarded to London_LCCE using session ID 1 and cookie 100. Similarly, Layer 2 frames received by London_LCCE from cisco_CE1 are forwarded to Frankfurt_LCCE using session ID 2 and cookie 200. Layer 2 frames received by Frankfurt_LCCE from cisco_CE2 are forwarded to London_LCCE using session ID 22 and cookie 220. NOTE The session ID and cookie values shown in Figure 5-10 have no special significance and are used only for illustrative purposes. The next portion of the data message is the Layer 2 specific sublayer. The Layer 2 specific sublayer can be used to provide additional functionality, such as data message sequencing and packet priority settings. A default Layer 2 specific sublayer is defined in draft-ietf-l2tpext-l2tp-base (L2TP), and this is shown in Figure 5-11. Figure 5-11. Default Layer 2 Specific Sublayer
The S bit, if set, is used to specify that sequence numbering is being used. In this case, the Sequence number field contains a valid sequence number. Bits marked as x are undefined and should be set to zero. It is worth noting that other Layer 2 sublayers may be used when transporting particular frame types, such as Ethernet. An LCCE can signal the use of a particular Layer 2 sublayer during session setup in an L2 Specific Sublayer AVP (see Table 5-8). Control Connection EstablishmentBefore session establishment can begin, a control connection must be established between peer LCCEs. Control connection establishment is initiated using a Start-Control-Connection-Request (SCCRQ) message. This message indicates to the peer LCCE that the sending LCCE wishes to establish a control connection. The SCCRQ message also carries (among other things) the Pseudowire Capabilities List AVP, which is used to indicate to the peer LCCE what pseudowire types the sender supports. Pseudowire types could include Ethernet (port or VLAN), HDLC, and Frame-Relay, for example. Additionally, the SCCRQ may carry a Control Message Authentication Nonce AVP (containing a locally generated random number), if authentication is enabled. Assuming the SCCRQ is acceptable, the peer LCCE responds with a Start-Control-Connection-Reply (SCCRP) message. This indicates that establishment of the control connection can proceed. The SCCRP contains (among other things) the peer LCCE's Pseudowire Capabilities List AVP. If authentication is enabled, the SCCRP will also contain a Message Digest AVP, together with a Control Message Authentication Nonce AVP containing the peer LCCE's random number. The Message Digest AVP contains a hash (HMAC-MD5 or HMAC-SHA-1) value that the remote LCCE calculates with the following inputs: its random number (nonce), the local LCCE's random number (nonce), a shared-key generated from a shared L2TPv3 password, and the L2TPv3 control message itself (header and AVPs). The local LCCE performs the same calculation, with the same inputs. If the locally calculated hash value and that contained in the Message Digest AVP are the same, the message from the remote LCCE is authenticated. Finally, the control connection initiating LCCE sends a Start-Control-Connection-Connected (SCCCN) message to the peer LCCE, indicating that control connection establishment has been completed. If authentication is enabled, the SCCCN will contain a Message Digest AVP. This is calculated as previously described and is used by the remote LCCE to authenticate the message. All control connection messages must carry a Message Digest AVP if authentication is enabled. The hash value carried in the SCCRQ message is, however, calculated slightly differently. The inputs are simply the shared key and the control message, including header and AVPs. The reason for this is that at the time the local LCCE sends the SCCRQ, it does not yet possess the remote LCCE's nonce value (which is communicated in the SCCRP). Note that early implementations of L2TPv3 may use AVPs 11 (Challenge) and 13 (Challenge Response) for authentication. AVPs 11 and 13 were included in early versions of draft-ietf-l2tpext-l2tp-base but later were replaced by the Message Digest and Control Message Authentication Nonce AVPs. Figure 5-12 illustrates control connection establishment. Figure 5-12. Control Connection Establishment![]() Note that only one control connection is required between peer LCCEs regardless of the number of sessions between the two. Session EstablishmentOnce the control connection has been established, session setup can begin. Session setup starts with the initiating LCCE sending a Incoming-Call-Request (ICRQ). Among other things, the ICRQ includes the pseudowire type and circuit status AVPs. These are used to signal the payload to be carried in the session (corresponding to the attachment circuit type), and whether the circuit is active or inactive. If session setup can proceed, the peer LCCE then responds with an Incoming-Call-Reply (ICRP). The ICRP carries a number of AVPs, including a circuit status AVP. The session initiating LCCE now responds to the ICRP with an Incoming-Call-Connected (ICCN), indicating that the session has been established. Figure 5-13 illustrates session setup. Figure 5-13. Session Setup![]() Once session setup has completed successfully, Layer 2 frames can be transported over the data session between the LCCEs. Control Connection MaintenanceIf an LCCE does not receive any data or control messages from its peer LCCE for a certain period, the control connection is maintained by sending a hello message. Internet Draft draft-ietf-l2tpext-l2tp-base recommends a default inactivity interval of 60 seconds. This is the default on Cisco routers. If the peer LCCE does not acknowledge the hello message, the control connection is torn down. Figure 5-14 illustrates the transmission of a hello (keepalive) message. Figure 5-14. Hello Message![]() Session TeardownWhen either LCCE wishes to tear down a session, it sends a CDN message to its peer. The reason for the session teardown is contained within the Result Code AVP sent in the CDN. There are a number of possible reasons for session teardown, including if VCIDs or Layer 2 payload types are mismatched between LCCEs. See Table 5-5 for a list of possible result code values contained in the CDN (carried in a Result Code AVP). Figure 5-15 illustrates session teardown when VCIDs are mismatched. Figure 5-15. Session Teardown![]() Control Connection TeardownThe control connection can be torn down by either LCCE using a StopCCN message. The reason for the control connection teardown is contained within the Result Code AVP in the StopCCN. The control connection can be torn down for a number of reasons, including if a hello (or other control message) is not acknowledged. For a complete list of results code values (contained in the StopCCN's Result Code AVP), see Table 5-4. If any sessions remain active, they are torn down at the same time as the control connection. Figure 5-16 illustrates control connection teardown because of the failure of a peer LCCE to acknowledge a hello message. Figure 5-16. Control Connection Teardown![]() Set-Link-Info (SLI) MessageAnother message type that is used by L2TPv3 is Set-Link-Info (SLI). This is used to signal attachment circuit status. In Figure 5-17, an LCCE sends an SLI when an attachment circuit changes state to inactive (down). Figure 5-17. SLI Message![]() |