Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Practice build · Networks and protocols

Build your own VPN

A ZeroTier-like virtual network: TAP devices on several machines, connected through a UDP relay that switches Ethernet frames between them.

  • Advanced
  • About 15–30 h
  • 4 checkpoints
  • 1 tutorial · C, Python

Pick a tutorial, then check yourself at each checkpoint. Work in any language you like.

Choose a tutorial

Why build it

VPNs and overlay networks are tunnels: frames carried inside packets. Building a virtual switch shows how Layer 2 forwarding, MAC learning and encapsulation work, and why encryption has to be added deliberately.

Before you start: Needs two or more Linux machines or VMs where you have root.

You will be able to

  • Move frames between TAP interfaces and a UDP socket.
  • Implement a learning switch that forwards by MAC address.
  • Encapsulate frames in UDP and cross a NAT through a relay.
  • Explain what a tunnel lacks without authentication and encryption, and add both.

Skills it exercises

Recommended on Cybersecurity Engineer and Network Engineer.

Checkpoints

How you know you are there

Work in any language. Each checkpoint ends with something you can run or observe, so you can check it yourself.

  1. Checkpoint 1Self-check

    TAP over UDP

    Done when: Frames written to a TAP device on one host appear on a TAP device on another host.

  2. Checkpoint 2Self-check

    Virtual switch

    Done when: A relay learns MAC addresses and forwards each frame only to the right port; three clients ping each other on a private subnet.

  3. Checkpoint 3Self-check

    Through NAT

    Done when: A client behind a home router joins the network through the relay.

  4. Checkpoint 4Self-check

    Security

    Done when: Traffic between clients is encrypted and authenticated (for example a pre-shared key with an AEAD cipher), and a capture shows no plaintext.

Stretch goals

  • Compare your design with WireGuard's.
  • Direct peer-to-peer paths with UDP hole punching.
Follow a tutorial

Step-by-step guides

Pick one in a language you know (tutorial languages: C, Python). They open on the author’s site.

Practice builds are self-paced: Tech Atlas does not track them or count them as evidence. To show a skill, take its knowledge check from the skill page.

Tutorials come from codecrafters-io/build-your-own-x (CC0, snapshot of 2026-07-14, commit aa17439; links checked on 2026-10-19). Each tutorial belongs to its author and keeps its own licence; Tech Atlas links to it and does not host it. Briefs, checkpoints and the mapping to skills are Tech Atlas editorial drafts.