# isis — CLNS Link-State Routing (IIH, LSP, CSNP & PSNP Over L2) (`isis`)

> **FrameAssembly v3.3.0** · Protocol 10 of 81 · Canonical URL: https://frameassembly-lang.dev/docs/protocols/isis

- **Full Protocol Name:** Intermediate System to Intermediate System (ISO/IEC 10589)
- **Keyword:** `isis`
- **OSI Layer & Transport:** Layer 2 · 802.3 LLC CLNS 0xfefe03
- **Host Endpoint Rule:** MAC-Only or IP
- **Standards:** ISO/IEC 10589, RFC 1195, RFC 5301, RFC 5308
- **Wireshark Display Filter:** `isis`
- **Wire Encapsulation:** `Ethernet II -> IS-IS (802.3 LLC CLNS 0xfefe03)`

## Overview

Carrier and hyperscale backbones love IS-IS because it rides directly over Layer 2 (`0xfefe03` CLNS) and doesn’t care whether IPv4 or IPv6 melted down — `isis` builds L1/L2 Hellos, LSPs, CSNPs, and PSNPs in one line.

Intermediate System to Intermediate System (`isis`, ISO/IEC 10589 / RFC 1195) is the Layer 2 CLNS link-state interior gateway protocol powering service-provider MPLS/SRv6 cores and large data-center underlays. Because IS-IS runs directly over IEEE 802.3 LLC (`DSAP=0xfe, SSAP=0xfe, Ctrl=0x03`, NLPID `0x83`) rather than IP, adjacencies stay independent of IPv4 or IPv6 address-family changes.

FrameAssembly constructs all nine IS-IS PDU types (`l1iih`, `l2iih`, `p2piih`, `l1lsp`, `l2lsp`, `l1csnp`, `l2csnp`, `l1psnp`, `l2psnp`), selects the matching AllL1IS (`01:80:c2:00:00:14`) or AllL2IS (`01:80:c2:00:00:15`) multicast MAC automatically, encodes Area Addresses (TLV `1`), Dynamic Hostname (TLV `137`, RFC 5301), and Protocols Supported (TLV `129`), and computes Fletcher-16 LSP checksums.

## Minimal Quickstart (`isis_quickstart.frasm`)

```frameassembly
host core_r1 { mac 00:1c:73:01:00:01 }
host core_r2 { mac 00:1c:73:01:00:02 }

compile {
    core_r1 -> core_r2 isis l2iih sysid "1921.6800.1001" area "49.0001" holdtime 30 hostname "core-rtr-01"
}
```

### Automatic Wire Calculations

- Frames packets with IEEE 802.3 length + LLC `fe:fe:03` + ISO 10589 Intradomain Routing Protocol Discriminator `0x83` and sets `AllL1IS` (`01:80:c2:00:00:14`) or `AllL2IS` (`01:80:c2:00:00:15`) multicast destination MACs.
- Parses dotted hex `sysid` (`"1921.6800.1001"`) into the 6-byte System ID and encodes NSAP `area` (`"49.0001"`) into Area Addresses TLV `1` plus RFC 5301 Dynamic Hostname TLV `137`.
- Computes the ISO 8473 Fletcher-16 checksum across Link State PDUs (`l1lsp` / `l2lsp`) from the Remaining Lifetime offset to end-of-PDU.

## Practical Lab Example: Level-2 Broadcast Adjacency + LSP Flooding & CSNP/PSNP Acknowledgment (`isis_l2_lsdb_sync.frasm`)

Models two service-provider core routers forming a Level-2 LAN adjacency over VLAN 500, flooding an L2 LSP with sequence number 12, and synchronizing via CSNP and PSNP.

```frameassembly
host p_west { mac 00:1c:73:aa:10:01 }
host p_east { mac 00:1c:73:aa:10:02 }

compile {
    // 1. Bidirectional Level-2 LAN IIH Hellos on trunk VLAN 500
    p_west -> p_east isis l2iih sysid "1921.6801.0001" area "49.0001" priority 64 holdtime 27 hostname "p-west-01" vlan 500 wait 2ms
    p_east -> p_west isis l2iih sysid "1921.6801.0002" area "49.0001" priority 64 holdtime 27 hostname "p-east-01" vlan 500 wait 5ms
    // 2. Link State PDU flood + CSNP summary + PSNP confirmation
    p_west -> p_east isis l2lsp sysid "1921.6801.0001" lifetime 1199 seqnum 12 hostname "p-west-01" vlan 500 wait 2ms
    p_east -> p_west isis l2csnp sysid "1921.6801.0002" vlan 500 wait 2ms
    p_west -> p_east isis l2psnp sysid "1921.6801.0001" vlan 500
}
```

```bash
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show isis_l2_lsdb_sync.frasm

# 2. Compile .frasm -> classic .pcap, nanosecond .pcapng, or pipe via '-'
frameassembly isis_l2_lsdb_sync.frasm isis_l2_lsdb_sync.pcap
frameassembly isis_l2_lsdb_sync.frasm isis_l2_lsdb_sync.pcapng

# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse isis_l2_lsdb_sync.pcap isis_l2_lsdb_sync_edited.frasm

# 4. Verify dissected protocol fields in tshark
tshark -r isis_l2_lsdb_sync.pcap
```

## All `isis` Keywords & Header Options

Packet line pattern: `src_host -> dst_host isis [l1iih | l2iih | p2piih | l1lsp | l2lsp | l1csnp | l2csnp | l1psnp | l2psnp] [sysid "<text>"] [area "<text>"] [holdtime <0..65535>] [priority <0..255>] [lanid "<text>"] [circuittype <0..255>] [lifetime <0..65535>] [seqnum <number>] [hostname "<text>"]`

| Keyword / Option | Accepted Value | Default | Effect on Packet |
| --- | --- | --- | --- |
| `l1iih \| l2iih \| p2piih \| l1lsp \| l2lsp \| l1csnp \| l2csnp \| l1psnp \| l2psnp` | IS-IS PDU type keyword (or `type "<pdu>"`) | `l2iih (PDU Type 16)` | Selects L1/L2 LAN Hello (`15`/`16`), P2P Hello (`17`), L1/L2 LSP (`18`/`20`), L1/L2 CSNP (`24`/`25`), or L1/L2 PSNP (`26`/`27`). |
| `sysid "<text>"` | 6-byte hex System ID (e.g. "1921.6800.1001") | `"0000.0000.0001"` | Writes the 6-octet originating System ID in the IIH, LSP, CSNP, or PSNP header. |
| `area "<text>"` | Hex ISO Area Address (e.g. "49.0001") | `"49.0001"` | Encodes Area Addresses TLV `1` inside Hello and LSP PDUs. |
| `holdtime <0..65535>` | Seconds (0..65535) | `30` | Sets the 16-bit Holding Timer inside `l1iih`, `l2iih`, and `p2piih` headers. |
| `priority <0..255>` | DIS Priority (0..127) | `64` | Sets the 7-bit Designated Intermediate System (DIS) election priority in LAN IIH headers. |
| `lanid "<text>"` | 7-byte LAN ID (System ID + Pseudonode) | `sysid + ".01"` | Sets the 7-octet Designated IS LAN ID field inside `l1iih` and `l2iih` PDUs. |
| `circuittype <0..255>` | Circuit Type (1=L1, 2=L2, 3=L1/L2) | `Matches PDU level (1, 2, or 3)` | Sets the 8-bit Circuit Type field inside IIH and LSP headers. |
| `lifetime <0..65535>` | Remaining Lifetime in seconds | `1200` | Sets the 16-bit Remaining Lifetime inside `l1lsp` and `l2lsp` PDUs (`0` purges an LSP). |
| `seqnum <number>` | Whole number (32-bit LSP sequence) | `1` | Sets the 32-bit Sequence Number in `l1lsp` and `l2lsp` headers and recalculates Fletcher-16. |
| `hostname "<text>"` | Quoted router hostname | `Omitted unless set` | Appends RFC 5301 Dynamic Hostname TLV (`137`) so Wireshark resolves System IDs symbolically. |

## Cross-Layer Options Valid with `isis`

| Option | Range / Format | Default | Effect |
| --- | --- | --- | --- |
| `wait <number><ns\|us\|ms\|s\|m>` | Time gap (ns, us, ms, s, m) | `10ms` | Advances the packet timestamp clock after sending this packet and before the next packet (`wait 0ns` sends back-to-back). |
| `comment "<text>"` | Quoted UTF-8 annotation | `Omitted` | Attaches an Enhanced Packet Block `opt_comment` annotation when compiling to `.pcapng` (Wireshark `pkt_comment` filter). |
| `payload "<text>" \| hexpayload "<hex>"` | Quoted text or hex bytes (choose one) | `Omitted` | Appends or overrides raw payload bytes (`"deadbeef"`, `"de:ad:be:ef"`, or `"\x01\x02"`) and updates packet lengths and checksums. |
| `srcmac <mac> \| dstmac <mac> \| ethertype <0..65535>` | Colon/hyphen/Cisco MAC · EtherType 0..65535 (e.g. 0x0800) | `Host MAC / RFC multicast MAC / auto EtherType` | Overrides the 14-byte Ethernet II source MAC, destination MAC, or standalone Layer 2 16-bit EtherType. |
| `fcs \| badfcs` | Ethernet CRC-32 trailer flags (choose one) | `Omitted` | `fcs` appends a valid IEEE 802.3 4-byte CRC-32 Frame Check Sequence trailer; `badfcs` XOR-corrupts the CRC-32 for NIC/tap negative tests. |
| `vlan <0..4095> [pcp <0..7>] [dei <0\|1>]` | VLAN ID 0..4095, PCP 0..7, DEI 0..1 | `Untagged` | Wraps the packet in an IEEE 802.1Q VLAN tag (`0x8100`) with optional 802.1p QoS priority. |
| `qinq <0..4095> [innervlan <0..4095>]` | Outer S-VLAN 0..4095, Inner C-VLAN 0..4095 | `Untagged (innervlan 1 when qinq is set)` | Double-tags the packet with outer IEEE 802.1ad S-Tag (`0x88a8`) plus inner IEEE 802.1Q C-Tag (`0x8100`). |
| `mpls <0..1048575> [label <0..1048575>] [exp\|tc <0..7>] [bos <0\|1>] [mplsttl <0..255>]` | Repeatable label stack (0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255) | `Unlabeled (auto bos=0 on outer labels, bos=1 on bottom)` | Prepends one or more 32-bit MPLS label shims (`0x8847`, e.g. `mpls 16000 mpls 24010`) ahead of Layer 2 EoMPLS or Layer 3 payloads. |

## Common Mistakes & Quick Fixes

### IS-IS Runs Directly Over Layer 2 (MAC-Only Hosts Are Valid)

- **Avoid:** `isis_a -> isis_b isis l2_iih sys_id "1921.6800.1001"`
- **Valid v3.3.0 Syntax:** `isis_a -> isis_b isis l2iih sysid "1921.6800.1001"`

All PDU type names and modifiers are strict lowercase alphanumeric (`l2iih`, `p2piih`, `l2lsp`, `l2csnp`, `sysid`, `holdtime`, `seqnum`) with zero underscores.

### Quote Dotted Hex sysid and area Values

- **Avoid:** `p1 -> p2 isis l2iih sysid 1921.6800.1001 area 49.0001`
- **Valid v3.3.0 Syntax:** `p1 -> p2 isis l2iih sysid "1921.6800.1001" area "49.0001"`

Wrap NSAP area strings (`"49.0001"`) and 6-byte System IDs (`"1921.6800.1001"`) in double quotes so the lexer does not parse them as malformed IPv4 literals or OIDs.
