mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-20 03:40:17 +00:00
Try some iptables fix. (2/2). Needs unit testing.
This commit is contained in:
parent
22b5bfef68
commit
8a0f31b7ca
2 changed files with 8 additions and 5 deletions
7
pivpn
7
pivpn
|
@ -37,10 +37,7 @@ function debugFunc {
|
||||||
if [[ ${noUFW} -eq 1 ]]; then
|
if [[ ${noUFW} -eq 1 ]]; then
|
||||||
IPTABLES_FIX=`iptables -t nat -L -n -v | grep -c 'MASQUERADE.*10.8.0.0\/24'`
|
IPTABLES_FIX=`iptables -t nat -L -n -v | grep -c 'MASQUERADE.*10.8.0.0\/24'`
|
||||||
iptables -t nat -L -n -v | grep -q 'MASQUERADE.*10.8.0.0\/24'
|
iptables -t nat -L -n -v | grep -q 'MASQUERADE.*10.8.0.0\/24'
|
||||||
if [ $? = 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo Good, rule exists
|
|
||||||
else
|
|
||||||
echo in rule does not exist area
|
|
||||||
IPTABLES_FIX=2
|
IPTABLES_FIX=2
|
||||||
fi
|
fi
|
||||||
if [[ ${IPTABLES_FIX} -gt 1 ]]; then
|
if [[ ${IPTABLES_FIX} -gt 1 ]]; then
|
||||||
|
@ -50,6 +47,8 @@ function debugFunc {
|
||||||
if [[ ${REPLY} =~ ^[Yy]$ ]]; then
|
if [[ ${REPLY} =~ ^[Yy]$ ]]; then
|
||||||
$SUDO /opt/pivpn/fix_iptables.sh
|
$SUDO /opt/pivpn/fix_iptables.sh
|
||||||
fi
|
fi
|
||||||
|
echo "::: Attempt at fix completed."
|
||||||
|
echo "::: Run 'pivpn debug' again to see if we detect issues."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -2,4 +2,8 @@
|
||||||
# PiVPN: Fix iptables script
|
# PiVPN: Fix iptables script
|
||||||
# called by pivpnDebug.sh
|
# called by pivpnDebug.sh
|
||||||
|
|
||||||
echo "I don't exist yet..."
|
IPv4dev=$(ip route get 8.8.8.8 | awk '{for(i=1;i<=NF;i++)if($i~/dev/)print $(i+1)}')
|
||||||
|
iptables -t nat -F
|
||||||
|
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o ${IPv4dev} -j MASQUERADE
|
||||||
|
iptables-save > /etc/iptables/rules.v4
|
||||||
|
iptables-restore < /etc/iptables/rules.v4
|
||||||
|
|
Loading…
Reference in a new issue