Skip to content

IntermediateLesson 8 of 9

Staying up ​

Anything your network has only one of, such as a cable, a switch, or a router, takes part of the network down when it fails. It is a A part whose failure alone is enough to cut devices off. A second part that can do the same job removes the risk.. The cure is a second one.

A Link aggregation group: several links between the same two devices that act as one link. It gives more capacity, and a spare if one link fails. Some platforms call it a bond or a port channel. joins several ports into one link. Both switches treat the bundle as a single port. The VLANs are set on it, and spanning tree sees one link, not several.

Traffic is shared per conversation, not per packet. Each switch picks a cable for each conversation from its addresses and ports. It keeps that conversation on that cable, so its packets never overtake each other. When a cable fails, its conversations move to the cables that still work.

Both ends must agree which cables are in the bundle, and Link Aggregation Control Protocol: the two ends of a LAG send each other messages to agree which links belong to it. A link that does not answer as expected is kept out. checks it. A cable plugged into the wrong port, or into a switch that is not set up for the LAG, stays out of the bundle instead of causing trouble. A static LAG bundles its cables without asking.

Try itJoin two switches with several cables

Try separate links first, then one LAG. Cut cables in both.

With separate links, spanning tree blocks all but one cable. With a LAG, every working cable carries some of the conversations.

In Circuit, a LAG is an entry in interfaces.lag, and each member port says which LAG it is in with in_lag. Every other setting, such as the VLANs, goes on the LAG. mode is LACP when absent. Write mode: "static" only for a device that can't speak LACP.

ts
interfaces: {
    ethernet: {
        "10g-1": { description: "sw-02 10GE1/0/1", in_lag: "uplink", link: { device: "sw-02", port: "10g-1" } },
        "10g-2": { description: "sw-02 10GE1/0/2", in_lag: "uplink", link: { device: "sw-02", port: "10g-2" } },
    },
    lag: {
        uplink: { trunk_vlans: ["office", "servers"] },
    },
},

sw-02 has the same, pointing back at sw-01, so circuit validate can check that both ends of each cable agree.

CheckTwo switches are joined by a LAG of four 10 Gbit/s cables. How fast can one large download between them go?

Loops and broadcast storms ​

A LAG protects you from a broken cable, but not from a broken switch. For that, you join switches in a ring, so every switch has two ways to the others.

The ring is also a loop, and Ethernet can't live with one. In Switches, a switch sent a broadcast out of every port except the one it came in on. In Routers and the gateway, a packet carried a TTL that runs out. A frame has no such counter, so in a loop, a broadcast goes round forever. With more than one loop, every switch makes extra copies as it floods. That is a A broadcast that loops between switches and multiplies, until the links are full and the network stops working..

Try itSend a broadcast around a ring
sw-01priority 32768sw-02priority 32768sw-03priority 32768LaptopPrinter

The laptop sends one broadcast, such as an ARP question, to everyone on the network.

Spanning tree
Cables

Send a broadcast with spanning tree off. Add the second cable, and send again. Then turn spanning tree on, send, and cut the cable between sw-01 and sw-02.

Each round, every copy crosses one cable. The widget opens a blocked port as soon as you cut a cable, but real switches first have to notice the cut. The MAC addresses end in 01, 02, and 03, in the order of the switch names.

The switches’ files
// sw-01.ts, sw-02.ts, and sw-03.ts have no stp field, so spanning tree is off.

In a storm, every device on the network has to read each copy.

Spanning tree blocks one port ​

Spanning Tree Protocol: switches send each other small messages, called BPDUs, to find the loops between them, and block one port in each loop. STP for short. keeps the cables of a loop, but blocks one port so frames can't go round. It works like this:
  1. The switches elect a root bridge: the one with the lowest bridge priority, and among equals, the lowest MAC address.
  2. Every other switch picks its root port: the port with the cheapest path to the root. Faster links cost less.
  3. On every cable, the end closer to the root becomes the designated port. That end sends frames onto the cable.
  4. Every other port blocks. It still listens to spanning tree, but it sends and receives no frames.

When a cable fails, the switches work the tree out again, and a blocked port may open. The port at sw-03 did that when you cut the cable between sw-01 and sw-02. How long it takes depends on the version. The original STP waits tens of seconds before a port forwards. RSTP, the rapid version, is much faster, and mode: "rstp" runs it.

If you leave the election to chance, the root may be whichever switch has the lowest MAC address. That may be a small switch in a cupboard, and traffic between the others then crosses it. So give the switch you want as root a lower priority, in steps of 4096:

ts
switching: { stp: { mode: "rstp", priority: 4096 } },

A switch without stp in its file runs no spanning tree at all.

CheckThree switches all have bridge priority 32768. Which one becomes the root bridge?

Edge ports, for single devices ​

A port with one laptop, server, or printer behind it can never close a loop. Mark it as an edge port with stp: { edge: true }. Then it forwards as soon as the device is plugged in, instead of waiting until spanning tree is sure that no switch is behind it:

ts
"10g-3": { description: "Server", access_vlan: "servers", stp: { edge: true } },

Never mark a port that faces another switch as an edge port, because that is exactly where a loop can form. A port that must take no part in spanning tree at all gets stp: false, such as a member's port at an internet exchange. It then sends no spanning tree messages, and ignores the ones it gets.

Routers are single points too

A LAG and spanning tree protect cables and switches. If the router that is a VLAN's gateway fails, two routers can share one gateway address with VRRP, vrrp on each router's interface.

CheckWhich port should get stp: { edge: true }?

Discussion

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

Released under the Business Source License 1.1.