../

Building a network

How networks are designed and physically put together, from a house to a data center, an ISP and a cloud account: the parts at each scale, address and VLAN plans, redundancy, racks and cabling, security zones and monitoring. The technologies inside are explained in Wired networks, Wi-Fi and Autonomous systems & BGP; server-side commands are in Sysadmin.

The same parts at every scale

Every network, however big, is built from the same four layers. Learn to spot them and any diagram becomes readable.

LayerJobAt homeIn a data centerAt an ISP
accesswhere devices plug in or connect by radiothe router's ports and Wi-Fitop-of-rack switchesfiber, cable and cell sites to each customer
aggregation (distribution)collects many access links, applies policy(none)(merged into the fabric)metro switches and routers, subscriber gateways
core (backbone)moves traffic fast between aggregation points(none)spine switcheslong-haul routers between cities
edgethe connection to other networksthe ISP linkborder leaves, firewalls, WANpeering and transit routers
ScaleDevicesTypical designRun by
home5–50one router with Wi-Fi, maybe a switch and extra access pointsthe household
small office10–200firewall, PoE switch, access points, VLANsan IT person or contractor
campusthousandsthree tiers: access, distribution, corean IT department
data centerthousands to hundreds of thousands of serversspine-leaf fabrica data center or cloud operator
ISPup to millions of customersaccess, aggregation, core, peering edgea network operations center
cloudanythingsoftware-defined networks, subnets and route tablesyou, through an API

Home

street home fiber ONT or modem WAN router + AP NAT · DHCP firewall · DNS phones, laptops downstairs LAN switch PoE ports desktop TV, console AP upstairs upstairs devices Cat6 runs
ISP box, router, switch, and a second access point on a cable
  • The ONT (fiber), cable modem or DSL modem turns the ISP's medium into Ethernet. ISPs often combine it with the router in one box.
  • The router does NAT, DHCP, DNS forwarding, the firewall and usually Wi-Fi (see A packet's journey). If you use your own router behind the ISP's, put the ISP box in bridge mode to avoid two layers of NAT.
  • One access point rarely covers a multi-story house: walls, floors and distance eat the signal. Add access points with wired backhaul (an Ethernet run to each one), or use MoCA (Ethernet over the TV coax) or powerline adapters where you can't run cable.
  • Mesh systems link access points over the air instead. Easy to install, but every wireless hop shares airtime with clients and adds latency; a mesh with a dedicated backhaul radio, or better a cable, does much better. Placement and channels are in Wi-Fi.
  • For new cable runs use Cat6 (10 Gbit/s up to about 55 m) or Cat6A (10 Gbit/s to 100 m); Cat5e still carries 1 Gbit/s, and 2.5 Gbit/s on most runs, to 100 m.
  • Put smart-home gadgets on a separate guest or IoT network if the router offers one, and turn on IPv6: the ISP delegates a prefix (often a /56 or /60) and the router hands out /64s.

Small office

ISP handoff WAN firewall + router routes and filters between VLANs trunk PoE switch 802.1Q VLANs SSIDs: staff · guest · IoT AP 1 AP 2 trunks PCs VLAN 10 phones VLAN 20 printer VLAN 10 cameras VLAN 40 VLANs 10 staff 20 voice 30 guest 40 IoT 99 management thick line: a trunk carries several VLANs, tagged
One switch, several VLANs, and a firewall between them

A VLAN (virtual LAN) splits one physical switch into several separate networks. An access port belongs to one VLAN and its device never knows; a trunk carries many VLANs at once, each frame marked with a 4-byte 802.1Q tag holding its VLAN ID (1–4094). The firewall has one interface per VLAN on its trunk and decides which VLAN may talk to which. VLANs themselves are explained in Wired networks.

PartJobNotes
ISP handoffbusiness fiber or cable, often with static IPsa second ISP or a 5G router as backup if downtime is expensive
firewall and routerNAT, routing between VLANs, policy, VPN for remote staffone box for most small offices
PoE switchports, VLANs, and power over the data cablesized for ports and for its total PoE power budget
access pointsone network name (SSID) per VLAN: staff, guest, IoTmanaged together from a controller or cloud dashboard
PoE standardNamePower per port at the switchPower at the devicePowers
802.3afPoE15.4 W12.95 Wphones, simple cameras
802.3atPoE+30 W25.5 Wmost Wi-Fi access points, pan-tilt cameras
802.3bt Type 3PoE++, 4-pair60 W51 Whigh-end access points, small displays
802.3bt Type 4PoE++, 4-pair90 W71.3 Wlighting, laptops, displays

A worked subnet plan: one /24 per VLAN, the VLAN ID as the third octet, the gateway always .1.

VLANNameSubnetGatewayDHCP scopeLeasePolicy
10staff10.10.10.0/2410.10.10.1.100–.249 (.2–.99 static: printers, servers)8 hinternet, printers, servers
20voice10.10.20.0/2410.10.20.1.100–.24924 hthe phone system only; marked for priority (QoS)
30guest10.10.30.0/2410.10.30.1.10–.2502 hinternet only; clients can't see each other
40IoT10.10.40.0/2410.10.40.1.100–.24924 hcameras and sensors reach their controller only
99management10.10.99.0/2410.10.99.1none: all staticn/aswitches, APs, firewall; reachable from admins only
  • 10.10.0.0/16 leaves room for 256 such VLANs; IPv6 gets a /64 per VLAN from the office's prefix, e.g. 2001:db8:abcd:10::/64 for VLAN 10.
  • Phones learn their voice VLAN from the switch via LLDP-MED, so one cable can serve a phone and the PC plugged into it.
  • Keep 192.168.0.0/24 and 192.168.1.0/24 out of office plans: staff on VPN from home networks using the same range will find half the office unreachable.

Campus and enterprise

building A building B internet edge core 1 core 2 dist A1 dist A2 access access access dist B1 dist B2 access access access distribution access 802.1X on ports core blue: fiber backbone · every switch has two uplinks
Access, distribution and core, with two uplinks from every switch
  • Access switches sit in wiring closets (an IDF, intermediate distribution frame, on each floor). Copper to desks is limited to 100 m per channel: 90 m of fixed cable plus 10 m of patch cords.
  • Distribution switches collect a building's closets (in the MDF, main distribution frame) and are where VLANs are routed and policy applied.
  • The core joins buildings and the data center over a fiber backbone (single-mode between buildings, where distances run to kilometers) and does nothing but forward fast. Smaller sites merge distribution and core into a collapsed core.
  • Redundancy: every switch has two uplinks to two different switches. Links are bundled with LACP (IEEE 802.1AX) and the switch pairs act as one (MLAG, multi-chassis link aggregation), so both uplinks carry traffic. Spanning Tree (RSTP or MSTP) stays on as a safety net against loops; designs that route all the way to the access switch avoid it entirely.
  • First-hop redundancy (VRRP, or Cisco's HSRP) gives hosts one gateway address shared by two routers; see Design principles.
  • 802.1X authenticates every port and Wi-Fi connection before it passes traffic: the device (the supplicant) proves who it is to the switch or access point (the authenticator), which asks a RADIUS server. EAP-TLS with device certificates is the strong option; the server can also drop the device into the right VLAN. Printers and other devices that can't do 802.1X fall back to MAC authentication (MAB), which is easy to spoof, so give them a restricted VLAN.
  • Branch offices connect back over the internet with VPNs or SD-WAN, or over private circuits from a carrier.

Data center

A data center network carries mostly east-west traffic (server to server: a web request fans out to dozens of services and databases) rather than north-south (in from and out to users). The modern answer is a spine-leaf fabric, also called a Clos network after Charles Clos's 1953 telephone switch design.

internet spine 1 spine 2 spine 3 spine 4 leaf 1 leaf 2 leaf 3 leaf 4 leaf 5 border each flow is hashed onto one spine (ECMP), so flows spread over all four blue, green, red: east-west, server to server · purple: north-south

Every leaf connects to every spine; ECMP spreads flows across them
  • Every leaf (a top-of-rack, or ToR, switch) connects to every spine. Leaves never link to each other, and neither do spines. Any server reaches any other in three switch hops: leaf, spine, leaf, with the same latency and bandwidth whichever pair you pick.
  • ECMP (equal-cost multi-path) routing gives each leaf one equal path per spine. Switches hash each packet's addresses, protocol and ports, so a flow sticks to one path (no reordering) while thousands of flows spread over all of them.
  • To grow, add leaves for more server ports and spines for more bandwidth; past that, a 5-stage design adds a "super-spine" layer above several spine-leaf pods.
  • Oversubscription compares server bandwidth with uplink bandwidth. A leaf with 48 × 25 Gbit/s server ports (1.2 Tbit/s) and 8 × 100 Gbit/s uplinks (800 Gbit/s) is 1.5:1. AI training clusters usually get separate back-end fabrics at 1:1, because their traffic is all east-west at full speed.
  • Fabrics usually run routing, not Spanning Tree, everywhere: often eBGP with a private ASN per leaf (RFC 7938), or OSPF or IS-IS. Servers are typically dual-homed to two leaves.
  • Tenants and applications that need their own layer-2 or layer-3 networks get them as an overlay: VXLAN wraps their frames in UDP (24-bit segment IDs, so about 16 million segments) and EVPN, a BGP extension, tells the leaves where every address lives (RFC 7348, RFC 8365).
  • North-south traffic enters through border leaves connected to firewalls, load balancers and the WAN or internet edge; load balancing is in System design.

ISP and carrier

customers access aggregation subscriber backbone edge homes businesses phones OLT (fiber) Ethernet cell site agg 1 agg 2 BNG 5G core core routers in several cities IS-IS, MPLS or segment routing IXP PNI transit to other networks ISP data center DNS resolvers · CGNAT · CDN caches POPs hold access and aggregation
Access, aggregation, subscriber edge, backbone, peering edge
LayerEquipmentWhat it does
accessOLTs (fiber), CMTSs (cable), DSLAMs (DSL), cell sitesreach every customer; the most expensive part to build
aggregationmetro Ethernet switches and routers, often in ringsmerge thousands of access links; reroute around a cut
subscriber edgeBNG (broadband network gateway); the mobile packet coreone session per customer: address, speed plan, filters, accounting
corelarge routers in a few cities, 100–400 Gbit/s links over DWDM fibercarry everything between regions; IS-IS inside, MPLS or segment routing for traffic engineering, iBGP with route reflectors
peering edgeborder routers at IXPs and colocation sitesexchange traffic with other networks, buy transit
servicesDNS resolvers, CGNAT, CDN caches, the NOCcaches from the big content companies sit inside the ISP to keep traffic local
  • A POP (point of presence) is a building where the ISP has equipment: a local exchange or central office holding access and aggregation gear, or a carrier hotel where it meets other networks.
  • Core links are protected twice: by physically separate fiber routes (two fibers in the same trench fail together) and by fast reroute in MPLS or segment routing, which switches to a precomputed backup path in tens of milliseconds.
  • How the ISP connects to the rest of the internet (peering, transit, BGP policy) is in Autonomous systems & BGP.

Cloud networks

In a cloud you build the same things through an API: no cables, but the same ideas of address space, subnets, routes, gateways and firewalls.

internet internet gateway VPC 10.0.0.0/16 · one region zone a public 10.0.1.0/24 private 10.0.11.0/24 zone b public 10.0.2.0/24 private 10.0.12.0/24 NAT gateway NAT gateway app app app app load balancer public route table: 10.0.0.0/16 → local · 0.0.0.0/0 → internet gateway private route table: 10.0.0.0/16 → local · 0.0.0.0/0 → NAT gateway
Public subnets route to the internet gateway; private ones go out through NAT
ConceptAWSAzureGoogle Cloud
private networkVPC, per regionvirtual network (VNet), per regionVPC network, global
subnet scopeone availability zonea region, spanning its zonesa region
addresses reserved per IPv4 subnet554
routingroute tables per subnetroute tables (user-defined routes)VPC routes
inbound from the internetinternet gatewaypublic IPs and load balancerspublic IPs and load balancers
outbound for private serversNAT gatewayNAT Gateway; newer virtual networks default to private subnets with no implicit internet accessCloud NAT
stateful firewallsecurity groups (per interface)network security groupsVPC firewall rules and policies
stateless subnet filternetwork ACLsnonenone
connect two networksVPC peering (not transitive)VNet peeringVPC Network Peering
hub for many networksTransit Gateway, Cloud WANVirtual WAN, hub-and-spoke VNetsNetwork Connectivity Center
VPN to your siteSite-to-Site VPNVPN GatewayCloud VPN
private circuit to your siteDirect ConnectExpressRouteCloud Interconnect
reach a service privatelyPrivateLink, VPC endpointsPrivate Link, private endpointsPrivate Service Connect
flow logsVPC Flow Logsvirtual network flow logsVPC Flow Logs
  • A subnet is "public" only because its route table sends 0.0.0.0/0 to an internet gateway. Put load balancers and NAT in public subnets and everything else in private ones.
  • Spread every tier across at least two zones, and give each zone its own NAT gateway, so losing a zone (a separate building with its own power) leaves the application running.
  • Pick address space that doesn't overlap your offices, data centers or other cloud networks: you can't peer or route between overlapping ranges, and changing a VPC's range later means rebuilding.
  • Peering is usually not transitive: if A peers with B and B with C, A can't reach C through B. Many networks need a hub.

Design principles

PrincipleIn practice
hierarchylayers with distinct jobs (access, aggregation, core, edge); summarize routes and apply policy at the boundaries
redundancytwo of anything whose failure would hurt many users: uplinks, switches, routers, power feeds, ISPs, and physically separate cable routes
small failure domainslimit what one fault can take down: keep layer-2 domains (VLANs that span switches) small, route between them, split big networks into zones or pods
capacity for failurethe backup path must carry the load of the primary; many operators upgrade a link once its busy-hour peak regularly passes half to two-thirds of capacity
consistencythe same design, templates and naming everywhere, so automation and people can predict it
test the failurepull the cable, power off the switch, during a maintenance window, before it happens by itself

When a link breaks, a routed network heals itself. How fast depends mostly on how quickly the failure is detected:

users servers cut packets to R2 are dropped SPF SPF SPF SPF must carry the load R1 R2 R3 R4 10 10 15 15 10 shortest path R1 → R2 → R4, cost 10 + 10 = 20 the R2–R4 link is cut; R1 still sends to R2 R2 and R4 detect it: loss of light or BFD in ms they flood the change; every router reruns SPF new shortest path R1 → R3 → R4, cost 15 + 15 = 30 the backup path must have room for all the traffic

1/6

Normal operation: the link-state IGP picks the cheapest path from R1 to R4, R1 → R2 → R4, cost 10 + 10 = 20.

For hosts on a LAN, the weak point is the default gateway: a host has one gateway address and no routing protocol. First-hop redundancy protocols such as VRRP (RFC 5798) let two routers share a virtual gateway address; the backup takes it over when the active router stops sending heartbeats.

hosts gateway 10.0.0.1 switch router A 10.0.0.2 router B 10.0.0.3 upstream fails virtual 10.0.0.1 virtual 10.0.0.1

VRRP moves the gateway address to the standby router; hosts never notice
Failure detectionTypical timeNotes
loss of light or carrier on a direct linkmillisecondsonly when the link itself goes dark, not when a box behind it hangs
BFD (RFC 5880)≈150 ms–1 stiny hellos, e.g. every 50 ms, down after 3 missed (150 ms); runs alongside OSPF, IS-IS, BGP, static routes
VRRP with default timers≈3–4 sadvertisements every second, takeover after about three are missed
OSPF with default timersup to 40 shello every 10 s, neighbor down after 40 s
BGP with default timers90–180 sthe hold time; pair BGP with BFD

IP address planning

Private IPv4 range (RFC 1918)AddressesCommon use
10.0.0.0/816,777,216enterprises, data centers, cloud networks
172.16.0.0/121,048,576often left for containers and VPNs (Docker uses 172.17.0.0/16 by default)
192.168.0.0/1665,536homes and small offices
IPv4 prefixUsable hostsTypical use
/312a point-to-point link between two routers (RFC 3021)
/302the same, on older gear
/296a small block of public addresses from an ISP
/2730a small server segment
/24254one VLAN of users
/221,022a large Wi-Fi network
/1665,534a site or a cloud network
  • Plan in a hierarchy: region → site → function → VLAN, so each level summarizes into one route: for example 10.0.0.0/12 for Europe, 10.16.0.0/12 for the Americas, a /16 per site, a /24 per VLAN.
  • Leave room: reserve the next block of each size for growth; renumbering a live network is painful.
  • Avoid overlaps with partners, acquisitions, cloud networks, home networks of VPN users, and 100.64.0.0/10 (carrier-grade NAT).
  • IPv6: a site typically gets a /48, which holds 65,536 /64 subnets. Every VLAN gets exactly a /64 (SLAAC requires it); encode the VLAN in the fourth group (2001:db8:abcd:10::/64 for VLAN 10); use /127 on router-to-router links (RFC 6164) and /128 for loopbacks. Homes get a /56 (256 subnets), a /60 (16) or sometimes a single /64. RIPE-690 has the operational advice.
  • Record every allocation in an IPAM (IP address management) tool, not a spreadsheet nobody updates.

Naming and documentation

A network nobody can describe can't be fixed at 3 a.m. Decide conventions before the first device arrives.

ThingConventionExample
devicesite-role-number, optionally floor or rackfra2-leaf-14, hq-acc-3f-02
interface descriptionwhat is on the other endto fra2-spine-01 Eth1/49
cable labelboth ends, from–toR12-U40-P07 / R14-U38-P07
VLANID and purpose, the same everywhere20 voice
DNSforward and reverse records for every infrastructure addressfra2-leaf-14.mgmt.example.net
  • Keep one source of truth: a DCIM and IPAM tool such as NetBox or Nautobot that holds sites, racks, devices, cables, addresses, VLANs and circuits. Generate configurations from it instead of typing them.
  • Back up every device configuration automatically into Git (Oxidized and RANCID do this), so each change has a diff and a date.
  • Draw two kinds of diagram: physical (racks, devices, cables, ports) and logical (subnets, VLANs, routing, firewall zones). One diagram trying to show both shows neither.
  • Write a runbook for the failures you expect: ISP down, core switch dead, power out.

Physical build

ItemStandard practice
racks19-inch wide; height in rack units, 1U = 1.75 in (44.45 mm); 42U is common, 45U and 48U too; deep enough for servers
patch panelsbuilding cabling ends on panels; short patch cords connect panel ports to switch ports, so the permanent cabling is never touched
cable managementhorizontal managers between panels and switches, vertical managers at the sides; respect fiber's minimum bend radius; keep power and data apart
labelingevery cable at both ends, every port and panel; TIA-606 defines a scheme
powertwo power supplies per device, fed from separate PDUs on separate circuits (A and B feeds); a UPS for minutes of battery, a generator for hours
coolingcold aisle and hot aisle: every device takes air from the front and exhausts at the back; blanking panels in empty slots; ASHRAE recommends 18–27 °C at the intake
airflowswitches come in front-to-back and back-to-front versions; buy the one that matches how they face in the rack
CableReachTypical use
Cat5e1 Gbit/s to 100 m; 2.5 Gbit/s on most runsexisting desk cabling
Cat61 Gbit/s to 100 m; 10 Gbit/s to about 55 mnew desk and access point runs
Cat6A10 Gbit/s to 100 mWi-Fi 6E and 7 access points, new builds
DAC (direct-attach copper)a few metersserver to top-of-rack switch, inside one rack
multimode fiber (OM3, OM4)10 Gbit/s ≈300–400 m; 100 Gbit/s ≈70–100 mwithin a building or data hall
single-mode fiber (OS2)kilometers (10GBASE-LR: 10 km) to thousands with amplifiersbetween buildings, campuses, cities

How copper and fiber carry signals is in Wired networks.

Security zones and segmentation

Group systems into zones by how much you trust them, and make the firewall between zones deny everything except the flows you list.

ZoneContainsTypically allowed
interneteveryonein: only to the DMZ's published services
DMZpublic-facing servers, reverse proxies, VPN gatewaysout: to specific internal services
usersstaff PCs and phonesout: internet, internal apps
guestvisitors' devicesout: internet only
IoT / OTcameras, sensors, building and industrial systemsto their controllers only
serversapplications and databasesfrom users and the DMZ on specific ports
managementswitch, router, firewall and server management interfacesfrom administrators only; ideally a separate out-of-band network
  • Default deny between zones, explicit allow rules, and logs for the denies.
  • Segment inside zones too (microsegmentation): host firewalls and cloud security groups limit what each server can reach, so one compromised machine doesn't open the whole zone. Zero trust designs go further and grant access per user and device, wherever they connect from.
  • Harden the access layer: 802.1X, DHCP snooping and dynamic ARP inspection (stop rogue DHCP servers and ARP spoofing), BPDU guard on user ports (stop loops), unused ports shut down.
  • Keep firmware current and management protocols encrypted (SSH, HTTPS, SNMPv3).
  • Host firewall commands (nftables, ufw) are in Sysadmin.

Monitoring

SourceWhat it gives youNotes
SNMPcounters and status, polled every 1–5 minutes: interface traffic, errors, up/downv2c sends its "community" password in clear text; prefer SNMPv3 with authentication and encryption
streaming telemetrythe same data and more, pushed every few secondsgNMI with OpenConfig models; finer detail than polling
flow recordswho talked to whom, how much, on which portsNetFlow v9, IPFIX (RFC 7011), sFlow (sampled); in clouds, VPC or VNet flow logs
syslogevents: links flapping, neighbors lost, logins, config changessend to a central server and search it
LLDPwhich device and port is on the other end of each cablechecks cabling against the documentation
synthetic testslatency, loss and reachability measured continuouslypings and HTTP checks between sites; iperf3 for throughput
packet capturethe packets themselvesmirror (SPAN) ports or network taps; see A packet's journey

Alert on what users feel and what predicts it: links or neighbors down, error counters rising (a bad cable or optic), sustained utilization above your upgrade threshold, packet loss between sites, failing power supplies or fans, optics with falling light levels, and certificates or licenses about to expire. Prometheus with snmp_exporter, LibreNMS and Zabbix are common open-source starting points; dashboards are in Grafana.

Build checklist

  • Requirements: users and devices now and in three years, applications, uptime target, budget
  • Address plan: IPv4 and IPv6 blocks per site and VLAN, recorded in IPAM
  • VLAN and zone plan, with the firewall policy between zones written down
  • Naming conventions for devices, interfaces, cables and DNS
  • Physical: rack layout, power (A and B feeds, UPS runtime), cooling and airflow, cable routes
  • Cabling installed, tested and labeled at both ends; patch panels documented
  • Device configurations generated from templates; default passwords changed; firmware updated
  • Management network isolated; SSH and SNMPv3 only; logins via central authentication
  • Redundancy tested by pulling links and powering off devices, one at a time
  • Monitoring, logging and alerts live before users arrive
  • Configuration backups automated
  • Diagrams, runbooks and the source of truth match what was built

Recipes

Put a Linux host on a VLAN

When a server or router needs an interface in a tagged VLAN on a trunk port.

sudo ip link add link eth0 name eth0.20 type vlan id 20
sudo ip addr add 10.10.20.2/24 dev eth0.20
sudo ip link set eth0.20 up
ip -d link show eth0.20   # "vlan protocol 802.1Q id 20"

These commands don't survive a reboot. With NetworkManager:

sudo nmcli con add type vlan con-name vlan20 \
  dev eth0 id 20 ipv4.method manual \
  ipv4.addresses 10.10.20.2/24

Bond two NICs with LACP

When a server has two links to a switch pair configured as one LACP bundle (MLAG).

sudo ip link add bond0 type bond mode 802.3ad
sudo ip link set eth1 down
sudo ip link set eth1 master bond0
sudo ip link set eth2 down
sudo ip link set eth2 master bond0
sudo ip link set bond0 up
cat /proc/net/bonding/bond0   # partner MAC, active links

Generate a subnet plan

When you want the VLAN-numbered /24 plan above for any site block.

python3 - <<'EOF'
import ipaddress
site = ipaddress.ip_network("10.10.0.0/16")
nets = list(site.subnets(new_prefix=24))
for vlan in (10, 20, 30, 40, 99):
    net = nets[vlan]
    print(vlan, net, "gateway", net[1])
EOF

Check what a port is cabled to

When the documentation and reality may disagree. Needs lldpd on the host and LLDP on the switch.

sudo lldpctl                 # neighbor name, port, VLAN
networkctl lldp              # systemd-networkd hosts

References