Witam. Zrobiłem ustawienia podstawowe nordvpn ze strony : https://nordvpn.com/pl/tutorials/openwrt/openvpn/
Wszystko działa ale zdarzają się wycieki. Chcę zrobić to aby temu zapobiec ale nie wiem jak . Proszę o pomac jak to wklepać ?
(Optional) To prevent traffic leakage in case VPN-tunnel drops you can edit the file /etc/firewall.user with the following content:
# This file is interpreted as shell script.
# Put your custom iptables rules here, they will# be executed with each firewall (re-)start.
# Internal uci firewall chains are flushed and recreated on reload, so
# put custom rules into the root chains e.g. INPUT or FORWARD or into the
# special user chains, e.g. input_wan_rule or postrouting_lan_rule.
if (! ip a s tun0 up) && (! iptables -C forwarding_rule -j REJECT); then
iptables -I forwarding_rule -j REJECT
fi
You should also create the file 99-prevent-leak in the folder /etc/hotplug.d/iface/ with following content:
#!/bin/sh
if [ "$ACTION" = ifup ] && (ip a s tun0 up) && (iptables -C forwarding_rule -j REJECT); then
iptables -D forwarding_rule -j REJECT
fi
if [ "$ACTION" = ifdown ] && (! ip a s tun0 up) && (! iptables -C forwarding_rule -j REJECT); then
iptables -I forwarding_rule -j REJECT
fi
In some cases, OpenVPN hangs with log message like (couldn't resolve host …). In this case, a tunnel stays up but the connection is lost. It should be reconnected manually, with the following script /etc/openvpn/reconnect.sh, which is added to /etc/rc.local as:
/etc/openvpn/reconnect.sh &
"reconnect.sh" should contain this script:
#!/bin/sh
n=10
while sleep 50; do
t=$(ping -c $n 8.8.8.8 | grep -o -E '[0-9]+ packets r' | grep -o -E '[0-9]+')
if [ "$t" -eq 0 ]; then
/etc/init.d/openvpn restart
fi
done
When you finish these instructions, the connection should be configured, and you should be connected successfully. You can check by visiting NordVPN.com/profile/ and checking if you show up as “Protected”.