netstack

edit

WireGuard - Federation VPN

WireGuard provides site-to-site VPN connectivity between netstack federation nodes. This enables:

Federation Topology

cf.2cld.net (Cedar Falls)  ←──WireGuard──→  trink (Trink's node)
     ↕                                           ↕
wf.2cld.net (Winfield)    ←──WireGuard──→  sl.2cld.net (O'Fallon)

Use Case: nsdockerhv → gitea.trink.com

Goal: Wip (running on nsdockerhv at cf) needs to reach https://gitea.trink.com/trink/stack to pull Trink’s federation commits.

Prerequisite: Trink provides:

Configuration (nsdockerhv - cf node)

# /etc/wireguard/wg-trink.conf

[Interface]
# nsdockerhv's WireGuard identity
PrivateKey = <nsdockerhv-private-key>
Address = 10.100.0.1/24
# ListenPort = 51820  # optional if only initiating

[Peer]
# Trink's endpoint
PublicKey = <trink-public-key>
Endpoint = <trink-public-ip>:51820
AllowedIPs = 10.100.0.2/32, <trink-internal-subnet>
PersistentKeepalive = 25

Configuration (Trink’s node)

# /etc/wireguard/wg-cat.conf

[Interface]
PrivateKey = <trink-private-key>
Address = 10.100.0.2/24
ListenPort = 51820

[Peer]
# nsdockerhv (cf)
PublicKey = <nsdockerhv-public-key>
Endpoint = 192.111.21.62:51820
AllowedIPs = 10.100.0.1/32, 192.168.6.0/24
PersistentKeepalive = 25

Setup Steps

1. Generate keys (on each node)

wg genkey | tee privatekey | wg pubkey > publickey

2. Exchange public keys + endpoint info

3. Configure and start

# Install wireguard (Ubuntu/Debian)
sudo apt install wireguard

# Place config
sudo cp wg-trink.conf /etc/wireguard/

# Start tunnel
sudo wg-quick up wg-trink

# Verify
sudo wg show

# Enable on boot
sudo systemctl enable wg-quick@wg-trink

4. Verify connectivity

# Ping Trink's WireGuard IP
ping 10.100.0.2

# Test gitea access
curl -s https://gitea.trink.com/trink/stack | head -20

# Or if gitea is on internal IP behind the tunnel:
curl -s http://10.100.0.2:3000/trink/stack

5. DNS (optional)

Add to /etc/hosts or local DNS:

10.100.0.2  gitea.trink.com

Federation VPN Subnet Plan

Node WireGuard IP Location Public Endpoint
nsdockerhv (cf) 10.100.0.1 Cedar Falls 192.111.21.62:51820
trink 10.100.0.2 Trink’s site TBD
wf 10.100.0.3 Winfield TBD
sl 10.100.0.4 O’Fallon 24.216.208.251:51820

Security Notes

Troubleshooting

# Check tunnel status
sudo wg show

# Check if interface is up
ip addr show wg-trink

# Check routing
ip route | grep 10.100

# Debug handshake issues (usually key mismatch or endpoint unreachable)
sudo journalctl -u wg-quick@wg-trink

# Restart tunnel
sudo wg-quick down wg-trink && sudo wg-quick up wg-trink