How do I setup WireGuard to access my Linode VLAN.
Let's say I have wg0 setup at 10.255.255.0/24 and the Linode VLAN is setup at 10.0.0.0/24 How would I set it up so that my home computer has access to the VLAN?
3 Replies
Server
Through the Cloud Manager, deploy a WireGuard Linode with the following Options:
Port: 51820
Tunnel IP: 10.255.255.1/24
WireGuard Public Key (Client): <YOUR CLIENTS PUBLIC KEY>
Tunnel IP (Client): 10.255.255.2/24
Endpoint IP (Client): <YOUR CLIENTS IP ADDRESS> (get from https://whatismyip.com or whatever)
Region: Pick one where VLANS are available (Mumbai, IN; Toronto, ON; Sydney, AU; or Atlanta, GA at the time of this writing.)
VLAN: Create or Select Your VLAN
IPAM Address: 10.0.0.1/24
Client
Make sure to include your VLAN in the Allowed IP's so that traffic to the VLAN is routed via WireGuard
[Interface]
PrivateKey = <YOUR CLIENT'S PRIVATE KEY>
Address = 10.255.255.2/24
[Peer]
PublicKey = <YOUR SERVER'S PUBLIC KEY> (Get from /root/wg-public.key)
AllowedIPs = 10.255.255.0/24, 10.0.0.0/24
Endpoint = <YOUR SERVER'S IP ADDRESS>:51820
Other VLAN Servers
Add a persistent static route for your WireGuard Client Network, i.e. for Debian:
Edit /etc/network/interfaces
iface eth1 inet static
address 10.0.0.2/24
down ip route del 10.255.255.0/24 via 10.0.0.1 dev eth1
up ip route add 10.255.255.255.0/24 via 10.0.0.1 dev eth1
Equivalent for NetPlan would be this, right?
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
eth1:
addresses: [10.0.0.2/24]
routes:
- to: 10.255.255.0/24
via: 10.0.0.5/24
For configuring NetPlan, take a look at https://www.linode.com/community/questions/22510/how-do-i-configure-netplan-openvpn-vlan