Press "Enter" to skip to content

How to ping a LAN behind a VPN router client from another VPN client? [closed]

        I am trying to access my LAN devices over a WireGuard VPS setup. I have 2 WireGuard peers connected to a WireGuard server having a public IP on AWS EC2 running Ubuntu. I am new to WireGuard and also a networking newbie but this is what I have got working so far.

This is the setup I’m using:
Network setup

ping 10.66.66.1 works from A 
ping 10.66.66.2 works from A   
ping 10.66.66.1 works from B 
ping 10.66.66.3 works from B

The issue is when I try to ping the LAN behind R3 from A.

ping 192.168.102.10 results in timed out. 
tracert 192.168.102.10 shows the first hop to 10.66.66.1. 
All subsequent hops are * * * and trace never completes.   

Similar issues are seen when I try to ping 192.168.103.10 from B. The only difference on this side is that I have a static route configured on R3 for destinations 192.168.103.0/24 to be via 10.66.66.2

Also, we have to assume that I do not have access to configurations of R1 and R2 in any way. This setup is intended to be portable and ready to go with minimal configuration on R3 whenever A and R3 get internet access.

What I have tried so far:

  • Enabling IP forwarding on the server in /etc/sysctl/conf.
net.ipv4.ip_forward=1  
  • Adding PostUp and PreDown routes on server wg0.conf as per this post
PostUp = ip route add 192.168.102.0/24 via 10.66.66.2 dev wg0 
PreDown = ip route del 192.168.102.0/24 via 10.66.66.2 dev wg0

I’m lost and unsure how to resolve this. Any help is greatly appreciated, Thanks!!

CONFIGS:

// /etc/wireguard/params 
SERVER_PUB_IP=<PUBLIC_IP_S> 
SERVER_PUB_NIC=ens5  
SERVER_WG_NIC=wg0  
SERVER_WG_IPV4=10.66.66.1   
SERVER_WG_IPV6=fd42:42:42::1  
SERVER_PORT=53958   
SERVER_PRIV_KEY=<PRIVATE_KEY>  
SERVER_PUB_KEY=<PUBLIC_KEY>   
CLIENT_DNS_1=1.1.1.1  
CLIENT_DNS_2=1.0.0.1  
ALLOWED_IPS=0.0.0.0/0,::/0     

// /etc/wireguard/wg0.conf     
[Interface] Address = 10.66.66.1/24,fd42:42:42::1/64  
ListenPort = 53958   
PrivateKey = <PRIVATE_KEY>  
PostUp = iptables -I INPUT -p udp  --dport 53958 -j ACCEPT  
PostUp = iptables -I FORWARD -i ens5 -o wg0 -j  ACCEPT  
PostUp = iptables -I FORWARD -i wg0 -j ACCEPT  
PostUp = iptables  -t nat -A POSTROUTING -o ens5 -j MASQUERADE  
PostUp = ip6tables -I  FORWARD -i wg0 -j ACCEPT  
PostUp = ip6tables -t nat -A POSTROUTING -o  ens5 -j MASQUERADE  
PostDown = iptables -D INPUT -p udp --dport 53958 -j  ACCEPT  
PostDown = iptables -D FORWARD -i ens5 -o wg0 -j ACCEPT  
PostDown =  iptables -D FORWARD -i wg0 -j ACCEPT  
PostDown = iptables -t nat -D  POSTROUTING -o ens5 -j MASQUERADE  
PostDown = ip6tables -D FORWARD -i wg0  -j ACCEPT  
PostDown = ip6tables -t nat -D POSTROUTING -o ens5 -j  MASQUERADE     

### Client R3 
[Peer]  
PublicKey = <CLIENT_PUB_KEY>  
PresharedKey = <CLIENT_PSK>  
AllowedIPs = 192.168.103.0/24,fd42:42:42::2/128     

### Client A 
[Peer]  
PublicKey = <CLIENT_PUB_KEY>  
PresharedKey = <CLIENT_PSK>  
AllowedIPs = 192.168.102.0/24,fd42:42:42::3/128     


// A.conf    
[Interface]  
PrivateKey = <PRIVATE_KEY>  
Address = 10.66.66.3/32,fd42:42:42::3/128  
DNS = 1.1.1.1,1.0.0.1    

[Peer]  
PublicKey = <PUBLIC_KEY>  
PresharedKey = <PRE_SHARED_KEY>  
Endpoint = <PUBLIC_IP>:53958  
AllowedIPs = 0.0.0.0/0,::/0  

// R3.conf    
[Interface]  
PrivateKey = <PRIVATE_KEY>  
Address = 10.66.66.2/32,fd42:42:42::2/128  
DNS = 1.1.1.1,1.0.0.1    

[Peer]  
PublicKey = <PUBLIC_KEY>  
PresharedKey = <PRE_SHARED_KEY>  
Endpoint = <PUBLIC_IP>:53958  
AllowedIPs = 0.0.0.0/0,::/0

Be First to Comment

Leave a Reply