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.
| Layer | Job | At home | In a data center | At an ISP |
|---|---|---|---|---|
| access | where devices plug in or connect by radio | the router's ports and Wi-Fi | top-of-rack switches | fiber, 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 switches | long-haul routers between cities |
| edge | the connection to other networks | the ISP link | border leaves, firewalls, WAN | peering and transit routers |
| Scale | Devices | Typical design | Run by |
|---|---|---|---|
| home | 5–50 | one router with Wi-Fi, maybe a switch and extra access points | the household |
| small office | 10–200 | firewall, PoE switch, access points, VLANs | an IT person or contractor |
| campus | thousands | three tiers: access, distribution, core | an IT department |
| data center | thousands to hundreds of thousands of servers | spine-leaf fabric | a data center or cloud operator |
| ISP | up to millions of customers | access, aggregation, core, peering edge | a network operations center |
| cloud | anything | software-defined networks, subnets and route tables | you, through an API |
Home
- 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
/56or/60) and the router hands out/64s.
Small office
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.
| Part | Job | Notes |
|---|---|---|
| ISP handoff | business fiber or cable, often with static IPs | a second ISP or a 5G router as backup if downtime is expensive |
| firewall and router | NAT, routing between VLANs, policy, VPN for remote staff | one box for most small offices |
| PoE switch | ports, VLANs, and power over the data cable | sized for ports and for its total PoE power budget |
| access points | one network name (SSID) per VLAN: staff, guest, IoT | managed together from a controller or cloud dashboard |
| PoE standard | Name | Power per port at the switch | Power at the device | Powers |
|---|---|---|---|---|
| 802.3af | PoE | 15.4 W | 12.95 W | phones, simple cameras |
| 802.3at | PoE+ | 30 W | 25.5 W | most Wi-Fi access points, pan-tilt cameras |
| 802.3bt Type 3 | PoE++, 4-pair | 60 W | 51 W | high-end access points, small displays |
| 802.3bt Type 4 | PoE++, 4-pair | 90 W | 71.3 W | lighting, laptops, displays |
A worked subnet plan: one /24 per VLAN, the VLAN ID as the third octet, the gateway always .1.
| VLAN | Name | Subnet | Gateway | DHCP scope | Lease | Policy |
|---|---|---|---|---|---|---|
| 10 | staff | 10.10.10.0/24 | 10.10.10.1 | .100–.249 (.2–.99 static: printers, servers) | 8 h | internet, printers, servers |
| 20 | voice | 10.10.20.0/24 | 10.10.20.1 | .100–.249 | 24 h | the phone system only; marked for priority (QoS) |
| 30 | guest | 10.10.30.0/24 | 10.10.30.1 | .10–.250 | 2 h | internet only; clients can't see each other |
| 40 | IoT | 10.10.40.0/24 | 10.10.40.1 | .100–.249 | 24 h | cameras and sensors reach their controller only |
| 99 | management | 10.10.99.0/24 | 10.10.99.1 | none: all static | n/a | switches, APs, firewall; reachable from admins only |
10.10.0.0/16leaves room for 256 such VLANs; IPv6 gets a/64per VLAN from the office's prefix, e.g.2001:db8:abcd:10::/64for 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/24and192.168.1.0/24out of office plans: staff on VPN from home networks using the same range will find half the office unreachable.
Campus and enterprise
- 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.
- 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
| Layer | Equipment | What it does |
|---|---|---|
| access | OLTs (fiber), CMTSs (cable), DSLAMs (DSL), cell sites | reach every customer; the most expensive part to build |
| aggregation | metro Ethernet switches and routers, often in rings | merge thousands of access links; reroute around a cut |
| subscriber edge | BNG (broadband network gateway); the mobile packet core | one session per customer: address, speed plan, filters, accounting |
| core | large routers in a few cities, 100–400 Gbit/s links over DWDM fiber | carry everything between regions; IS-IS inside, MPLS or segment routing for traffic engineering, iBGP with route reflectors |
| peering edge | border routers at IXPs and colocation sites | exchange traffic with other networks, buy transit |
| services | DNS resolvers, CGNAT, CDN caches, the NOC | caches 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.
| Concept | AWS | Azure | Google Cloud |
|---|---|---|---|
| private network | VPC, per region | virtual network (VNet), per region | VPC network, global |
| subnet scope | one availability zone | a region, spanning its zones | a region |
| addresses reserved per IPv4 subnet | 5 | 5 | 4 |
| routing | route tables per subnet | route tables (user-defined routes) | VPC routes |
| inbound from the internet | internet gateway | public IPs and load balancers | public IPs and load balancers |
| outbound for private servers | NAT gateway | NAT Gateway; newer virtual networks default to private subnets with no implicit internet access | Cloud NAT |
| stateful firewall | security groups (per interface) | network security groups | VPC firewall rules and policies |
| stateless subnet filter | network ACLs | none | none |
| connect two networks | VPC peering (not transitive) | VNet peering | VPC Network Peering |
| hub for many networks | Transit Gateway, Cloud WAN | Virtual WAN, hub-and-spoke VNets | Network Connectivity Center |
| VPN to your site | Site-to-Site VPN | VPN Gateway | Cloud VPN |
| private circuit to your site | Direct Connect | ExpressRoute | Cloud Interconnect |
| reach a service privately | PrivateLink, VPC endpoints | Private Link, private endpoints | Private Service Connect |
| flow logs | VPC Flow Logs | virtual network flow logs | VPC Flow Logs |
- A subnet is "public" only because its route table sends
0.0.0.0/0to 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
| Principle | In practice |
|---|---|
| hierarchy | layers with distinct jobs (access, aggregation, core, edge); summarize routes and apply policy at the boundaries |
| redundancy | two of anything whose failure would hurt many users: uplinks, switches, routers, power feeds, ISPs, and physically separate cable routes |
| small failure domains | limit 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 failure | the 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 |
| consistency | the same design, templates and naming everywhere, so automation and people can predict it |
| test the failure | pull 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:
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.
| Failure detection | Typical time | Notes |
|---|---|---|
| loss of light or carrier on a direct link | milliseconds | only when the link itself goes dark, not when a box behind it hangs |
| BFD (RFC 5880) | ≈150 ms–1 s | tiny 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 s | advertisements every second, takeover after about three are missed |
| OSPF with default timers | up to 40 s | hello every 10 s, neighbor down after 40 s |
| BGP with default timers | 90–180 s | the hold time; pair BGP with BFD |
IP address planning
| Private IPv4 range (RFC 1918) | Addresses | Common use |
|---|---|---|
10.0.0.0/8 | 16,777,216 | enterprises, data centers, cloud networks |
172.16.0.0/12 | 1,048,576 | often left for containers and VPNs (Docker uses 172.17.0.0/16 by default) |
192.168.0.0/16 | 65,536 | homes and small offices |
| IPv4 prefix | Usable hosts | Typical use |
|---|---|---|
/31 | 2 | a point-to-point link between two routers (RFC 3021) |
/30 | 2 | the same, on older gear |
/29 | 6 | a small block of public addresses from an ISP |
/27 | 30 | a small server segment |
/24 | 254 | one VLAN of users |
/22 | 1,022 | a large Wi-Fi network |
/16 | 65,534 | a 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/12for Europe,10.16.0.0/12for the Americas, a/16per site, a/24per 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/64subnets. Every VLAN gets exactly a/64(SLAAC requires it); encode the VLAN in the fourth group (2001:db8:abcd:10::/64for VLAN 10); use/127on router-to-router links (RFC 6164) and/128for 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.
| Thing | Convention | Example |
|---|---|---|
| device | site-role-number, optionally floor or rack | fra2-leaf-14, hq-acc-3f-02 |
| interface description | what is on the other end | to fra2-spine-01 Eth1/49 |
| cable label | both ends, from–to | R12-U40-P07 / R14-U38-P07 |
| VLAN | ID and purpose, the same everywhere | 20 voice |
| DNS | forward and reverse records for every infrastructure address | fra2-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
| Item | Standard practice |
|---|---|
| racks | 19-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 panels | building cabling ends on panels; short patch cords connect panel ports to switch ports, so the permanent cabling is never touched |
| cable management | horizontal managers between panels and switches, vertical managers at the sides; respect fiber's minimum bend radius; keep power and data apart |
| labeling | every cable at both ends, every port and panel; TIA-606 defines a scheme |
| power | two 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 |
| cooling | cold 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 |
| airflow | switches come in front-to-back and back-to-front versions; buy the one that matches how they face in the rack |
| Cable | Reach | Typical use |
|---|---|---|
| Cat5e | 1 Gbit/s to 100 m; 2.5 Gbit/s on most runs | existing desk cabling |
| Cat6 | 1 Gbit/s to 100 m; 10 Gbit/s to about 55 m | new desk and access point runs |
| Cat6A | 10 Gbit/s to 100 m | Wi-Fi 6E and 7 access points, new builds |
| DAC (direct-attach copper) | a few meters | server to top-of-rack switch, inside one rack |
| multimode fiber (OM3, OM4) | 10 Gbit/s ≈300–400 m; 100 Gbit/s ≈70–100 m | within a building or data hall |
| single-mode fiber (OS2) | kilometers (10GBASE-LR: 10 km) to thousands with amplifiers | between 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.
| Zone | Contains | Typically allowed |
|---|---|---|
| internet | everyone | in: only to the DMZ's published services |
| DMZ | public-facing servers, reverse proxies, VPN gateways | out: to specific internal services |
| users | staff PCs and phones | out: internet, internal apps |
| guest | visitors' devices | out: internet only |
| IoT / OT | cameras, sensors, building and industrial systems | to their controllers only |
| servers | applications and databases | from users and the DMZ on specific ports |
| management | switch, router, firewall and server management interfaces | from 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
| Source | What it gives you | Notes |
|---|---|---|
| SNMP | counters and status, polled every 1–5 minutes: interface traffic, errors, up/down | v2c sends its "community" password in clear text; prefer SNMPv3 with authentication and encryption |
| streaming telemetry | the same data and more, pushed every few seconds | gNMI with OpenConfig models; finer detail than polling |
| flow records | who talked to whom, how much, on which ports | NetFlow v9, IPFIX (RFC 7011), sFlow (sampled); in clouds, VPC or VNet flow logs |
| syslog | events: links flapping, neighbors lost, logins, config changes | send to a central server and search it |
| LLDP | which device and port is on the other end of each cable | checks cabling against the documentation |
| synthetic tests | latency, loss and reachability measured continuously | pings and HTTP checks between sites; iperf3 for throughput |
| packet capture | the packets themselves | mirror (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/24Bond 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 linksGenerate 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])
EOFCheck 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 hostsReferences
- RFC 1918: Address Allocation for Private Internets (opens in a new tab): the private IPv4 ranges
- RIPE-690: IPv6 prefix assignment for end users (opens in a new tab):
/48,/56and/64in practice - RFC 7938: Use of BGP for Routing in Large-Scale Data Centers (opens in a new tab): eBGP spine-leaf fabrics
- RFC 7348: VXLAN (opens in a new tab): the overlay encapsulation
- RFC 8365: EVPN as a Network Virtualization Overlay (opens in a new tab): the control plane for VXLAN fabrics
- Meta Engineering: Introducing data center fabric (opens in a new tab): a large spine-leaf design explained
- RFC 5798: VRRP version 3 (opens in a new tab): first-hop redundancy
- RFC 5880: Bidirectional Forwarding Detection (opens in a new tab): fast failure detection
- RFC 6164: Using 127-bit IPv6 prefixes on inter-router links (opens in a new tab): point-to-point addressing
- RFC 7011: IPFIX (opens in a new tab): flow export
- Amazon VPC User Guide (opens in a new tab): VPCs, subnets, gateways
- Azure Virtual Network overview (opens in a new tab): VNets and their features
- Google Cloud VPC overview (opens in a new tab): global VPC networks and regional subnets
- NetBox documentation (opens in a new tab): a source of truth for DCIM and IPAM
- ip-link(8) (opens in a new tab): VLAN and bond interfaces on Linux
- Linux bonding driver (opens in a new tab): bonding modes, including 802.3ad