# WireGuard Gateway

## Purpose

The WireGuard gateway connects the public VPS to the Bytek home network through an encrypted tunnel.

The gateway allows public HTTPS traffic to reach Traefik without exposing individual home services directly through the Bell router.

The WireGuard gateway provides:

<div id="bkmrk-encrypted-vps-to-hom" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- Encrypted VPS-to-home connectivity.
- Controlled forwarding between the tunnel and the home LAN.
- Network address translation where required.
- Firewall enforcement between public ingress and private services.
- A private path from the VPS to Traefik.
- Separation between the public VPS and the rest of the home network.

---

</div>## Service Information

<div id="bkmrk-setting-value-servic" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;"><div aria-expanded="false" class="___5wvz9a0 ftgm304 f1oy3dpc fm6nont f48hbct" data-stable-ignore="true" data-tabster="{"restorer":{"type":1}}" role="presentation" tabindex="0"><div class="___1dmoc29 f10pi13n ftgm304 f1enuhaj fdclmfp f1nbblvp fat0sn4 f1ov4xf1 fekwl8i f1lmfglv f1oz7aqm f1abmfm4 f1w619qj f16h0jq8"><table class="___1vyiefv f1ddd56o f16vktn6 f1ahpp82 f11qra4b f1uinfot fibjyge fvueend f9yszdx f1fu4s3n f3l3pb3 f10ghnd0 f8fmt76 fjvbh62 f1qrqxae f1vw5qpk fc02sbz fxawf59 fymf513 f1aoyrul f1el8yx3 f1pymoxg f1ofu761 fe6itr f7coize f1794535 f1o0pw0q fbjjl9v fk1v6el f16pyhcb f1ixlhx9 f12zef0i flu5r5u f19haqzy f1owmcxx f1oddm8q f1004tna fcoaxci fh0ee9u f15v23i2 f1dmj53 f1r1gcv9 f14z1veh ffufd3x f1ypplot f1660cg"><tbody><tr><th>Setting</th><th>Value</th></tr><tr><td>Service name</td><td>WireGuard Gateway</td></tr><tr><td>Private IP address</td><td>`192.168.2.64`</td></tr><tr><td>Primary role</td><td>VPS-to-home tunnel gateway</td></tr><tr><td>Home LAN</td><td>`192.168.2.0/24`</td></tr><tr><td>Default gateway</td><td>`192.168.2.1`</td></tr><tr><td>Public peer</td><td>VPS at `38.29.213.101`</td></tr><tr><td>Administrative access</td><td>SSH key authentication</td></tr><tr><td>Public exposure</td><td>WireGuard port only</td></tr><tr><td>Backup coverage</td><td>Proxmox scheduled backup</td></tr><tr><td>Guest type</td><td>Confirm VM or LXC</td></tr><tr><td>Proxmox guest ID</td><td>Confirm current VM or CT ID</td></tr></tbody></table>

</div></div>---

</div>## Architecture Role

The WireGuard gateway sits between the public VPS and the home LAN.

When an external user opens a hosted application:

<div id="bkmrk-public-dns-resolves-" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">1. Public DNS resolves the application hostname to the VPS.
2. The client connects to the VPS.
3. The VPS forwards the approved connection through WireGuard.
4. The WireGuard gateway receives the encrypted traffic.
5. The gateway applies forwarding and firewall rules.
6. The gateway sends the request to Traefik at `192.168.2.182`.
7. Traefik routes the request to the correct internal application.

</div>The WireGuard gateway does not host the applications.

The gateway only provides secure transport and controlled forwarding.

<div id="bkmrk-" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## Primary Traffic Flow

The normal public application path includes:

<div id="bkmrk-stage-component-publ" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;"><div aria-expanded="false" class="___5wvz9a0 ftgm304 f1oy3dpc fm6nont f48hbct" data-stable-ignore="true" data-tabster="{"restorer":{"type":1}}" role="presentation" tabindex="0"><div class="___1dmoc29 f10pi13n ftgm304 f1enuhaj fdclmfp f1nbblvp fat0sn4 f1ov4xf1 fekwl8i f1lmfglv f1oz7aqm f1abmfm4 f1w619qj f16h0jq8"><table class="___1vyiefv f1ddd56o f16vktn6 f1ahpp82 f11qra4b f1uinfot fibjyge fvueend f9yszdx f1fu4s3n f3l3pb3 f10ghnd0 f8fmt76 fjvbh62 f1qrqxae f1vw5qpk fc02sbz fxawf59 fymf513 f1aoyrul f1el8yx3 f1pymoxg f1ofu761 fe6itr f7coize f1794535 f1o0pw0q fbjjl9v fk1v6el f16pyhcb f1ixlhx9 f12zef0i flu5r5u f19haqzy f1owmcxx f1oddm8q f1004tna fcoaxci fh0ee9u f15v23i2 f1dmj53 f1r1gcv9 f14z1veh ffufd3x f1ypplot f1660cg"><tbody><tr><th>Stage</th><th>Component</th></tr><tr><td>Public DNS</td><td>WHC cPanel</td></tr><tr><td>Public entry point</td><td>VPS at `38.29.213.101`</td></tr><tr><td>Encrypted transport</td><td>WireGuard</td></tr><tr><td>Home tunnel endpoint</td><td>WireGuard gateway at `192.168.2.64`</td></tr><tr><td>HTTPS routing</td><td>Traefik at `192.168.2.182`</td></tr><tr><td>Application backend</td><td>Private VM or LXC</td></tr></tbody></table>

</div></div></div>Only required application traffic should pass through this path.

<div id="bkmrk--1" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## WireGuard Interface

The WireGuard interface contains:

<div id="bkmrk-a-private-tunnel-add" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- A private tunnel address.
- A listening port.
- A private key.
- A peer definition for the VPS.
- Allowed IP routes.
- Optional startup and shutdown firewall commands.

</div>The existing interface name, tunnel subnet, listening port, and peer address should be recorded after checking the active configuration.

Useful checks:

<div id="bkmrk-sudo-wg-show-sudo-wg" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- `sudo wg show`
- `sudo wg showconf wg0`
- `ip -br addr`
- `ip route`

</div>If the interface is not named `wg0`, replace `wg0` with the actual interface name.

Do not copy the private key into BookStack.

<div id="bkmrk--2" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## Key Management

WireGuard authentication uses public and private key pairs.

### Gateway Private Key

The gateway private key:

<div id="bkmrk-must-remain-only-on-" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- Must remain only on the WireGuard gateway.
- Must have restrictive filesystem permissions.
- Must not be copied into BookStack.
- Must not be sent through chat or email.
- Must be stored in an encrypted backup or password manager if recovery requires it.

</div>### Gateway Public Key

The gateway public key may be stored in documentation.

The public key identifies the gateway to the VPS peer.

### VPS Public Key

The gateway configuration contains the VPS public key.

The VPS private key remains only on the VPS.

### Key Rotation

If a private key is exposed:

<div id="bkmrk-generate-a-new-key-p" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">1. Generate a new key pair on the affected peer.
2. Update the opposite peer with the new public key.
3. Restart or reload the affected WireGuard interface.
4. Confirm a new handshake.
5. Revoke the compromised key.
6. Update the encrypted recovery record.
7. Document the rotation date.

---

</div>## Allowed IPs

WireGuard Allowed IPs control routing and peer address validation.

The gateway and VPS must use narrow Allowed IP entries.

Allowed IPs should contain only:

<div id="bkmrk-the-remote-tunnel-ad" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- The remote tunnel address.
- Explicit home or service routes required by the design.
- Any intentionally routed management destination.

</div>Avoid using overly broad routes unless the architecture requires them.

Do not add the full home LAN to a peer merely for convenience without reviewing the security impact.

<div id="bkmrk--3" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## IP Forwarding

The gateway requires IPv4 forwarding.

Check the current value with:

`sysctl net.ipv4.ip_forward`

Expected result:

<div id="bkmrk-net.ipv4.ip_forward-" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- `net.ipv4.ip_forward = 1`

</div>The persistent setting should be stored in a file under `/etc/sysctl.d/`.

If forwarding is disabled, the WireGuard handshake may succeed while application traffic still fails.

<div id="bkmrk--4" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## Network Address Translation

The gateway may use NAT when home-LAN devices do not have a route back to the WireGuard tunnel subnet.

NAT allows an internal destination to see the connection as originating from the WireGuard gateway’s LAN address.

Advantages:

<div id="bkmrk-no-static-route-is-r" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- No static route is required on the Bell router.
- Existing LAN devices can return traffic normally.
- Deployment is simpler.

</div>Limitations:

<div id="bkmrk-internal-application" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- Internal applications see the gateway address rather than the original tunnel source.
- Source-based application logging becomes less detailed.
- Firewall rules on the destination must allow the gateway address.

</div>NAT rules should be narrow and limited to required source networks, destinations, and ports.

<div id="bkmrk--5" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## Firewall Policy

The WireGuard gateway must permit only required tunnel traffic.

### Required Traffic

Typical required traffic includes:

<div id="bkmrk-wireguard-udp-traffi" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- WireGuard UDP traffic between the VPS and gateway.
- Forwarded HTTPS traffic to Traefik.
- Established return traffic.
- SSH administration from the home LAN.
- Selected diagnostic traffic.

</div>### Restricted Traffic

The VPS should not automatically receive unrestricted access to:

<div id="bkmrk-proxmox.-pi-hole-adm" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- Proxmox.
- Pi-hole administration.
- Nextcloud AIO management.
- Uptime Kuma’s private backend.
- Authentik’s private backend.
- Vikunja’s private backend.
- BookStack’s private backend.
- SSH on every home service.
- The Docker API.
- Other LAN client devices.

</div>Each additional route should have a documented purpose.

<div id="bkmrk--6" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## Traefik Forwarding

The primary application destination behind the WireGuard gateway is Traefik.

<div id="bkmrk-destination-value-tr" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;"><div aria-expanded="false" class="___5wvz9a0 ftgm304 f1oy3dpc fm6nont f48hbct" data-stable-ignore="true" data-tabster="{"restorer":{"type":1}}" role="presentation" tabindex="0"><div class="___1dmoc29 f10pi13n ftgm304 f1enuhaj fdclmfp f1nbblvp fat0sn4 f1ov4xf1 fekwl8i f1lmfglv f1oz7aqm f1abmfm4 f1w619qj f16h0jq8"><table class="___1vyiefv f1ddd56o f16vktn6 f1ahpp82 f11qra4b f1uinfot fibjyge fvueend f9yszdx f1fu4s3n f3l3pb3 f10ghnd0 f8fmt76 fjvbh62 f1qrqxae f1vw5qpk fc02sbz fxawf59 fymf513 f1aoyrul f1el8yx3 f1pymoxg f1ofu761 fe6itr f7coize f1794535 f1o0pw0q fbjjl9v fk1v6el f16pyhcb f1ixlhx9 f12zef0i flu5r5u f19haqzy f1owmcxx f1oddm8q f1004tna fcoaxci fh0ee9u f15v23i2 f1dmj53 f1r1gcv9 f14z1veh ffufd3x f1ypplot f1660cg"><tbody><tr><th>Destination</th><th>Value</th></tr><tr><td>Traefik address</td><td>`192.168.2.182`</td></tr><tr><td>Public application port</td><td>TCP 443</td></tr><tr><td>Purpose</td><td>HTTPS routing to internal applications</td></tr></tbody></table>

</div></div></div>The gateway should forward approved public HTTPS traffic to Traefik rather than directly to individual application VMs.

This keeps public routing centralized.

<div id="bkmrk--7" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## Proxmox Management Through the Tunnel

Proxmox management is not part of the normal public ingress path.

If emergency Proxmox access through the VPS is intentionally enabled, use a narrow route such as:

<div id="bkmrk-vps-tunnel-address-t" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- VPS tunnel address to `192.168.2.254`.
- TCP port 8006 only.
- Optional TCP port 22 using a separate rule.
- SSH local port forwarding from the remote workstation.

</div>Do not expose Proxmox TCP 8006 directly on the VPS public interface.

The preferred long-term remote-management method is a dedicated road-warrior VPN for the administrator’s laptop or phone.

<div id="bkmrk--8" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## Separation From a Future Remote-User VPN

The current WireGuard connection is used for VPS ingress.

A future laptop or phone VPN must use:

<div id="bkmrk-a-separate-wireguard" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- A separate WireGuard interface.
- A separate UDP port.
- A separate VPN subnet.
- Separate peer keys.
- A separate firewall policy.
- Unique addresses for every device.

</div>Do not reuse the VPS key pair or peer configuration for remote-user devices.

The VPS tunnel and a road-warrior VPN serve different purposes.

<div id="bkmrk--9" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## Service Startup

The WireGuard gateway should start early after a host reboot.

Preferred dependency order:

<div id="bkmrk-proxmox-ve.-pi-hole." style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">1. Proxmox VE.
2. Pi-hole.
3. WireGuard gateway.
4. Authentik.
5. Traefik.
6. Public applications.

</div>The WireGuard service should be enabled at boot.

Check the active service using:

`systemctl status wg-quick@wg0 --no-pager`

If the interface name differs, replace `wg0` with the correct name.

Expected service state:

<div id="bkmrk-active.-interface-cr" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- Active.
- Interface created.
- Peer loaded.
- No repeated startup errors.

---

</div>## Health Validation

### Confirm the Interface

Use:

`sudo wg show`

Confirm:

<div id="bkmrk-interface-exists.-li" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- Interface exists.
- Listening port is present.
- VPS public key is listed.
- Endpoint is correct.
- Allowed IPs are correct.
- Latest handshake is recent.
- Transfer counters increase.

</div>### Confirm Tunnel Addressing

Use:

`ip -br addr`

The WireGuard interface should show the expected tunnel address.

### Confirm Routes

Use:

`ip route`

The required tunnel and LAN routes should be present.

### Confirm Forwarding

Use:

`sysctl net.ipv4.ip_forward`

Expected:

<div id="bkmrk-forwarding-enabled." style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- Forwarding enabled.

</div>### Confirm Firewall

If UFW is used:

`sudo ufw status numbered`

If iptables NAT is used:

`sudo iptables -t nat -L -n -v --line-numbers`

If nftables is used:

`sudo nft list ruleset`

Review only the firewall system actually used by the gateway.

<div id="bkmrk--10" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## End-to-End Validation

A successful WireGuard handshake does not prove application forwarding works.

Validate the complete path.

### From the VPS

Test the home WireGuard peer or tunnel gateway address.

Then test Traefik through the tunnel on the intended destination and port.

### From an External Client

Use:

<div id="bkmrk-cellular-data.-a-mob" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- Cellular data.
- A mobile hotspot.
- A remote network.

</div>Open a public application such as:

<span class="___xxxjie0 f1w7gpdv f1gqqdtu" data-wra="1" style="opacity: 1; transition: opacity 500ms ease-out;">[Open Authentik](https://portal.bytek.ca/)</span>

The application should load through:

<div id="bkmrk-vps.-wireguard.-gate" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- VPS.
- WireGuard.
- Gateway.
- Traefik.
- Application backend.

</div>### From the Home LAN

The same hostname should resolve through Pi-hole and bypass the VPS.

This verifies that public and private paths both work.

<div id="bkmrk--11" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## Monitoring

Recommended Uptime Kuma monitors include:

<div id="bkmrk-monitor-target-gatew" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;"><div aria-expanded="false" class="___5wvz9a0 ftgm304 f1oy3dpc fm6nont f48hbct" data-stable-ignore="true" data-tabster="{"restorer":{"type":1}}" role="presentation" tabindex="0"><div class="___1dmoc29 f10pi13n ftgm304 f1enuhaj fdclmfp f1nbblvp fat0sn4 f1ov4xf1 fekwl8i f1lmfglv f1oz7aqm f1abmfm4 f1w619qj f16h0jq8"><table class="___1vyiefv f1ddd56o f16vktn6 f1ahpp82 f11qra4b f1uinfot fibjyge fvueend f9yszdx f1fu4s3n f3l3pb3 f10ghnd0 f8fmt76 fjvbh62 f1qrqxae f1vw5qpk fc02sbz fxawf59 fymf513 f1aoyrul f1el8yx3 f1pymoxg f1ofu761 fe6itr f7coize f1794535 f1o0pw0q fbjjl9v fk1v6el f16pyhcb f1ixlhx9 f12zef0i flu5r5u f19haqzy f1owmcxx f1oddm8q f1004tna fcoaxci fh0ee9u f15v23i2 f1dmj53 f1r1gcv9 f14z1veh ffufd3x f1ypplot f1660cg"><tbody><tr><th>Monitor</th><th>Target</th></tr><tr><td>Gateway VM or LXC</td><td>Ping `192.168.2.64`</td></tr><tr><td>WireGuard tunnel peer</td><td>Tunnel address or supported monitor</td></tr><tr><td>Public VPS</td><td>`38.29.213.101`</td></tr><tr><td>Traefik through tunnel</td><td>Approved tunnel path</td></tr><tr><td>Public Authentik</td><td>`portal.bytek.ca`</td></tr><tr><td>Public Nextcloud</td><td>`cloud.bytek.ca`</td></tr></tbody></table>

</div></div></div>Monitoring should distinguish between:

<div id="bkmrk-gateway-unavailable." style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- Gateway unavailable.
- WireGuard handshake unavailable.
- Tunnel routing unavailable.
- Traefik unavailable.
- Individual application unavailable.

---

</div>## Common Failure Scenarios

### Handshake Is Missing

Possible causes:

<div id="bkmrk-vps-is-down.-home-in" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- VPS is down.
- Home internet connection is down.
- Gateway is down.
- WireGuard service is stopped.
- UDP port is blocked.
- Peer endpoint changed.
- Public key mismatch.
- Private key was changed.
- Allowed IPs are incorrect.

</div>### Handshake Exists but Applications Fail

Possible causes:

<div id="bkmrk-ip-forwarding-is-dis" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- IP forwarding is disabled.
- Forwarding firewall rule is missing.
- NAT rule is missing.
- Traefik is unavailable.
- Traefik address changed.
- Destination firewall denies the gateway.
- Return traffic follows the wrong path.
- VPS forwarding configuration is incorrect.

</div>### Internal Applications Work but Public Applications Fail

This usually indicates a problem with:

<div id="bkmrk-public-dns.-vps.-wir" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- Public DNS.
- VPS.
- WireGuard.
- Gateway forwarding.
- VPS or home-end firewalling.

</div>### One Public Application Fails

If other public applications work, the tunnel is probably healthy.

Check:

<div id="bkmrk-traefik-router.-cert" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- Traefik router.
- Certificate.
- Backend address.
- Backend firewall.
- Application health.

</div>### Tunnel Stops After a Power Failure

Check startup order:

<div id="bkmrk-confirm-the-gateway-" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">1. Confirm the gateway booted.
2. Confirm WireGuard started.
3. Confirm the network interface has its LAN address.
4. Confirm the VPS peer.
5. Confirm forwarding.
6. Confirm firewall rules loaded.
7. Confirm a new handshake.
8. Confirm Traefik is available.

---

</div>## Troubleshooting Order

When public ingress fails:

<div id="bkmrk-confirm-the-vps-is-r" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">1. Confirm the VPS is running.
2. Confirm the WireGuard gateway is running.
3. Confirm the gateway LAN IP is `192.168.2.64`.
4. Confirm the WireGuard interface exists.
5. Confirm the latest handshake.
6. Confirm transfer counters.
7. Confirm IPv4 forwarding.
8. Confirm forwarding firewall rules.
9. Confirm NAT rules.
10. Confirm Traefik at `192.168.2.182`.
11. Test a Traefik backend directly.
12. Test the public hostname externally.
13. Review logs before changing keys.

</div>Do not regenerate WireGuard keys as an early troubleshooting step.

<div id="bkmrk--12" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## Logging

Useful log sources include:

<div id="bkmrk-wireguard-service-jo" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- WireGuard service journal.
- System journal.
- UFW logs.
- Kernel network logs.
- Traefik access logs.
- VPS firewall logs.

</div>Review the WireGuard unit using:

`journalctl -u wg-quick@wg0 --since "30 minutes ago" --no-pager`

Replace the interface name if necessary.

Look for:

<div id="bkmrk-interface-startup-fa" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- Interface startup failures.
- Invalid configuration syntax.
- Address conflicts.
- Missing commands.
- Firewall command failures.
- Route conflicts.

---

</div>## Configuration Backup

Protect the following gateway data:

<div id="bkmrk-wireguard-configurat" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- WireGuard configuration.
- Private key.
- Public key.
- Peer definitions.
- Firewall rules.
- NAT rules.
- Sysctl forwarding configuration.
- SSH configuration.
- Authorized SSH keys.
- Network configuration.
- Recovery notes.

</div>The VM or LXC is included in the Proxmox backup system.

The WireGuard private key should also exist in an encrypted recovery location.

Do not put the private key directly into BookStack.

<div id="bkmrk--13" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">---

</div>## Recovery Procedure

If the gateway VM or LXC is corrupted:

<div id="bkmrk-use-proxmox-to-ident" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">1. Use Proxmox to identify the most recent good backup.
2. Restore under a temporary guest ID if testing is required.
3. Keep the restored guest disconnected from the LAN during initial inspection.
4. Verify the WireGuard configuration and private key.
5. Verify the LAN address.
6. Verify forwarding and firewall rules.
7. Shut down the failed production guest.
8. Assign the expected production identity and network configuration.
9. Start the replacement.
10. Confirm a WireGuard handshake.
11. Confirm Traefik reachability.
12. Test an application externally.

</div>If the key is unavailable:

<div id="bkmrk-generate-a-new-gatew" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">1. Generate a new gateway key pair.
2. Update the VPS peer with the new gateway public key.
3. Preserve the VPS key.
4. Restart the WireGuard interfaces.
5. Confirm the new handshake.
6. Store the new private key securely.

---

</div>## Security Checklist

<div id="bkmrk-wireguard-private-ke" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- WireGuard private key is not stored in BookStack.
- VPS and gateway use unique private keys.
- Allowed IPs are narrow.
- Public UDP exposure is limited to the WireGuard port.
- SSH uses keys.
- SSH is restricted to approved sources.
- IPv4 forwarding is enabled only because routing is required.
- NAT rules are narrow.
- VPS access to the LAN is limited.
- Proxmox is not publicly reachable.
- Pi-hole administration is not publicly reachable.
- AIO management is not publicly reachable.
- Docker API is not exposed.
- Backup coverage is active.
- Recovery keys are stored securely.

---

</div>## Validation Checklist

<div id="bkmrk-gateway-is-running.-" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- Gateway is running.
- LAN address is `192.168.2.64`.
- WireGuard interface is active.
- VPS peer is listed.
- Latest handshake is recent.
- Transfer counters increase.
- IP forwarding is enabled.
- Required routes exist.
- Required firewall rules exist.
- NAT rules are active where needed.
- Traefik at `192.168.2.182` is reachable.
- Public Authentik works externally.
- Public Nextcloud works externally.
- Internal split-DNS access still works without the VPS.
- Proxmox backup includes the gateway.
- WireGuard recovery material is stored securely.

---

</div>## Document Control

<div id="bkmrk-owner%3A-bryan-gagne-p" style="font-family: 'Segoe UI'; font-size: 14px; font-style: normal; font-weight: 400; line-height: 20px;">- **Owner:** Bryan Gagne-Plante
- **Private address:** `192.168.2.64`
- **Primary role:** VPS-to-home WireGuard gateway
- **Public peer:** VPS at `38.29.213.101`
- **Guest type:** Confirm VM or LXC
- **Guest ID:** Confirm current ID
- **WireGuard interface:** Confirm current interface name
- **Listen port:** Confirm current WireGuard UDP port
- **Tunnel subnet:** Confirm current tunnel subnet
- **Last verified:** YYYY-MM-DD
- **Last handshake test:** YYYY-MM-DD
- **Last external ingress test:** YYYY-MM-DD
- **Last restore test:** YYYY-MM-DD
- **Known limitation:** External application access depends on one VPS-to-home WireGuard tunnel

</div>