Networks

Networks

What hands out addresses on each network docker-server can reach. Two routers split the building:

  • The EdgeRouter (AV-ROUTER) serves Control, Comms and AVoIP.
  • IT’s UniFi gateway (MAC 68:d7:9a:59:8c:74, the office’s 192.168.0.1) serves SPACnet, Lighting and Video.

Each is the gateway as well as the DHCP server on its networks. Management and Dante A have no DHCP at all. The EdgeRouter also has an address on Management, 192.168.100.254, used only for its own SNMP and NTP; it routes nothing into or out of that VLAN. And it has one on Video, 10.0.23.253, used only to let the MUSE into Video (below).

Internet and office access

Network Internet How
Lighting, Video yes IT’s UniFi gateway, on the office’s public IP
Control only the AMX controllers: the NX4200 (192.168.30.150) and the MUSE (192.168.30.175) EdgeRouter → SPACnet → IT’s gateway, allowlist CONTROL_INTERNET
Comms only the Green-Go BridgeX (10.0.24.1) EdgeRouter → SPACnet → IT’s gateway, allowlist COMMS_INTERNET
AVoIP no the EdgeRouter doesn’t let it out
Management, Dante A no no gateway

The EdgeRouter’s uplink is SPACnet. eth0.5 takes an ordinary DHCP lease from IT’s gateway, and the router translates outgoing traffic onto it. Its WAN_OUT firewall lets out only the devices in two address groups: CONTROL_INTERNET (today the two AMX controllers, the NX4200 and the MUSE) and COMMS_INTERNET (today just the Green-Go BridgeX). To give another device internet, give it a DHCP reservation and add its address to the group for its network. Nothing goes out to a private, CGNAT or link-local address, so neither network reaches the office, nor Lighting or Video through IT’s gateway. The router answers DNS on Control and Comms, forwarding to the resolvers SPACnet’s DHCP hands it. Devices without internet can still resolve names; they just can’t connect. One name is answered locally: pool.ntp.org resolves to docker-server’s address on the asking device’s own network (192.168.30.200 on Control, 10.0.24.200 on Comms), so a device that only knows the public NTP pool gets docker-server’s time. The wireless cameras’ RackLink depends on it — see Control.

If an allowlisted device still can’t connect, check the router’s live set. The firewall rule matches against a kernel address set, not the config, and the two can disagree. On the router, show firewall group CONTROL_INTERNET lists the live members. If an address in the config is missing there, sudo ipset add CONTROL_INTERNET <address> loads it. Nothing needs saving, because the config already holds it.

The router is invisible from the office. Nothing answers on its SPACnet address, over IPv4 or IPv6. It also ignores office traffic that reaches its Control address through IT’s .250 leg: CONTROL_LOCAL accepts only Control and the management network. Nothing from the office reaches Comms or AVoIP at all. IT’s DHCP client list shows the router as AV-ROUTER.

The office can reach docker-server at 192.168.30.200. IT’s gateway delivers the traffic through its Control leg, and docker-server answers on its own office interface. The office can’t reach other Control devices: their replies go through the EdgeRouter, which won’t send them to the office.

IT’s gateway routes office traffic into Lighting and Video. Lighting devices mostly don’t answer, because few have a gateway set, but nothing blocks the traffic on the way in. Video devices answer. Only IT’s firewall can close either.

The MUSE and the video network

The MUSE controller (192.168.30.175) reaches every device on Video, and nothing else on Control does. The EdgeRouter routes it through its own Video address, 10.0.23.253. Its traffic leaves from that address, so Video devices answer the EdgeRouter rather than their own gateway, the UniFi. Video devices keep the UniFi as their gateway.

The EdgeRouter’s firewalls on eth0.23 keep it to that, and log what they drop:

Ruleset What it allows
VIDEO_OUT into Video: only the VIDEO_CLIENTS group, to any address and port
VIDEO_IN out of Video through the router: replies only
VIDEO_LOCAL to the router itself from Video: ping only, so no DHCP, DNS, SSH or web UI (VIDEO_LOCAL6: ICMPv6 only)

The router’s NAT rule 5020 sends the same group’s traffic from 10.0.23.253. To let another Control device into Video, add its address to VIDEO_CLIENTS.

The router keeps a static ARP entry for each video operator PC, so the MUSE can wake one that is off: 10.0.23.17 (VIDEO-MIXER, 1c:69:7a:ae:d6:ab) and 10.0.23.18 (VIDEO-COLOR, 1c:69:7a:af:4e:ac), under protocols static arp. The MUSE sends its Wake-on-LAN packet to the PC’s own address, and the entry lets the router deliver it while the PC is off and not answering ARP. A broadcast from Control stays on Control, and the router’s kernel (4.14) can’t forward a broadcast into Video. If a PC’s address or network card changes, change its entry too.

IT’s UniFi delivers Video traffic into Control. It is Video’s gateway and has a Control address, 192.168.30.250, so a Video device’s packets to a Control address never pass through the EdgeRouter. Control devices reply through the EdgeRouter, which drops the replies, so ping and TCP from Video fail. One-way UDP arrives. If the MUSE answers that UDP, its reply leaves from 10.0.23.253, and a sender that checks where the reply came from discards it. Only IT’s firewall can close this path.

DHCP by network

VLAN Network Subnet DHCP server Authoritative Lease Gateway handed out
2 Management 192.168.100.0/24 none — static addresses only — — —
5 SPACnet (office) 192.168.0.0/23 UniFi gateway, 192.168.0.1 yes 1 day 192.168.0.1
21 Control 192.168.30.0/24 EdgeRouter, 192.168.30.254 yes 1 day 192.168.30.254
22 Lighting 10.0.22.0/24 UniFi gateway, 10.0.22.254 yes 1 day 10.0.22.254
23 Video 10.0.23.0/24 UniFi gateway, 10.0.23.254 yes 1 day 10.0.23.254
24 Comms 10.0.24.0/24 EdgeRouter, 10.0.24.254 yes 7 days 10.0.24.254
25 AVoIP 10.0.25.0/24 EdgeRouter, 10.0.25.254 yes 7 days 10.0.25.254
26 Dante A 192.168.10.0/24 none — static addresses only — — —

Authoritative means the server refuses (NAKs) a request for an address that doesn’t belong on that network. A device moved from one network to another therefore gets a new lease straight away, instead of holding on to a dead address until its old lease runs out. Every server above does this; the UniFi’s refusal reads wrong network.

No network has more than one DHCP server. A discover from a made-up MAC gets a single offer on each network that has DHCP, and none on the other two. Two authoritative servers on one network would refuse each other’s clients, so keep it that way.

The EdgeRouter also carries scopes for Lighting, Video, Core (10.0.0.0/24), LAN1 and LAN2, but all five are disabled. Its Lighting interface (eth0.22) is shut down, and configured with the .254 address the UniFi answers on: turning it back on would put two gateways and two DHCP servers on that VLAN. Its Video interface (eth0.23) is up at 10.0.23.253, and VIDEO_LOCAL drops DHCP there, so even with the Video scope enabled the router would hand out no addresses.

Every DHCP reply on Control arrives twice. The UniFi gateway also has an address on Control (192.168.30.250), and it relays Control DHCP to the EdgeRouter. It then re-broadcasts the router’s answers, about 40 ms after the router’s own. Both copies carry server ID 192.168.30.254, so the second isn’t a rogue server. It’s harmless, and it’s configured on IT’s side.

On the static networks nothing answers DHCP, so every device on them needs an address set by hand. A Dante device left on automatic addressing falls back to a link-local 169.254.x.x address.

Not covered here, because docker-server has no interface on them:

  • Dante B (192.168.11.0/24), on its own pair of SG-300s;
  • SPAC’s wireless networks.

The EdgeRouter’s memory

The EdgeRouter has 256 MB of RAM and no swap, and its /tmp and /var/log are held in that RAM. It normally has 120–140 MB available. A file in /tmp uses memory until it is deleted, and a deleted file keeps using it until the process writing it stops. A packet capture left running on the router (tcpdump -w /tmp/…) therefore uses up its memory for as long as it runs. Give every capture on the router a limit (-c <packets> or timeout <seconds>), copy the file off, and check that none is left running: ps -eo pid,etime,args | grep [t]cpdump.

Short of memory, the router keeps routing but its own services stop. At about 20 MB available the kernel starts killing processes. SSH takes minutes to log in, and the web UI, DNS, SNMP and DHCP time out. A device that asks for a lease then gets none: a Windows PC falls back to a 169.254.x.x address, so nothing finds it at its reserved one. If df -k /tmp reports more than du -sk /tmp, a process still holds deleted files. Stopping that process, or rebooting the router, frees the memory. The router answers SSH again about 4½ minutes after sudo reboot. No RackLink outlet is known to power it, so a power cycle has to be done by hand.

Two Grafana alerts watch it, in group router in AV Alerts, sent to Slack (slack-av-alerts). Both read docker-server’s SNMP scrape of 192.168.100.254 (job snmp_host, HOST-RESOURCES-MIB):

Alert Fires when
AV-ROUTER memory low less than 64 MB is available for 30 minutes
AV-ROUTER not answering SNMP more than half the scrapes over 30 minutes fail, for 10 minutes

The memory figure keeps its last value for up to 6 hours while SNMP doesn’t answer, so the memory alert stays up while the router is too short of memory to report. The router’s log in Grafana lists what the kernel killed: {source_ip="192.168.30.254"} |= "Killed process".

Checking a network

To see every DHCP server on a network, send a discover from a random MAC out of docker-server’s interface for it. The probe needs raw sockets, which a host-network container provides without root on the host:

docker run --rm --network host --cap-add NET_RAW --cap-add NET_ADMIN alpine:3 sh -c \
  "apk add -q nmap nmap-scripts && nmap -e <interface> --script broadcast-dhcp-discover \
   --script-args broadcast-dhcp-discover.mac=random"

The interfaces are ens9 (SPACnet), SPACmgmt, control, lighting, video, comms, avoip and danteprimary. More than one Server Identifier in the output means a second server. A server that only answers devices it already knows won’t show up this way.