# VPWS with Sequencing

Load **vpws.sequencing.init.cfg**

```
#IOS-XE (R1-R6, CE1,3,8,10)
config replace flash:vpws.sequencing.init.cfg
```



Configure two VPWS services:

* CE1 and CE10 using sequencing only one way, on packets transmitted by R1
* CE3 and CE8 using sequencing both ways, and resetting the sequence numbers when 100 packets are seen out-of-sync



The CEs are already preconfigured with IP addressing as 10.X.Y.X/24













































## Answer <a href="#fb4f0ef3-0fbb-4ffc-905d-34dfc7a671c9" id="fb4f0ef3-0fbb-4ffc-905d-34dfc7a671c9"></a>

```
#R1
int Gi4
 no ip address
 service instance 1 eth
  encapsulation default
 exit
!
template type pseudowire R1_SEQ
 encapsulation mpls
 sequencing transmit
 control-word include
!
l2vpn xconnect context CE1_CE10
 member gi4 service-instance 1
 member 2.2.2.2 110 template R1_SEQ

#R2
int Gi4
 no ip address
 service instance 1 eth
  encapsulation default
 exit
!
template type pseudowire R2_SEQ
 encapsulation mpls
 sequencing receive
 control-word include
!
l2vpn xconnect context CE1_CE10
 member gi4 service-instance 1
 member 1.1.1.1 110 template R2_SEQ

#R5
int Gi6
 no ip address
 service instance 1 eth
  encapsulation default
 exit
!
template type pseudowire CW_SEQ
 encapsulation mpls
 sequencing both
 sequencing resync 100
 control-word include
!
l2vpn xconnect context CE3_CE8
 member gi6 service-instance 1
 member 6.6.6.6 38 template CW_SEQ


#R6
int Gi6
 no ip address
 service instance 1 eth
  encapsulation default
 exit
!
template type pseudowire CW_SEQ
 encapsulation mpls
 sequencing both
 sequencing resync 100
 control-word include
!
l2vpn xconnect context CE3_CE8
 member gi6 service-instance 1
 member 5.5.5.5 38 template CW_SEQ
```



## Explanation <a href="#d773ca41-5c32-4275-a39f-fcc1f438e31e" id="d773ca41-5c32-4275-a39f-fcc1f438e31e"></a>

The control word is by default enabled on xconnects in IOS-XE. Sequencing is a feature that is supported when the control word is used. By default sequencing is disabled. When using sequencing, the PE will place a sequence number in the CW. This number will simply increment by 1 for each packet. When it gets to 65535, it will wrap around back to 1. The egress PE, if it receives an out-of-order sequence number, will drop the packet. This ensures that the L2VPN service never delivers out-of-order packets.



Sequencing can be enabled unidirectionally. One side can send with sequence numbers but not receive them, and one side can receive sequence numbers but not send them. Sequencing is only available when using tLDP, not when using manual PWs.



There is also a resync option available. When a router receives X number of packets that are out-of-order, it resets the sequence number. This can help speed up reconvergence when events happen that cause lots of out-of-order packets. I believe the receiving router that notices out of order packets will alert the sending router to reset its sequence number via LDP, however this isn’t clear and is not something that is really possible to test.



We can control these parameters using a template and applying the template to a neighbor under the xconnect.

```
template type pseudowire name
 encapsulation mpls
 sequencing receive|transmit|both
 sequencing resync num
 control-word include
!
l2vpn xconnect context name
 neighbor 1.1.1.1 vcid template name
```



## Verification <a href="#id-3192c129-26d4-4201-a3b0-1584ed06207d" id="id-3192c129-26d4-4201-a3b0-1584ed06207d"></a>

Inspect the details of the VC to view the sequencing parameters. On R1 is shown below:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2Fu7LHv6XEtwEIbykYWzfM%2Fimage.png?alt=media&#x26;token=4ade1262-b86f-4786-a5e3-59916359d8bc" alt=""><figcaption></figcaption></figure></div>



On R5 and R6, we should see sequencing enabled in both directions and resync enabled:

<div align="left"><figure><img src="https://3072390383-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkUz2C3GqnZcWhoVL6jfk%2Fuploads%2FyR451smczXuRprAlEwkz%2Fimage.png?alt=media&#x26;token=8163227f-2be5-4139-a092-df8b6ea583b4" alt=""><figcaption></figcaption></figure></div>
