Peeling Away the Layers of the Network Stack, by Ufuk Kayserilioglu


As Rails developers, we depend on network protocols to ensure the products we build are available and accessible to our users. Despite this, many of us are poorly aware of how the layers of the network stack actually work, or why they are there.

Understanding the things that happen between physical signals on the wire and your Rails application will help you hone your craft and level you up. Fortunately, the basic concepts of network protocols are easy to grasp, with a little guidance. So let's walk together through these concepts, and peel away the layers of the network stack one by one.


Most developers who work with Ruby on Rails build solutions that ultimately work on intricate layers of networking protocols. Despite this, most developers are oblivious to what those network layers are, how they work and what they might mean for their work.

My aim in this talk is to bring my experience of teaching network protocols to high-schoolers to the people who actually are working on those protocols day-in and day-out.

The intended audience for the talk will be Ruby on Rails developers who want to learn more about network protocols to improve their skills. The outcome of the talk will be to give the audience enough information regarding the basics of the OSI model layers and introduce them to some tools they can use to improve those skills.

The basic concepts of networking protocols at different layers are easy to convey through analogies to other human-built networks like the (snail)mail network or the telephone network. I will be explaining the concepts underlying local connectivity (MAC), network (IP), transport (TCP/UDP), and application (HTTP, DNS, etc) as well as showing the audience some tools they can use for troubleshooting or understanding what is going on at various layers (e.g. Nmap, Wireshark, etc).

Rough Outline:

  • Communication
    • What is so difficult about communicating, in general
    • Why do we need protocols
    • How can we implement them for computer networking
    • Why do we need layers?
  • OSI Model - What happens between when I press Enter in the address bar and when I get the webpage back? The goal is to present each layer through analogies with the (snail)mail network.
    • Layer 1: Physical layer
      • Cables
      • Signals
      • Electronics
      • Concepts: Ethernet
    • Layer 2: Data-link
      • We can communicate on a local network
      • But how do we discover other computers?
      • What are the differences between a hub and a switch?
      • Concepts: MAC addresses
    • Layer 3: Network
      • How do we connect different networks?
      • When we do that, how do devices know how to talk to each other?
      • What is packet switching as opposed to circuit switching?
      • Concepts: IP, IP addressing, ARP, Gateway, Subnet Mask
    • Layer 4: Transport
      • Now that we have data flowing from one computer to another, how do we transport data in a structured way?
      • How can we ensure delivery?
      • How can we ensure proper order?
      • How do we make sure we can transmit data as fast as we can?
      • Differences, trade-offs, use-cases of different approaches to these problems.
      • Concepts: Ports, TCP (SYN/ACK/FIN), UDP
    • Layers 5-7: Session/Presentation/Application
      • We can transmit data but how do we convey meaning?
      • Differences between text-based and binary protocols
      • Concepts: HTTP, FTP, DNS
    • Nginx
    • Puma
    • Rack
    • Rails
    • Where is security?
      • Security is a cross cutting concern.
      • Requires buy in from actors in different layers.
      • That’s why HTTP and HTTPS are differently named.
  • Tools
    • arp command
    • ping command
    • traceroute command
    • nmap tool
    • Wireshark for packet capture and dissection
  • Why is all this important?
    • Where to look for problems and bottlenecks?
    • Where to look for fixes?
    • Speed up your application (Why Google did not close HTML tags on their homepage to fit it in a smaller number of TCP packets)


Throughout my career, I have always been interested in learning more about the technologies that undergird the runtime of my software. This has made me learn about the OSI model and the various ways in which the networking protocols at different layers work. Because of this knowledge, I was able to troubleshoot and fix many problems that were unrelated to my software but were caused by a network problem.

Unfortunately, this knowledge is not universal amongst web developers which include Ruby on Rails developers. This holds back many of those developers from levelling-up in their careers and gives them an unnecessarily narrow viewpoint into their work.

A few years ago, I was offered a chance to teach the International Baccalaureate (IB) Diploma Programme Computer Science course to high-school students in a local school part-time. That opportunity made it more obvious how easy it is to motivate the basic concepts behind why the OSI model exists in the first place and why each protocol at each layer is structured the way it is. Basic analogies of “how, in the real world, you would discover who your neighbours are” or “how your (snail) mail makes it to its destination without anyone in between having to know who the recipient is” are strong teaching tools that motivate these concepts well.

I would like to bring this exported experience of teaching high-school students about the fundamentals of the networking concepts to an audience of professional Ruby on Rails developers who don’t necessarily come from a Computer Science background.

Edit proposal


RailsConf 2020 - Accepted [Edit]

Add submission