So let's say I'm a user in PC1, I have two ubuntu servers in two countries (VPS1 and VPS2) VPS1 is a WireGuard server and VPS2 is a OpenVPN server.
I want to do something like this:
PC1 ---> VPS1 ---> VPS2 ----> Internet
I'm following this (translation) tutorial.
At the end of the tutorial, There are below commands to run:
iptables -t nat -D POSTROUTING -s 10.7.0.0/24 ! -d 10.7.0.0/24 -j SNAT --to-source VPS1_IP
iptables -A FORWARD -i tun0 -o wg0 -j ACCEPT
iptables -A FORWARD -i wg0 -o tun0 -j ACCEPT
iptables -A FORWARD -d 10.7.0.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A POSTROUTING -s 10.7.0.0/24 -j SNAT --to-source 10.8.0.2
ip route add default via 10.8.0.2 table 120
ip rule add from 10.7.0.0/24 table 120
When running ip route add default via 10.8.0.2 table 120
, I get this error: Nexthop has invalid gateway
I tried this tutorial one time and it worked but I get the error above when I'm doing it now.