2018/routing/rc.local

57 lines
2.1 KiB
Plaintext
Raw Normal View History

2018-10-26 14:39:30 +03:00
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o tun+ -j SNAT --to 185.117.82.237
2018-10-27 22:27:04 +03:00
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o bond0.999 -j SNAT --to 185.117.82.237
#iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o bond0.6 -j MASQUERADE # REMOVE WHEN TESTING IN INITLAB DONE
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o bond0.10 -j MASQUERADE
#iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o bond0.6 -j MASQUERADE # REMOVE WHEN TESTING IN INITLAB DONE
2018-10-26 14:39:30 +03:00
# BCP38 filter
2018-10-27 22:27:04 +03:00
iptables -A FORWARD ! -s 10.20.0.0/22 -i bond0.20 -j DROP
iptables -A FORWARD ! -s 10.21.0.0/22 -i bond0.21 -j DROP
iptables -A FORWARD ! -s 10.22.0.0/22 -i bond0.22 -j DROP
iptables -A FORWARD ! -s 10.23.0.0/22 -i bond0.23 -j DROP
iptables -A FORWARD ! -s 10.24.0.0/22 -i bond0.24 -j DROP
2018-10-26 14:39:30 +03:00
# zone firewall
for i in 20 23 24; do
iptables -A FORWARD -d 10.${i}.0.0/24 -i tun+ -j ACCEPT
2018-10-27 22:27:04 +03:00
iptables -A FORWARD -d 10.${i}.0.0/24 -i bond0.999 -j ACCEPT
2018-10-26 14:39:30 +03:00
iptables -A FORWARD -d 10.${i}.0.0/24 -j DROP
done
2018-10-27 22:27:04 +03:00
iptables -A FORWARD -d 10.24.0.0/24 ! -i bond0.10 -j DROP
#iptables -A FORWARD -d 10.20.0.0/24 ! -i bond0.6 -j DROP # REMOVE WHEN TESTING IN INITLAB DONE
#iptables -A FORWARD -d 10.23.0.0/24 ! -i bond0.6 -j DROP # REMOVE WHEN TESTING IN INITLAB DONE
#iptables -A FORWARD -d 10.24.0.0/24 ! -i bond0.6 -j DROP # REMOVE WHEN TESTING IN INITLAB DONE
2018-10-26 14:39:30 +03:00
iptables -A FORWARD -p tcp --dport 25 -j DROP
ip rule add from 94.26.100.155 iif lo table tbc
ip rule add from 194.141.112.139 iif lo table tpark
2018-10-27 22:27:04 +03:00
echo 1 > /proc/sys/net/ipv4/conf/bond0.21/proxy_arp_pvlan
echo 1 > /proc/sys/net/ipv4/conf/bond0.22/proxy_arp_pvlan
2018-10-26 14:39:30 +03:00
2018-10-27 22:27:04 +03:00
echo 0 > /proc/sys/net/ipv4/conf/bond0.21/send_redirects
echo 0 > /proc/sys/net/ipv4/conf/bond0.22/send_redirects
2018-10-26 14:39:30 +03:00
echo 8388608 > /proc/sys/net/core/wmem_max
echo 8388608 > /proc/sys/net/core/wmem_default
echo 8388608 > /proc/sys/net/core/rmem_max
echo 8388608 > /proc/sys/net/core/rmem_default
exit 0