L2TP Tuning

L2TP Tunnel Tuning

References:
https://www.ietf.org/rfc/rfc2661.txt
www.cisco.com/c/en/us/td/docs/ios-xml/ios/vpdn/command/vpd-cr-book/vpd-l1.html

MTU: L2TP runs over UDP. A full 1500 byte end user datagram transported over L2TP to a PE, assuming 2 MPLS labels across the core to reach an LNS, requires an MTU between LNS and PE with the L2TP interconnect of  1548 bytes.

1500 : EU IP Packet
4 : PPP Header (usually 2 bytes)
8 : L2TP Header
8 : UDP Header
20: IP Header
4 : MPLS VPN Label
4 : MPLS Transport Label

If L2TP sequencing is enabled and additional 4 bytes are required in the L2TP header.

! conf t

! Enable L2TP congestion control (sliding window) - enabled by default.
l2tp congestion-control 

! Once entered, the router directly queues the L2TP Hello packets and Hello acknowledgements to
! the L2TP control process.
! If not configured the L2TP software sends the packets to UDP to validate the checksum.
! When too many packets are queued to the IP input process, the router starts
! Selective Packet Discard (SPD) mechanism that causes IP packets to be dropped.
! Default is to perform checksums.
vpdn ip udp ignore checksum


vpdn-group group1

 ! Enable the NAS or tunnel server to drop out-of-order packets.
 !Default is disabled.
 no l2tp drop out-of-order

 ! Enables IP UDP checksums on data packets causes minimizing delays that occur when the
 ! ultimate error correction is done end-to-end rather than at the tunnel endpoints.
 ! Switches to process-switch forwarding
 ! Default is disabled.
 no l2tp ip udp checksum

 ! Enable sequencing for packets sent over the L2TP tunnel.
 ! By default is sequencing is disabled.
 no l2tp sequencing

 ! Timeout before checking if a router that was previous busy is now free.
 !Range is 5 to 6000 seconds.
 !Default is 60 seconds.
 l2tp tunnel busy timeout 30

 ! Frequency of L2TP hello keepalive packets. Range 0 to 1000 seconds. Default 60 seconds.
 l2tp tunnel hello 30

 ! The number of L2TP control packets that can be queued in the receive window.
 ! Range is 0 to 5000.
 ! Default is platform dependant.
 l2tp tunnel receive-window 500

 ! The number of retries made sending the initial control packet when establishing an L2TP tunnel.
 ! Range is 1 to 1000.
 ! Default is 2 retries.
 l2tp tunnel retransmit initial retries 3

 ! The minimum and maximum frequency a router will retry to send the initial control packet during tunnel establishment.
 ! Range is from 1 to 8 seconds.
 ! Default is 1 second min and 8 seconds max.
 ! ONLY USED WHEN LOAD BALANCING IS CONFIGURED
 l2tp tunnel retransmit initial timeout min 3
 l2tp tunnel retransmit initial timeout max 6

 ! The number of retransmit retries for control packets.
 ! Range is 5 to 1000 retries. Default is 10 retires.
 l2tp tunnel retransmit retries 5

 ! The minimum and maximum frequency a router will retry to send control packets.
 ! Range is from 1 to 8 seconds. Default is minimum 1 and maximum 8 seconds.
 l2tp tunnel retransmit timeout min 3
 l2tp tunnel retransmit timeout max 4

 ! The number of seconds before an L2TP tunnel is closed down due to being empty (no subscribers).
 ! Range is 0 to 86400 seconds.
 ! Default is 15 seconds if the router is a NAS or 10 seconds if the router is a tunnel server.
 l2tp tunnel timeout no-session 5

 ! The number of seconds the router waits for the return message to an initial L2TP control
 ! packet before considering the peer busy.
 ! The range is 60 to 6000 seconds.
 ! Default is 10 seconds.
 l2tp tunnel timeout setup 25

 ! Enable PMTUD.
 ! Default it is disabled.
 ip pmtu

 ! Enable LCP MRU renegotiation.
 ! MRU is negotiated during the LCP phase of PPP establishment, when using wholesale services
 ! the MRU between CPE and LNS might different than the MRU between CPE and LAC.
 ! Default is disabled.
 ! Could be "on-mismatch" or "always".
 lcp renegotiation on-mismatch