Because of the lack of confidentiality inherent in the L2TP, it is often implemented along with
IPsec. This is referred to as L2TP/IPsec, and is standardized in
IETF RFC 3193. The process of setting up an L2TP/IPsec VPN is as follows: • Negotiation of IPsec
security association (SA), typically through
Internet key exchange (IKE). This is carried out over UDP port 500, and commonly uses either a shared password (so-called "
pre-shared keys"), public keys, or
X.509 certificates on both ends, although other keying methods exist. • Establishment of
Encapsulating Security Payload (ESP) communication in transport mode. The IP protocol number for ESP is 50 (compare TCP's 6 and UDP's 17). At this point, a secure channel has been established, but no tunneling is taking place. • Negotiation and establishment of L2TP tunnel between the SA endpoints. The actual negotiation of parameters takes place over the SA's secure channel, within the IPsec encryption. L2TP uses UDP port 1701. When the process is complete, L2TP packets between the endpoints are encapsulated by IPsec. Since the L2TP packet itself is wrapped and hidden within the IPsec packet, the original source and destination IP address is encrypted within the packet. Also, it is not necessary to open UDP port 1701 on firewalls between the endpoints, since the inner packets are not acted upon until after IPsec data has been decrypted and stripped, which only takes place at the endpoints. A potential point of confusion in L2TP/IPsec is the use of the terms
tunnel and
secure channel. The term
tunnel-mode refers to a channel which allows untouched packets of one network to be transported over another network. In the case of L2TP/PPP, it allows L2TP/PPP packets to be transported over IP. A
secure channel refers to a connection within which the confidentiality of all data is guaranteed. In L2TP/IPsec, first IPsec provides a secure channel, then L2TP provides a tunnel. IPsec also specifies a tunnel protocol: this is not used when a L2TP tunnel is used. ==Windows implementation==