(via ChatGPT)
Modern OSes like macOS, Linux, Windows, and iOS have built-in support for networking features that make tools like WireGuard and Tailscale work smoothly:
Feature | Description | Used By |
---|---|---|
TUN/TAP Interfaces | Virtual network interfaces used to send/receive encrypted packets | WireGuard & Tailscale |
Kernel Networking Stack | Handles IP routing, NAT traversal, and packet filtering | WireGuard (kernel module), Tailscale (user-space) |
UDP Sockets | Used to send encrypted WireGuard packets | Both |
Multicast DNS (mDNS) & UPnP/NAT-PMP | Helps local device discovery and NAT traversal | Tailscale |
System Keychain/Secrets | Used to securely store private keys and credentials | Tailscale clients on macOS/iOS |
LaunchAgents / Daemons | Background service support on macOS | Tailscale client |
Feature | WireGuard | Tailscale |
---|---|---|
Peer-to-peer VPN | β | β |
Encryption | β (ChaCha20, Curve25519) | β (via WireGuard) |
Key Management | β Manual | β Automatic |
NAT Traversal | β Needs config | β Built-in with DERP/STUN |
Device Discovery | β | β MagicDNS, etc. |
Access Control | β | β ACLs, admin panel |
Source | Fully open source | Mostly open source with closed coordination backend |
Letβs create a simple peer-to-peer WireGuard VPN between two devices β say, your MacBook and a remote Linux server.
β οΈ This is a manual setup for learning β Tailscale automates this for you.
- WireGuard installed on both devices
- SSH access to your remote server
- A public IP or port-forwarded address for the server
On macOS:
brew install wireguard-tools
On Linux:
sudo apt install wireguard
On each device (MacBook and Server):
wg genkey | tee privatekey | wg pubkey > publickey
Youβll now have:
privatekey
publickey
Letβs say:
Device | Internal VPN IP | Public IP |
---|---|---|
MacBook | 10.0.0.2 | (dynamic) |
Server | 10.0.0.1 | 203.0.113.1 |
[Interface]
PrivateKey = <MacBook_Private_Key>
Address = 10.0.0.2/24
DNS = 1.1.1.1
[Peer]
PublicKey = <Server_Public_Key>
Endpoint = 203.0.113.1:51820
AllowedIPs = 10.0.0.1/32
PersistentKeepalive = 25
[Interface]
PrivateKey = <Server_Private_Key>
Address = 10.0.0.1/24
ListenPort = 51820
[Peer]
PublicKey = <MacBook_Public_Key>
AllowedIPs = 10.0.0.2/32
On Linux Server:
sudo wg-quick up wg0
On macOS:
sudo wg-quick up wg0
β
You can now ping 10.0.0.1
from your MacBook and vice versa.
Try:
ping 10.0.0.1
Or SSH via the VPN IP:
π You now have a working private VPN between two devices.
Tailscale:
- Automates everything above
- Sets up a mesh network (all devices connect directly or relay if needed)
- Adds security, identity (SSO), and DNS without you needing to touch config files
- Great for teams, personal use, or remote IoT devices
You can still use WireGuard manually if you want full control, especially for self-hosted setups or learning purposes.