Networking
Learning outcomes:
- Explain how operating systems support networking, including drivers, the network stack, and sockets
- Describe the basics of networks, including layers, IP addresses, ports, TCP and UDP, DNS, and DHCP
- Use common network tools such as ping, traceroute, ip or ipconfig, and nslookup to inspect a network
- Compare operating system choices for phones and cars, and evaluate their effects on updates, security, privacy, and ownership
Would you like to download my PowerPoint to follow along?
- Why the OS Cares About Networking
- Almost every app uses the network: messages, streaming, games, updates, and cloud storage
- The operating system handles the hard parts, so each app doesn't have to:
- Drivers for Wi-Fi, Ethernet, cellular, and Bluetooth hardware
- The network stack in the kernel, which packages and delivers data
- Sockets, which apps use to send and receive data (Week 2)
- The firewall that decides what is allowed in and out (Week 12)
- Network Basics
- LAN (local area network): devices close together, like your home or a campus building
- WAN (wide area network): networks connected over long distances
- The internet: millions of networks connected together
- Client/server: your device (the client) asks a server for something, like a web page
- Peer-to-peer: devices talk to each other directly, like some games and file sharing (Week 14, Distributed Systems)
- Network Layers
- Networking is split into layers, so each layer has one job, like an assembly line
- The OSI model has 7 layers: Physical, Data Link, Network, Transport, Session, Presentation, and Application
- A memory trick, top to bottom: All People Seem To Need Data Processing
- The TCP/IP model, what the internet actually uses, has 4: Link, Internet, Transport, and Application
- Who does what: hardware and drivers handle the link, the OS kernel handles the internet and transport layers, and apps handle the application layer (IETF: Introduction to the IETF, which sets internet standards)
- IP Addresses
- Every device on a network needs an address, like a mailing address
- IPv4: four numbers, like 192.168.1.20. There are only about 4.3 billion, which is not enough for every device
- Home routers use private addresses inside your home and share one public address, using NAT (network address translation) (IETF RFC 1918: Address allocation for private internets)
- IPv6: much longer addresses, like 2001:db8::1, with enough for every device many times over
- Phones and home internet increasingly use IPv6, though IPv4 is still everywhere (Google: IPv6 statistics)
- See yours: ip a on Linux, ipconfig on Windows (Linux manual page: ip)
- Ports, TCP, and UDP
- The IP address finds the device. A port number finds the right app on it, like an apartment number
- 443 for secure websites (HTTPS), 22 for SSH, and 53 for DNS (IANA: Number resources, including port numbers)
- TCP: checks that everything arrives, in order, resending anything lost. Used for web pages, email, and file downloads
- UDP: sends fast without checking. Used for video calls, online games, and live streams, where late data is useless
- Like certified mail versus shouting across a room
- DNS and DHCP
- DNS (Domain Name System): the internet's phone book. It turns a name like aholdengouveia.name into an IP address
- Look one up with nslookup or dig
- Weakness: if DNS answers are faked, you can be sent to the wrong site. Encrypted DNS helps
- DHCP: when you join a network, your device asks for an address and gets one automatically
- That's why you never have to type in an IP address to use campus Wi-Fi
- Network Hardware
- Network interface: the Wi-Fi or Ethernet hardware in your device, run by a driver
- Switch: connects devices within one network
- Router: connects different networks, such as your home and the internet
- Access point: provides Wi-Fi
- Modem: connects to your internet provider's cable, fiber, or cellular network
- At home, one box often does all of these at once
- How the OS Manages Networking
- Linux desktops and many servers use NetworkManager. The nmcli command controls it from the terminal (NetworkManager: nmcli reference)
- Ubuntu servers often use netplan, and other systems use systemd-networkd
- Windows: Settings, Network and internet. ipconfig shows details (Microsoft: ipconfig)
- The OS remembers networks, picks the best connection, and switches between them
- ss (or netstat) shows which programs are using the network right now (Linux manual page: ss)
- Wi-Fi Today
- Newer Wi-Fi versions (Wi-Fi 6, 6E, and 7) are faster and handle crowded places like campuses better (Wi-Fi Alliance)
- The OS moves your device between access points as you walk around (roaming)
- Private MAC addresses: phones and laptops now use a different hardware address on each network, so you're harder to track (Apple: Use private Wi-Fi addresses)
- Android does this too (Android: MAC randomization behavior)
- Security: use WPA3 where possible (Week 12)
- Cellular, Bluetooth, and Nearby Connections
- Cellular (4G LTE and 5G): a separate modem chip with its own firmware connects to the carrier. eSIMs replace the plastic SIM card
- Bluetooth: short range, for headphones, watches, and keyboards. Bluetooth Low Energy saves battery (Bluetooth SIG: Technology overview)
- NFC: a few centimeters, for tap to pay and transit cards
- Smart home: Matter lets devices from different brands work together (Week 1, IoT) (Connectivity Standards Alliance: Matter)
- Phones: Networking on the Move
- A phone switches between Wi-Fi and cellular without dropping your call or video
- To save battery, the OS limits what apps can do in the background, and groups network activity together (Android Developers: Connectivity)
- Apps must ask permission for things like finding devices on your local network
- Airplane mode turns off the radios, and you can turn Wi-Fi and Bluetooth back on separately
- Phones can share their connection with other devices (a hotspot)
- Phone OS Choices
- iOS: made by Apple, for Apple phones only. One company controls the hardware, the OS, and the main app store
- Android: built on Linux, with open source code. Many companies make Android phones and change it
- How long you get updates depends on the maker. Google promises 7 years for Pixel 8 and later (Google: Pixel software update timeline)
- Other Android-based systems, like GrapheneOS (privacy and security) and LineageOS (keeps older phones updated), need an unlocked bootloader (Week 12) (GrapheneOS)
- Many phones and carriers do not allow unlocking (LineageOS)
- In the EU, the Digital Markets Act made Apple allow other app stores on iPhones (Apple: Alternative app marketplaces in the EU)
- Cars Are Networked Computers
- A modern car has dozens of small computers (Week 1), talking over internal networks such as the CAN bus
- The infotainment screen runs a full operating system, and many cars have their own cellular connection
- Over-the-air updates can fix bugs or add features without a trip to the dealer
- Cars send data back to the manufacturer: location, speed, braking, and more
- The more a car is connected, the more ways there are in: a car on the internet can be attacked from anywhere, and there is more data to protect
- Car OS Choices
- Android Automotive: Android running the car itself, often with Google Maps and Assistant built in
- Automotive Grade Linux: an open source Linux project used by carmakers such as Toyota (Automotive Grade Linux: About)
- QNX: a real-time OS from BlackBerry, used for safety-critical parts and dashboards in hundreds of millions of cars (QNX)
- Apple CarPlay and Android Auto are not car operating systems. They show your phone's apps on the car's screen
- In 2023, GM announced it would drop CarPlay and Android Auto from its future electric cars, in favor of built-in Google software (CNN: GM plans to phase out Apple CarPlay in EVs)
- Critics noted this also gives the carmaker more of your driving data
- Car Security and Privacy
- In 2015, researchers took control of a Jeep Cherokee over the internet through its entertainment system, and could even affect the brakes and engine (Christian Science Monitor: Fiat Chrysler recalls 1.4 million vehicles over hacking concerns)
- Fiat Chrysler recalled about 1.4 million vehicles to fix it
- In 2025, the FTC acted against GM for selling drivers' location and driving behavior data, which insurers used to set rates, without clear consent (FTC: Action against General Motors for sharing drivers' data)
- The same questions as Week 12: who controls the software, who gets the data, and can you say no?
- Connected Devices Can Be Hacked
- Connecting an operating system to a network means it can be attacked from anywhere, not just by someone holding it
- Cars: the 2015 Jeep hack worked over the cellular connection, without ever touching the car
- IoT botnets: in 2016, the Mirai malware took over routers, cameras, and video recorders using default passwords, then used them to knock websites offline (CISA: Heightened DDoS threat posed by Mirai and other botnets)
- Smart cameras: hackers took over Ring accounts of about 55,000 US customers, watched their cameras, and used the speakers to harass people (FTC: Ring employees illegally surveilled customers and failed to stop hackers)
- Protect yourself: change default passwords, turn on MFA, install updates, put smart devices on a guest network, and buy devices that promise years of updates
- Network Tools to Try
- ping: is that device reachable, and how fast does it answer?
- traceroute (Linux) or tracert (Windows): which routers does your data pass through?
- ip a (Linux) or ipconfig (Windows): what are my addresses?
- nslookup or dig: what IP address does a name point to?
- ss -tuln (Linux) or netstat (Windows): which programs are listening for connections?
- nmcli (Linux): what networks am I connected to?
- Networking in Virtual Machines
- A virtual machine gets a virtual network card (Week 14)
- NAT: the VM shares the host computer's connection. Simple, and the default in most tools (VirtualBox manual: Virtual networking)
- Bridged: the VM appears on the network as its own device, with its own address
- Host-only or internal: the VM can only talk to the host or other VMs, which is useful for safe testing
Suggested Activities and Discussion Topics:
- Activity: find your own network details. On Windows, run ipconfig. On Linux or a virtual machine, run ip a. What is your IPv4 address? Is it a private address? Do you also have an IPv6 address?
- Activity: run ping and then traceroute (Linux) or tracert (Windows) to a website you use. How many routers does your data pass through? How long does it take?
- Activity: use nslookup to look up three websites you use every day. Do any of them have more than one IP address? Why might a big website do that?
- Activity: check a smart device you or your family own, such as a router, camera, or smart speaker. Is it still using a default password? Does it have updates available, and is it on the same network as your laptop? What would you change?
- Activity: on your phone, find the Wi-Fi settings for a network you've joined, and check whether it uses a private (random) Wi-Fi address. Why would your phone use a different address on each network?
- Discussion: if you were buying a phone today, would you choose iOS or Android? How much do update length, app store rules, and the ability to install a different OS matter to you?
- Discussion: carmakers can update your car over the internet, and many collect your location and driving data. GM was caught selling that data to companies that set insurance rates. What would you want to know before buying a connected car? Should you be able to turn the data collection off?
- Discussion: GM is replacing CarPlay and Android Auto with its own Google-based system. Who benefits from that choice: drivers, GM, or Google?
Would you like to see some more classes? Click here