Wireguard not routing traffic from client to other servers on the network
After so many try and fail and brainstorming with wireguard IRC chanel guys, apparently I forgot to add a static route for 10.7.0.0/24 for each server behind wireguard. Ping goes to the server, but does not return as server does not know where to send that echo-reply:
ip route add 10.7.0.0/24 via 11.11.11.11 dev eth0 (main device for communication)
For me, problem solved ;-)
I ran into the same problem - my server aka "Wireguard SRV" in rhe diagram (=Centos8, with iptables and ferm) doesn't route traffic.
The problem: I forgot to sysctl -w net.ipv4.ip_forward=1
.
But that was not the only issue - ip route add ...
was not the solution.
So I added these lines to my wireguard-config (located at /etc/wireguard/wg0.conf
according to your addresses):
[Interface]
// ...
PreUp = iptables -A POSTROUTING -s 10.7.0.0/24 -o eth0 -j SNAT --to-source 11.11.11.11 -t nat
PreDown = iptables -D POSTROUTING -s 10.7.0.0/24 -o eth0 -j SNAT --to-source 11.11.11.11 -t nat