First of all hi everyone!
I have an intentional VPN chain between 3 nodes, they are all connected and I can ping and mtr from 10.0.0.2 to 10.0.2.1 however its not passing any connections from the 10.0.X.X network to the external network on node 3. I am wondering what type of routing I need to implement to make it work.
The idea here was a multi-hop wireguard config. If i can fix the outbound routing this setup is complete.
--pf.conf--
--rc.conf-section
For Node 3 the wg1 is not present, otherwise the pf.conf/rc.conf are identical and net.inet.ip.forwarding=1
Node 1
--wg0.conf--
--wg1.conf--
Node 2
--wg0.conf--
--wg1.conf--
Node 3
--wg0.conf--
I have an intentional VPN chain between 3 nodes, they are all connected and I can ping and mtr from 10.0.0.2 to 10.0.2.1 however its not passing any connections from the 10.0.X.X network to the external network on node 3. I am wondering what type of routing I need to implement to make it work.
The idea here was a multi-hop wireguard config. If i can fix the outbound routing this setup is complete.
--pf.conf--
Code:
ext_if="wg1"
int_if="wg0"
set skip on lo0
scrub in all
nat on $ext_if from $int_if:network to any -> ($ext_if)
pass from { lo0, $int_if:network } to any keep state
--rc.conf-section
Code:
gateway_enable="YES"
pf_enable="YES"
pf_rules="/etc/pf.conf"
wireguard_enable="YES"
wireguard_interfaces="wg0 wg1"
Node 1
--wg0.conf--
Code:
[Interface]
Address = 10.0.0.1/24
ListenPort = 8888
PrivateKey = <KEYREMOVED>
[Peer]
PublicKey = <KEYREMOVED>
PresharedKey = <KEYREMOVED>
AllowedIPs = 10.0.0.2/32
--wg1.conf--
Code:
[Interface]
Address = 10.0.1.2/24
ListenPort = 2222
PrivateKey = <KEYREMOVED>
DNS = 1.1.1.1
Table = off
PostUp = route -q -n add -inet 10.0.0.0/16 -interface wg1
PostUp = pfctl -F all -f /etc/pf.conf
PostUp = ping -c 1 10.0.1.1
PostDown = route -q -n delete -inet 10.0.0.0/16 -interface wg1
PostDown = pfctl -F all
[Peer]
PublicKey = <KEYREMOVED>
PresharedKey = <KEYREMOVED>
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = <IPREMOVED>:2222
--wg0.conf--
Code:
[Interface]
Address = 10.0.1.1/24
ListenPort = 2222
PrivateKey = <KEYREMOVED>
[Peer]
PublicKey = <KEYREMOVED>
PresharedKey = <KEYREMOVED>
AllowedIPs = 10.0.1.2/32
Code:
[Interface]
Address = 10.0.2.2/24
ListenPort = 3333
PrivateKey = <KEYREMOVED>
DNS = 1.1.1.1
Table = off
PostUp = route -q -n add -inet 10.0.0.0/16 -interface wg1
PostUp = pfctl -F all -f /etc/pf.conf
PostUp = ping -c 1 10.0.2.1
PostDown = route -q -n delete -inet 10.0.0.0/16 -interface wg1
PostDown = pfctl -F all
[Peer]
PublicKey = <KEYREMOVED>
PresharedKey = <KEYREMOVED>
AllowedIPs = 0.0.0.0/0, ::0
Endpoint = <IPREMOVED>:3333
--wg0.conf--
Code:
[Interface]
Address = 10.0.2.1/24
ListenPort = 3333
PrivateKey = <KEYREMOVED>
PostUp = pfctl -F all -f /etc/pf.conf
PostUp = ping -c 1 -S 10.0.2.1 1.1.1.1
PostDown = pfctl -F all
[Peer]
PublicKey = <KEYREMOVED>
PresharedKey = <KEYREMOVED>
AllowedIPs = 10.0.2.2/32