Skip to content

Try “polymorphism”, “TCP handshake” or “git rebase”.

    Computer Basics / Networking 1: Addresses and Routing

    Quick Reference

    Glossary and cheat sheet for Networking 1: Addresses and Routing — the page to reread before an interview.

    Extra: Reference6 min read

    Glossary#

    TermPlain meaningChapter
    packet / header / payloadone labelled chunk of data / its label / its contents1
    packet switchingsending packets independently over shared links1
    best-effort deliveryno guarantee packets arrive, arrive once, or arrive in order1
    MTUlargest packet a link carries (1,500 bytes on Ethernet)1
    layers / encapsulationeach layer wraps data in its own header2
    OSI model / TCP/IP model7-layer vocabulary / 4-layer model the internet runs2
    LANdevices that reach each other directly, without a router3
    MAC address48-bit hardware address for the local network3
    Ethernet / Wi-Fiwired / wireless LAN standards3
    framea packet at the link layer3
    switchconnects devices in a LAN; forwards frames by MAC address3
    broadcastmessage to everyone on the LAN3, 6
    IP address / IPv4internet-wide address / the 32-bit version4
    public / private IPunique worldwide / unique only inside one network4, 6
    network part / host partwhich network / which device in it5
    subneta range of addresses sharing a network part5
    CIDR (/24)how many leading bits are the network part5
    subnet maskthe same split written as 255.255.255.05
    network / broadcast addressfirst (all host bits 0) / last (all 1) address in a subnet5
    RFC 1918the standard that defined the private ranges6
    loopback / localhost127.0.0.1 — this same machine6
    link-local169.254.x.x, self-assigned when DHCP fails6
    routerforwards packets between networks7
    routing table"for this range, send to that next hop" rules7
    hopone router-to-router step7
    default route / default gateway0.0.0.0/0 / the router used for non-local traffic7
    longest prefix matchuse the most specific matching route7
    TTLhop counter that stops endless loops7
    traceroutetool that reveals each hop using TTL7
    ARP / ARP cachefind a neighbour's MAC from its IP / remembered answers8
    DHCP / leaseautomatic address assignment / how long it's valid9
    IPv6128-bit addresses written in hex groups10
    dual-stackrunning IPv4 and IPv6 together10
    ISPinternet service provider11
    autonomous system / BGPone independently run network / how they share routes11
    VPCyour private network range inside a cloud11
    public / private subnethas / doesn't have a route to the internet gateway11

    Cheat Sheet#

    Subnet maths

    Output
      host bits = 32 − prefix       total = 2^host bits       usable = total − 2   (AWS: total − 5)
      /24 = 256   /25 = 128   /26 = 64   /27 = 32   /28 = 16   /16 = 65,536
      block size in the last byte (prefix 24–32) = 2^(32 − prefix); subnets start at multiples of it
      "same subnet?" → compare only the first <prefix> bits

    Addresses to know

    Output
      private   10.0.0.0/8   172.16.0.0/12   192.168.0.0/16
      loopback  127.0.0.1  (IPv6 ::1)      link-local 169.254.0.0/16  (IPv6 fe80::)
      cloud metadata 169.254.169.254        default route 0.0.0.0/0      broadcast ff:ff:ff:ff:ff:ff

    Commands (macOS · Linux)

    Output
      my IP                ipconfig getifaddr en0       ·  ip addr
      my MAC               ifconfig en0 | grep ether    ·  ip link
      routing table        netstat -rn                  ·  ip route
      default gateway      route -n get default         ·  ip route | grep default
      ARP cache            arp -a                       ·  ip neigh
      reachable?           ping 8.8.8.8
      path & hops          traceroute google.com

    Debug order for "no internet"

    Output
      1. real IP?  (169.254 = DHCP failed)   2. ping gateway   3. ping 8.8.8.8   4. DNS (nslookup)   5. traceroute

    Try This Yourself#

    1. Map your own network. Run ipconfig getifaddr en0, netstat -rn | grep default and arp -a. Write down: your IP, your subnet (check ifconfig en0 for the netmask — it's shown in hex, e.g. 0xffffff00 = 255.255.255.0 = /24), your gateway, and your gateway's MAC address.

    2. Trace a path. Run traceroute google.com and traceroute 8.8.8.8. Count the hops. Which hop is your home router? Where does the time jump the most?

    3. Subnet drill (on paper). For each, give network address, broadcast address and usable count: 10.10.10.200/27, 172.20.4.9/22, 192.168.0.130/30. (Answers: 10.10.10.192, .223, 30 · 172.20.4.0, 172.20.7.255, 1,022 · 192.168.0.128, .131, 2.)