Forum

wireguard: can't re...
 
Notifications
Clear all

wireguard: can't reach another host in wireguard server network

1 Posty
1 Users
0 Reactions
581 Widok
0
Topic starter

Can't reaach any other host where wireguard server if part of internal network (LAN).

1 Answer
0
Topic starter

remember:

eth0 - this is my network interface, change it if needed

1. Add this lines in wg0.conf:

[Interface]
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

or run one the command for testing purposes like this one below

iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

2. Modify clients WG config in this way (adjust to your needs if necessary):

[Peer]
AllowedIPs = 192.168.99.0/24, 192.168.30.0/24

3. Enable net.ipv4.ip_forward = 1 on WG server.

how to edit:

  1. type "nano /etc/sysctl.conf"
  2. find #net.ipv4.ip_forward=1 and change it to net.ipv4.ip_forward=1 removing # character
  3. reload sysctl using "sysctl -p" command
This post was modified 9 miesięcy temu 4 times by mrmucha
This post was modified 8 miesięcy temu by mrmucha

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: