# 1 TRILL

```
TRILL is an IETF specification.

As a standard ,RFC 6325 details what is TRILL.
```

first we are going to explain a little what's TRILL,as the name illustrates,transparently interconnecting lots of links together,but by what? **Routing Bridge** short for **RBridge** .in Trill ,we deploy several RBridges in existing Bridged LANs,which will transparently implementation part of L2 functions as the traditional bridges ,the advantage is we use routing in switching and eliminate link blocking which is employed by traditional switching technique ,such as Spanning tree protocol,instead ,we use redundant links at the same time for sharing loads which can result in better utilizing the infrastructure.

next we will describes RBridges more specifically .

## 1.1 overview of RBridge

the essence of RBridge is absolutely bridge,RBridge is to extend **customer bridge** (802.1d and 802.1q) functionality ,and _RFC6325 states that it would not support provider bridge (802.1AD) and provider backbone bridge (802.1ah)_ .

TRILL employs a dynamical link state routing protocol among RBridges which is called IS-IS ,it is run directly on Layer 2,and behaves similar to IP layer 3 routing ,here in order to mitigate temporary loop issues ,RBridge forwards packets based on a header (8-byte TRILL) with a hop field. as IP forwarding does,the RBridge will decrement hop field until it reach to 0,and then the packet will be discarded.

You may remember in IP routing ,IP addresses including source and destination address are the basis of routing , RBridge also have similar routing basis,i.e. 16-byte nickname in TRILL header ,source nickname and destination nickname act as address of RBridges where packets are originated from to sent to .and through dynamically advertisement and calculation ,every Rbridge could know the shortest path to other Rbridges,

TRILL also supports multi-pathing through ECMP(equal cost multipath) ,this could share load to different paths,that's to say ,a more mesh-like network structure will benefit more from TRILL enhanced network.

the core RBridge which only routes and forwards packets (does not interfere with customer traffic ) is called _transit RBridge_ ,transit RBridge only routes and forwards packets according to TRILL header within packets, they does not care any about end station's address. so it could scale a lot with the core bridges increasing.

as RFC6325 states ,the TRILL protocol is link layer independent ,the core bridged LANs could be PPP links,or Ethernet LANs,it does not matter,but Rbrigde should know the actual links technology it is accessing.

we summarize the benefits below:

* Loop may exist ,but only for a little rounds because of HOP field in TRILL header .
* mac and vlan and port mapping only snooped and learned at the edge bridges ,the transit bridge does not need to do so.
* RBirdge nicknames comprise the forwarding tables somehow,so the forwarding information base can be easily scalable.
* the RBridge can forward traffic with a vlan(similar to B-VLAN in 802.1ah PBB).

## 1.2 overview of TRILL Header

the following figure illustrates how trill header is comprised(I export it from RFC6325) :

```bash
figure:TRILL Header
                                   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
                                   | V | R |M|Op-Length| Hop Count |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   Egress RBridge Nickname     |  Ingress RBridge Nickname     |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  Options...
   +-+-+-+-+-+-+-+-+-+-+-+-
```

it occupies 8-bytes (inlcuding link layer Ethertype:0x22F3).

v stands for version,r should be reserved and set to zero ,m indicates whether the packet is sent to all the other RBridges ,i.e. all BUM customer packets should set m to 1 ,Egress and Ingress nicknames are the identifiers of RBridges ,TRILL IS-IS protocol can negotiate and make sure each of Bridges will have a unique nickname within campus. hop count is a 6-byte field ,RBridge will never forward a packet with hop count equal to 0

note that nickname 0x0000 is reserved to indicate the nickname field is not specified,and 0xffc0 through 0xfffe is reserved for future specification use,last 0xffff is permanently reserved.

note that when 'M' bit is equal 0,the packet should be unicast to the Egress Nickname RBridge along a shortest path,once the 'M' is set to 1,the packet is sent to the tree for which the egress nickname stands,the tree is calculated .

## 1.3 TRILL data encapsulation details

There are two types of rbridges :ingress/egress Rbridge and transit ,a typical flow could be like :

```bash
Flow:
     +-----+  +-------+   +-------+       +-------+   +-------+  +----+
     | ESa +--+  RB1  +---+  RB3  +-------+  RB4  +---+  RB2  +--+ESb |
     +-----+  |ingress|   |transit|       |transit|   |egress |  +----+
              +-------+   +-------+       +-------+   +-------+
```

the outer Ethernet header is presented as below:

```bash
Outer Ethernet Header:             |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |             Outer Destination MAC Address  (RB4)              |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | Outer Destination MAC Address | Outer Source MAC Address      |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                Outer Source MAC Address  (RB3)                |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |Ethertype = C-Tag [802.1Q-2005]| Outer.VLAN Tag Information    |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
```

it should be clear that the outer dest.mac is the next hop(interface) rbridge's mac address, source.mac is the interface's mac from which the packet is sent. also ,it MAY contain a 802.1q vlan tci header.we should configure manually configure the vlan the interface use for finer granularity of traffic steering.

Next is TRILL header ,we the simple structure is :

```bash
TRILL Header:
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | Ethertype = TRILL             | V | R |M|Op-Length| Hop Count |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | Egress (RB2) Nickname         | Ingress (RB1) Nickname        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
```

note ingress and egress will never change during transmission in the core.

Next is inner Ethernet header :

```bash
Inner Ethernet Header:
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |             Inner Destination MAC Address  (ESb)              |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | Inner Destination MAC Address | Inner Source MAC Address      |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                  Inner Source MAC Address  (ESa)              |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |Ethertype = C-Tag [802.1Q-2005]| Inner.VLAN Tag Information    |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
```

TRILL should be 802.1q aware ,and TRILL will keep the customer vlan tci in the inner frame,will not change until it leaves TRILL campus network.

## 1.4 summary

how TRILL use IS-IS to run a L2 link state protocol is not my concern ,distributed IS-IS is really hard for me to fully understand the principle because I have no such experience before.

TRILL is a kind of switching technique which employs L3 routing ideology ,which makes mesh-like network structure even more effective ,and do not touch existing bridges ,just extends them and continues offering customer bridging service.you will find it more like a routing protocol compared with SPB(an IEEE specification,802.1aq),so it's often called cloud switching .
