From e08fce20418e231e51e6bd8cee10e352902fabc6 Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Sun, 15 Sep 2019 16:56:26 -0400 Subject: [PATCH] Add iptables/nftables test. --- installers/common.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index 30f75d5..4a78797 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -218,22 +218,22 @@ function default_configuration() { # #RASPAP is for removal # select iptables or nftables - # function networktables() { - # if [ ! -f /usr/sbin/iptables-nft ]; then - # tablerouteA='iptables -t nat -A POSTROUTING -s 10.3.141.0\/24 -o lokitun0 -j MASQUERADE #RASPAP' - # tablerouteB='iptables -t nat -A POSTROUTING -j MASQUERADE #RASPAP' - # fi - # sudo apt-get -y install nftables - # tablerouteA='nft add rule ip nat POSTROUTING oifname "lokitun0" ip saddr 10.3.141.0\/24 counter masquerade #RASPAP' - # tablerouteB='nft add rule ip nat POSTROUTING counter masquerade #RASPAP' - # } + function networktables() { + if [ ! -f /usr/sbin/iptables-nft ]; then + tablerouteA='iptables -t nat -A POSTROUTING -s 10.3.141.0\/24 -o lokitun0 -j MASQUERADE #RASPAP' + tablerouteB='iptables -t nat -A POSTROUTING -j MASQUERADE #RASPAP' + fi + sudo apt-get -y install nftables + tablerouteA='nft add rule ip nat POSTROUTING oifname "lokitun0" ip saddr 10.3.141.0\/24 counter masquerade #RASPAP' + tablerouteB='nft add rule ip nat POSTROUTING counter masquerade #RASPAP' + } lines=( 'echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward #RASPAP' - 'iptables -t nat -A POSTROUTING -s 10.3.141.0\/24 -o lokitun0 -j MASQUERADE #RASPAP' - 'iptables -t nat -A POSTROUTING -j MASQUERADE #RASPAP' - #echo $tablerouteA - #echo $tablerouteB + #'iptables -t nat -A POSTROUTING -s 10.3.141.0\/24 -o lokitun0 -j MASQUERADE #RASPAP' + #'iptables -t nat -A POSTROUTING -j MASQUERADE #RASPAP' + "$tablerouteA" + "$tablerouteB" 'sudo \/var\/lib\/lokinet\/.\/lokilaunch.sh start #RASPAP' )