Skip to content

ProfessionalLesson 14 of 14

Project: an internet exchange ​

In Networks of networks you joined an exchange as a member. In this project you are the exchange. You run the switches every member plugs into, decide what a member's port may do, and admit new members.

An exchange has two parts, and Circuit runs one of them:

  1. The The switches of a data center or an exchange, and the links between them, built to work as one network. is the switches that carry the peering LAN to every member port. Circuit configures it.
  2. The route servers run BGP software that passes every member's routes on to every other member. You set them up outside Circuit.

What the fabric must protect ​

Members share one LAN and don't have to trust each other. A mistake at one member must not reach the others, such as a loop in its own network, or a switch plugged in where a router should be. So exchanges publish what a member may send, and their rules are much alike. LU-CIX and OHIO IX, for example, ask for these:

  • Every frame from a port comes from one The address a network card is given when it is made. Devices on the same local network use it to deliver messages to each other., the member's router. Another one can shut the port.
  • Frames carry only IPv4, ARP, and IPv6, told apart by their The field in an Ethernet frame that says what it carries, such as 0x0800 for IPv4, 0x0806 for ARP, and 0x86DD for IPv6..
  • Nothing that belongs between two neighbors leaks onto the LAN. That means no spanning tree, no discovery protocols such as LLDP, and no DHCP.
  • No broadcast or multicast goes out, except what IPv4 and IPv6 need to find each other's hardware addresses.

MANRS, from Hijacks and leaks, also asks an exchange to publish which traffic is not allowed on the fabric, and to filter it.

The example writes six of these protections onto every member port, from one value in its site.ts:

  1. The peering VLAN alone.
  2. No spanning tree.
  3. No LLDP.
  4. One MAC address.
  5. Only IPv4, ARP, and IPv6.
  6. A switch feature that drops broadcast, multicast, and unknown unicast traffic over a set share of a port's speed, so a storm cannot flood every other port. at 1% of the port's speed.
Try itMake a member misbehave
trunk, 40g-5ix-sw-01ix-sw-02rs1route serverCloudflareAS13335GoogleAS15169AS64511its own switch
The port of AS64511 does
Then this happens

All four protections start on. Make AS64511 misbehave, then turn off the protection that stopped it, and try again.

Each protection keeps one member's trouble on that member's port. Without storm control, a loop at one member becomes a broadcast storm that reaches every router on the exchange.

Where these run

One MAC address per port, mac_limit, and the ethertype filter, ethertypes, run only on the platforms where they were tested on a device. Platforms lists them, and circuit validate refuses them on any other.

CheckA member plugs in a new switch with a loop behind it. Which protection keeps the rest of the exchange from drowning in its broadcasts?

Start from the example ​

Install Circuit, then copy the internet exchange example into the project:

text
my-exchange/
  circuit.ts              the exchange's AS, its peering LAN, and the checks
  sites/ix-1/site.ts      what both switches share, and what a member's port is
  sites/ix-1/ix-sw-01.ts
  sites/ix-1/ix-sw-02.ts
  members/cloudflare.ts   one file per member
  members/index.ts        every member, merged
  lib/checks.ts           a check of your own

What every member port is ​

ts
// ix-1: what both switches write, and what every member's port is.

export const ix_1 = literal({
    timezone: "Asia/Singapore",
    management: "10.0.0.0/24",
    vlans: {
        mgmt: { id: 10, description: "Management, never on a member port" },
        peering: { id: 100, description: "Peering LAN" },
    },
    /** A member's port, on the peering LAN with no spanning tree or LLDP toward the member. It takes one MAC address and only IPv4, ARP, and IPv6, and it caps flooded traffic. */
    member_port: {
        access_vlan: "peering",
        stp: false,
        lldp: false,
        mac_limit: 1,
        ethertypes: ["ipv4", "arp", "ipv6"],
        storm_control: { broadcast: { percent: 1 }, multicast: { percent: 1 }, unknown_unicast: { percent: 1 } },
    },
});

member_port is what every member's port is, written once. A member's file takes it whole and adds its own description.

A member ​

ts
// Cloudflare, AS13335: one port on ix-sw-01. Its addresses on the peering LAN are for the route servers, which Circuit does not configure.

import { ix_1 } from "../sites/ix-1/site";

export const cloudflare = {
    parts: {
        "ix-sw-01": part("device", {
            interfaces: { ethernet: { "40g-1": { ...ix_1.member_port, description: "Cloudflare, AS13335" } } },
        }),
    },
};
ts
// Every member, merged whole. A member joins by being added here, and leaves by being removed: the next apply turns its port off.
// `empty` holds no member. It keeps members.parts there for the switches when the last member leaves.

import { cloudflare } from "./cloudflare";
import { google } from "./google";

const empty = { parts: {} };

export const members = merge([empty, cloudflare, google]);

A member is one file with its port, a part keyed by the switch it is on. members/index.ts merges every member, and each switch takes them with include: [members.parts].

The switches ​

ts
// The first fabric switch: members, the route servers, and the way in for management. The switches have no address on the peering LAN: they only carry it.

import { as64500 } from "../../circuit";
import { members } from "../../members";
import { ix_1 } from "./site";

export default as64500.device({
    name: "ix-sw-01",
    include: [members.parts],
    site: "ix-1",
    role: "Fabric switch",
    platform: "vrp",
    model: "CE6855-48S6Q-HI",
    connection: { host: "10.0.0.2", user: "operator" },

    system: {
        timezone: ix_1.timezone,
        ntp: { servers: ["10.0.0.1"] },
        users: { operator: { role: "admin", password: secret("IX_SW_01_PASSWORD") } },
    },
    management: { allow: [ix_1.management], ssh: {} },

    interfaces: {
        ethernet: {
            "10g-47": { description: "Route server rs1", access_vlan: "peering", stp: false },
            "10g-48": { description: "Route server rs2", access_vlan: "peering", stp: false },
            "40g-5": { description: "ix-sw-02 40GE1/0/5", trunk_vlans: ["peering", "mgmt"], link: { device: "ix-sw-02", port: "40g-5" } },
            "40g-6": { description: "Management network", access_vlan: "mgmt" },
        },
        vlan_interface: {
            mgmt: { vlan: "mgmt", addresses: ["10.0.0.2/24"] },
        },
    },
    switching: {
        vlans: ix_1.vlans,
        stp: {},
        lldp: true,
    },

    routing: {
        static_routes: [{ prefix: presets.default_routes.ipv4, next_hop: "10.0.0.1" }],
    },
});

The switches have no address on the peering LAN, because they only carry it. Each writes what is its own: the route servers' ports, the trunk to the other switch, and the way in for management.

ts
// This network's own checks, beside Circuit's built-in ones. circuit.ts turns them on in `checks`.

import type { Check } from "circuit";

/** Every port on the peering LAN says whose it is, so the NOC can find a member by its port. */
export const membersDescribed: Check = (network) =>
    network.devices.flatMap((device) =>
        Object.entries(device.interfaces?.ethernet ?? {})
            .filter(([, port]) => port?.access_vlan === "peering" && !port.description)
            .map(([name]) => ({
                device: device.name,
                path: `interfaces.ethernet.${name}`,
                message: "is on the peering LAN and says nothing about whose it is: write a description.",
            }))
    );

Admit a member ​

A new member, Fastly, sent its request to join, with AS54113 and a port on ix-sw-02. Write its file, and see what Circuit says.

Try itWrite the new member's file
MemberASPort
CloudflareAS13335ix-sw-01 40g-1
GoogleAS15169ix-sw-02 40g-1

On ix-sw-02, 40g-5 is the trunk to ix-sw-01.

0 of 2 decided

1. Its AS number
2. Its port on ix-sw-02
members/fastly.ts
import { ix_1 } from "../sites/ix-1/site";

export const fastly = {
    parts: {
        "ix-sw-02": part("device", {
            interfaces: { ethernet: { "10g-2": { ...ix_1.member_port, description: "Fastly, AS54113" } } },
        }),
    },
};
Where you have not picked, the file uses the sound choice.

Make the two decisions, then run validate and diff.

A member's addresses on the peering LAN are for the route servers, so they aren't in the switches' files. Keep them in the route servers' config, and check them there.

CheckThe new member is given 40g-1 on ix-sw-02, the port of Google. What does circuit validate say, and why?

The route servers ​

You run BGP software, such as BIRD or OpenBGPD, on two route servers, set up from the same member list. Circuit doesn't write their config. The standards for them say:

  • A route server carries no traffic. It passes every member's routes on with the next hop unchanged. So traffic goes straight from one member's router to another's, across the fabric.
  • It shouldn't add its own AS to the routes it passes on, so members see each other's paths as if they peered directly.
  • Run more than one, each set up the same way, so one can be down for maintenance. That is why the example has two route server ports, and members keep a session with each.
  • Filter what each member sends, with a limit on how many prefixes each may announce, and filters on which. MANRS asks an exchange to filter at its route servers with the routing registries and RPKI. Hijacks and leaks shows both.

Members are free to peer with each other directly as well, over the same fabric, with sessions of their own.

When a member leaves ​

A member leaves when you remove it from members/index.ts. Its file can stay where it is, because it is no longer in the list. When Cloudflare leaves, circuit diff plans this for ix-sw-01:

text
ix-sw-01: 16 command(s) in 2 step(s)
  interface 40GE1/0/1
    - traffic-filter acl 4000 inbound
    - mac-address limit maximum 1
    - lldp disable
    - storm control enable log
    - storm control enable trap
    - storm control action suppress
    - storm control unknown-unicast min-rate percent 1 max-rate percent 1
    - storm control multicast min-rate percent 1 max-rate percent 1
    - storm control broadcast min-rate percent 1 max-rate percent 1
    - stp disable
    - port default vlan 100
    - description Cloudflare, AS13335
    + shutdown
  ACLs no longer used
    - acl number 4000

The port is shut, so whatever is still plugged into it reaches nothing. Its address on the peering LAN is free for the next member, once the route servers have dropped the sessions of Cloudflare.

Further reading ​

Discussion

Stuck, or found a mistake? Ask here. You sign in with GitHub.

Released under the Business Source License 1.1.