Guest User

Untitled

a guest
Mar 30th, 2022
1,607
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.33 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # rc.local-iptables.sh
  4. #
  5. # typical usage:
  6. # sudo /etc/rc.local-iptables.sh 95.31.39.132 10.216.1.187
  7.  
  8.  
  9. #if [ $# -ne 2 ]; then
  10. # echo "usage: rc.local-iptables.sh <PPP_IP> <REMOTE_PPP_IP>"
  11. # exit 1
  12. #fi
  13.  
  14. #PPP_IP="$1"
  15. #REMOTE_PPP_IP="$2"
  16.  
  17. #PPP_IP="95.31.39.132"
  18. #PPP_IP="95.165.96.9"
  19. PPP_IP="192.168.1.64"
  20. #PPP_IP="192.168.4.64"
  21. REMOTE_PPP_IP="10.216.1.187"
  22.  
  23. iptables=/sbin/iptables
  24. ifconfig=/sbin/ifconfig
  25. ip=/sbin/ip
  26. cat=/bin/cat
  27. grep=/bin/grep
  28. head=/usr/bin/head
  29. tail=/usr/bin/tail
  30. awk=/usr/bin/awk
  31. sed=/bin/sed
  32. route=/sbin/route
  33.  
  34. #BEELINE_IP="`$cat /var/lib/dhcp/dhclient.eth0.leases | $grep 'option routers' | $tail -1 | awk '{print $3}' | $sed 's/;//'`"
  35. BEELINE_IP="`$ifconfig eth0 | $head -n 2 | $tail -1 | $awk '{print $2;}' | $sed 's/addr://'`"
  36. #BEELINE_IP="$PPP_IP"
  37. echo "BEELINE_IP=\"${BEELINE_IP}\""
  38. LOCAL_NET="172.29.2.0/24"
  39. LOCAL_NET2="172.29.3.0/24"
  40. LOCAL_NET3="10.0.2.0/24"
  41. LOCAL_NS="172.29.2.3"
  42.  
  43.  
  44. sysctl net.netfilter.nf_conntrack_acct=1
  45.  
  46. map_port_tcp()
  47. {
  48. NAME="$1"
  49. SRCPORT="$2"
  50. DSTPORT="$3"
  51. if [[ ! "$1" =~ /^[0-9.]+$/ ]]; then
  52. NAME=`host $1 $LOCAL_NS | awk '{print \$4}' | tail -n 1`
  53. fi
  54. if [ "$DSTPORT" != "" ]; then
  55. DSTPORT=":$DSTPORT"
  56. fi
  57.  
  58. echo "map_port_tcp $SRCPORT => $NAME$DSTPORT"
  59.  
  60. $iptables -A INPUT -p tcp -m multiport --dports $SRCPORT -j ACCEPT
  61. $iptables -t nat -A PREROUTING -p tcp -m multiport --dports $SRCPORT -j DNAT --to $NAME$DSTPORT
  62. }
  63.  
  64. map_port_udp()
  65. {
  66. NAME="$1"
  67. SRCPORT="$2"
  68. DSTPORT="$3"
  69. if [[ ! "$1" =~ /^[0-9.]+$/ ]]; then
  70. NAME=`host $1 $LOCAL_NS | awk '{print \$4}' | tail -n 1`
  71. fi
  72. if [ "$DSTPORT" != "" ]; then
  73. DSTPORT=":$DSTPORT"
  74. fi
  75.  
  76. echo "map_port_udp $SRCPORT => $NAME$DSTPORT"
  77. $iptables -A INPUT -p udp -m multiport --dports $SRCPORT -j ACCEPT
  78. $iptables -t nat -A PREROUTING -p udp -m multiport --dports $SRCPORT -j DNAT --to $NAME$DSTPORT
  79. }
  80.  
  81. map_port()
  82. {
  83. map_port_tcp $@
  84. map_port_udp $@
  85. }
  86.  
  87. echo -n "0" > /proc/sys/net/ipv4/ip_forward
  88.  
  89. $iptables -F
  90. $iptables -t nat -F
  91. $iptables -t mangle -F
  92.  
  93. $iptables -A INPUT -i wlan0 -j ACCEPT
  94. $iptables -A INPUT -i eth1 -j ACCEPT
  95.  
  96. $ip route add $LOCAL_NET2 via 172.29.2.5
  97. $ip route add $LOCAL_NET3 via 172.29.2.5
  98.  
  99. #ip firewall address-list \
  100. #add address=bt.t-ru.org comment=bt list=RuTracker \
  101. #add address=bt2.t-ru.org comment=bt2 list=RuTracker \
  102. #add address=bt3.t-ru.org comment=bt3 list=RuTracker \
  103. #add address=bt4.t-ru.org comment=bt4 list=RuTracker
  104.  
  105. #ip firewall nat add chain=dstnat action=dst-nat to-addresses=px1.blockme.site to-ports=3128 protocol=tcp src-address=172.29.2.3 dst-address-list=RuTracker dst-port=80 log=no log-prefix=""
  106.  
  107. #$iptables -A FORWARD -s 172.29.2.248 -j DROP
  108. #$iptables -A FORWARD -d 172.29.2.248 -j DROP
  109.  
  110. #$iptables -A FORWARD -s 172.29.2.241 -j DROP
  111. #$iptables -A FORWARD -d 172.29.2.241 -j DROP
  112.  
  113. #$iptables -A FORWARD -s 172.29.2.242 -j DROP
  114. #$iptables -A FORWARD -d 172.29.2.242 -j DROP
  115.  
  116. #$iptables -A INPUT -p tcp -i ppp0 -d 178.248.233.4 --dport 80 -j DROP
  117. $iptables -A INPUT -i eth0 -p tcp --dport 139 -j DROP
  118. $iptables -A INPUT -i eth0 -p tcp --dport 445 -j DROP
  119. $iptables -A INPUT -i eth0 -p tcp --dport 443 -j ACCEPT
  120. $iptables -A INPUT -i eth0 -p udp --dport 443 -j ACCEPT
  121. $iptables -A OUTPUT -i eth0 -p tcp --sport 443 -j ACCEPT
  122. $iptables -A OUTPUT -i eth0 -p udp --sport 443 -j ACCEPT
  123. $iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
  124. #$iptables -A INPUT -i eth0 -p udp --dport 80 -j ACCEPT
  125.  
  126. #$iptables -A INPUT -i eth1 -s 172.29.2.12 -p tcp --dport 139 -j DROP
  127. #$iptables -A INPUT -i eth1 -s 172.29.2.12 -p tcp --dport 445 -j DROP
  128.  
  129. $iptables -A INPUT -s $LOCAL_NET2 -j ACCEPT
  130. $iptables -A INPUT -d $LOCAL_NET2 -j ACCEPT
  131. $iptables -A OUTPUT -s $LOCAL_NET2 -j ACCEPT
  132. $iptables -A OUTPUT -d $LOCAL_NET2 -j ACCEPT
  133. #$iptables -A INPUT -s 172.29.4.0/24 -d 172.29.2.3 -p tcp --dport 3389 -j ACCEPT
  134. #$iptables -A INPUT -s 172.29.4.0/24 -d 172.29.2.3 -p tcp --dport 3390 -j ACCEPT
  135. #$iptables -A INPUT -s 172.29.4.0/24 -d $LOCAL_NET -j ACCEPT
  136.  
  137. #$iptables -A INPUT -p tcp --destination-port 6882 -j ACCEPT
  138. #$iptables -A OUTPUT -p tcp --destination-port 6882 -j ACCEPT
  139. #$iptables -A INPUT -p tcp --destination-port 6882 -j ACCEPT
  140. #$iptables -A OUTPUT -p tcp --destination-port 6882 -j ACCEPT
  141.  
  142.  
  143. $iptables -A INPUT -p udp --destination-port 16881 -j ACCEPT
  144. $iptables -A OUTPUT -p udp --destination-port 16881 -j ACCEPT
  145. $iptables -A INPUT -p udp --source-port 6881 -j ACCEPT
  146. $iptables -A OUTPUT -p udp --source-port 6881 -j ACCEPT
  147. $iptables -A INPUT -p udp --source-port 6882 -j ACCEPT
  148. $iptables -A OUTPUT -p udp --source-port 6882 -j ACCEPT
  149. $iptables -A INPUT -p udp --source-port 6883 -j ACCEPT
  150. $iptables -A OUTPUT -p udp --source-port 6883 -j ACCEPT
  151.  
  152. #$iptables -A INPUT -p udp --destination-port 1701 -j ACCEPT
  153. #$iptables -A INPUT -p tcp --destination-port 1701 -j ACCEPT
  154.  
  155. #$iptables -A INPUT -p tcp --destination-port 8080 -j ACCEPT
  156. #$iptables -A INPUT -p udp --destination-port 8080 -j ACCEPT
  157. $iptables -A INPUT -p tcp --destination-port 80 -j ACCEPT
  158. #$iptables -A INPUT -p udp --destination-port 80 -j ACCEPT
  159. $iptables -A INPUT -p tcp --destination-port 443 -j ACCEPT
  160. #$iptables -A INPUT -p udp --destination-port 443 -j ACCEPT
  161. $iptables -A OUTPUT -p tcp --source-port 443 -j ACCEPT
  162. #$iptables -A OUTPUT -p udp --source-port 443 -j ACCEPT
  163.  
  164. #$iptables -A INPUT -s 172.29.4.0/24 -d 172.29.2.2/32 -j DROP
  165. #$iptables -A INPUT -s 172.29.4.0/24 -d 172.29.2.5/32 -j DROP
  166. ###$iptables -A INPUT -s 172.29.4.0/24 -d 172.29.2.1/32 -j DROP
  167. #$iptables -A INPUT -s 172.29.4.0/24 -d 172.29.2.3/32 -j DROP
  168. # ban for Helenko
  169. #$iptables -A INPUT -s 172.29.2.23 -d 172.29.2.3 -j DROP
  170. #$iptables -A INPUT -s 172.29.2.3 -d 172.29.2.23 -j DROP
  171. #$iptables -A INPUT -s 172.29.2.35 -d 172.29.2.3 -j DROP
  172. #$iptables -A INPUT -s 172.29.2.3 -d 172.29.2.35 -j DROP
  173.  
  174. # ban for Mama
  175. #echo ban maman
  176. #$iptables -A INPUT -s 172.29.2.128 -j DROP
  177. #$iptables -A INPUT -s 172.29.2.3 -d 172.29.2.128 -j DROP
  178. #echo maman ban
  179.  
  180. #$iptables -A INPUT -s 172.29.2.3 -j DROP
  181. #$iptables -A INPUT -m iprange --src-range 172.29.2.15-172.29.2.224 -j DROP
  182.  
  183. #$iptables -A INPUT -i eth0 -j ACCEPT
  184. #$iptables -A INPUT -i eth0 -s 10.197.77.43 -p tcp --destination-port 23125 -j ACCEPT
  185.  
  186. if [ "$1" = "ban" ]; then
  187. for i in `seq 15 254`; do
  188. # if [[ ( "$i" = "15" ) || ( "$i" = "40" ) || ( "$i" = "48" ) || ( "$i" = "43" ) || ( "$i" = "45" ) ]]; then
  189. # continue
  190. # fi
  191. echo banning 172.29.2.$i
  192. $iptables -A INPUT -s 172.29.2.$i -j DROP
  193. $iptables -A FORWARD -s 172.29.2.$i -j DROP
  194. $iptables -A INPUT -s 172.29.2.3 -d 172.29.2.$i -j DROP
  195. done
  196. fi
  197.  
  198. # $@%#### woman.ru ####%@$
  199. $iptables -A FORWARD -s 172.29.2.2 -p tcp -m string --string "vk.com" --algo kmp -j DROP
  200. #@$iptables -A FORWARD -d 172.29.2.5 -p tcp -m string --string "woman.ru" --algo kmp -j ACCEPT
  201. $iptables -A FORWARD -p tcp -m string --string "blackhole.beeline.ru" --algo kmp -j DROP
  202. $iptables -A FORWARD -s blackhole.beeline.ru -j DROP
  203. $iptables -A FORWARD -d blackhole.beeline.ru -j DROP
  204. $iptables -A FORWARD -s dsp-rambler.ru -j DROP
  205. $iptables -A FORWARD -d dsp-rambler.ru -j DROP
  206. $iptables -A FORWARD -s rt.bongacams11.com -j DROP
  207.  
  208. # $iptables -A INPUT -i eth0 -s 10.197.77.43 -j ACCEPT
  209.  
  210. $iptables -A INPUT -p tcp --destination-port 6962 -j ACCEPT
  211. $iptables -A INPUT -p tcp --destination-port 6982 -j ACCEPT
  212. $iptables -A INPUT -p tcp --destination-port 6899 -j ACCEPT
  213.  
  214. $iptables -A INPUT -p tcp --destination-port 23880 -j ACCEPT
  215. $iptables -A INPUT -i lo -j ACCEPT
  216.  
  217. $iptables -A INPUT -p tcp --syn -m limit --limit 5/h -i eth1 -j ACCEPT
  218.  
  219. $iptables -A INPUT -p tcp --dport 110 -j ACCEPT
  220. $iptables -A INPUT -p tcp --sport 110 -j ACCEPT
  221. $iptables -A INPUT -p tcp --dport 143 -j ACCEPT
  222.  
  223. echo handling icmp packets...
  224. $iptables -A INPUT -p icmp --icmp-type 8 -s 0/0 -d $PPP_IP -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
  225. $iptables -A OUTPUT -p icmp --icmp-type 0 -s $PPP_IP -d 0/0 -m state --state ESTABLISHED,RELATED -j ACCEPT
  226. echo finish handling icmp packets
  227.  
  228. #$iptables -t nat -A PREROUTING -p tcp --dport 23125 -j REDIRECT --to-ports 22
  229.  
  230. #$iptables -t nat -A PREROUTING -p tcp -i eth1 -d $PPP_IP --dport 23125 -j DNAT --to-destination 172.29.2.5:22
  231.  
  232. ##$iptables -A FORWARD -s 172.29.4.0/24 -d 172.29.0.0/16 -j ACCEPT
  233. ##$iptables -A FORWARD -d 172.29.4.0/24 -s 172.29.0.0/16 -j ACCEPT
  234. #$iptables -A INPUT -i tun+ -j ACCEPT
  235. #$iptables -A FORWARD -i tun0 -s 172.29.4.0/24 -j ACCEPT
  236. $iptables -A FORWARD -p tcp -i eth1 -d 172.29.2.5 --dport 22 -j ACCEPT
  237. $iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
  238. #$iptables -t nat -A POSTROUTING -s $LOCAL_NET -j SNAT --to 10.216.1.126
  239.  
  240.  
  241. $iptables -A INPUT -p tcp --destination-port 6667 -j ACCEPT
  242. $iptables -A INPUT -p tcp --destination-port 6668 -j ACCEPT
  243. $iptables -A INPUT -p tcp --destination-port 6669 -j ACCEPT
  244. #$iptables -A INPUT -p tcp --destination-port 80 -j ACCEPT
  245. $iptables -A INPUT -p tcp --destination-port 8443 -j ACCEPT
  246.  
  247. #map_port joybook.metanet 23128 22
  248. #map_port uembox.metanet 23128 3389
  249. #map_port uembox.metanet 5938 5938
  250. map_port metamini.metanet 2010:2020
  251. #map_port joybook.metanet 2010:2020
  252. #map_port metabook.metanet 22575 22575
  253. #map_port metabook.metanet 22381 22381
  254. map_port metabook.metanet 23122 22
  255. map_port blackbox.metanet 23123 22
  256. map_port blackbox.metanet 25 25
  257. #map_port metabook.metanet 143 143
  258. #map_port metabook.metanet 993 993
  259. #map_port blackbox.metanet 80 80
  260. #map_port blackbox.metanet 443 443
  261. map_port blackbox.metanet 6883 6883
  262. map_port blackbox.metanet 6882 6882
  263. map_port metamini.metanet 23125 22
  264.  
  265. #map_port socfpga.metanet 23124 22
  266.  
  267. #map_port blackbox.metanet 2226 22
  268. #map_port_tcp metabook.metanet 28888 3389
  269. #map_port_tcp metamini.metanet 28889 3389
  270. #map_port blackbox.metanet 6881 6881
  271. map_port metabook.metanet 7881 7881
  272. map_port metabook.metanet 8881 8881
  273.  
  274. $iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
  275. $iptables -A INPUT -p udp --dport 500 -j ACCEPT
  276. $iptables -A INPUT -p udp --dport 4500 -j ACCEPT
  277. $iptables -A INPUT -p esp -j ACCEPT
  278. $iptables -A INPUT -p ah -j ACCEPT
  279. map_port ubuntu.metanet 500 500
  280. map_port ubuntu.metanet 4500 4500
  281. map_port ubuntu.metanet 1701 1701
  282. $iptables -t nat -A POSTROUTING -s $LOCAL_NET -o eth0 -m policy --dir out --pol ipsec -j ACCEPT
  283. $iptables -t nat -A POSTROUTING -m policy --pol ipsec --dir out -j ACCEPT
  284. $iptables -t nat -A PREROUTING -i eth1 -p udp -d 194.186.172.221 --dport 500 -j DNAT --to-destination 172.29.2.14
  285. $iptables -t nat -A PREROUTING -i eth1 -p udp -d 194.186.172.221 --dport 4500 -j DNAT --to-destination 172.29.2.14
  286. $iptables -A FORWARD -p udp -d 172.29.2.14 --dport 500 -j ACCEPT
  287. $iptables -A FORWARD -p udp -d 172.29.2.14 --dport 4500 -j ACCEPT
  288. $iptables -t nat -A POSTROUTING -p udp -s 172.29.2.14 --sport 500 -j SNAT --to-source 194.186.172.221
  289. $iptables -t nat -A POSTROUTING -p udp -s 172.29.2.14 --sport 4500 -j SNAT --to-source 194.186.172.221
  290. #iptables -t nat -A POSTROUTING --destination 10.0.0.1/32 -j SNAT --to-source 10.0.0.160
  291. #$iptables -t nat -A INPUT -p udp -s 172.29.2.14 -d 194.186.172.221 -j SNAT --to-source 95.165.96.9
  292. #$iptables -t nat -A POSTROUTING -s 172.29.2.14 -d 194.186.172.221 --protocol TCP -j SNAT --to-source 95.165.96.9
  293.  
  294. #map_port metabook.metanet 6882 6882
  295. #map_port metamini.metanet 6885 6885
  296. #map_port metabook.metanet 56055 56055
  297.  
  298. #map_port joybook.metanet 23880 1194
  299. #map_port joybook.metanet 33890 3389
  300.  
  301. #map_port metamini.metanet 8080 80
  302.  
  303. for arg in "$@"; do
  304. case "${arg}" in
  305. "--sip")
  306. map_port w7.metanet 4443 4443
  307. # map_port w7.metanet 443 443
  308. map_port w7.metanet 3478 3478
  309. map_port w7.metanet 444 444
  310. map_port w7.metanet 67 67
  311. map_port w7.metanet 68 68
  312. map_port w7.metanet 5061 5061
  313. map_port w7.metanet 6891:6901
  314. map_port w7.metanet 6902:65535
  315.  
  316. map_port w7.metanet 3478 3478
  317. map_port w7.metanet 50000:59999
  318. ;;
  319. *)
  320. esac
  321. done
  322. #map_port w7.metanet 3451 3451
  323.  
  324. #map_port w7.metanet 8080 8080
  325. #map_port w7.metanet 5070 5070
  326. #map_port w7.metanet 5071 5071
  327. #map_port w7.metanet 5072 5072
  328. #map_port w7.metanet 5073 5073
  329. #map_port w7.metanet 5075 5075
  330. #map_port w7.metanet 5076 5076
  331. #map_port w7.metanet 5080 5080
  332. #map_port w7.metanet 5061 5061
  333.  
  334. #map_port w7.metanet 5269 5269
  335. #map_port w7.metanet 5061 5061
  336. #map_port w7.metanet 443 443
  337. #map_port w7.metanet 80 80
  338.  
  339. $iptables -A INPUT -p tcp --destination-port 56055 -j ACCEPT
  340. $iptables -A INPUT -p udp --destination-port 56055 -j ACCEPT
  341. $iptables -A INPUT -p udp --destination-port 6882 -j ACCEPT
  342. $iptables -A INPUT -p udp --destination-port 6885 -j ACCEPT
  343. $iptables -A OUTPUT -p udp --source-port 6882 -j ACCEPT
  344.  
  345. #$iptables -t mangle -A PREROUTING -p tcp -d $PPP_IP -m multiport --dports 23880 -j MARK --or-mark 0x12226
  346. #$iptables -t mangle -A PREROUTING -p tcp -d $BEELINE_IP -m multiport --dports 23880 -j MARK --or-mark 0x12226
  347. $iptables -t mangle -A PREROUTING -p tcp -d $BEELINE_IP -m multiport --dports 23123 -j MARK --or-mark 0x12225
  348. $iptables -t mangle -A PREROUTING -p tcp -d $PPP_IP -m multiport --dports 23123 -j MARK --or-mark 0x12225
  349. $iptables -t mangle -A PREROUTING -p tcp -d $PPP_IP -m multiport --dports 23125 -j MARK --or-mark 0x12225
  350. $iptables -t mangle -A PREROUTING -p tcp -d $PPP_IP -m multiport --dports 4422 -j MARK --or-mark 0x12225
  351. $iptables -t filter -A INPUT -m mark --mark 0x10000/0x10000 -j ACCEPT
  352. $iptables -t nat -A PREROUTING -p tcp -m mark --mark 0x12225 -j REDIRECT --to-ports 22
  353. #$iptables -t nat -A PREROUTING -p tcp -m mark --mark 0x12226 -j REDIRECT --to-ports 1194
  354.  
  355. #$iptables -A INPUT -i ppp+ -j LOG
  356. #$iptables -A INPUT -i eth0 -j LOG
  357. #$iptables -A FORWARD -i ppp+ -j LOG
  358. #$iptables -A FORWARD -i eth0 -j LOG
  359.  
  360. $iptables -A INPUT -i eth1 -s $LOCAL_NET -j ACCEPT
  361. $iptables -A INPUT -i eth1 -s $LOCAL_NET2 -j ACCEPT
  362. $iptables -A INPUT -i eth1 -s $LOCAL_NET3 -j ACCEPT
  363. $iptables -A INPUT -i ppp+ -m state --state NEW -j DROP
  364. $iptables -A INPUT -i eth0 -m state --state NEW -j DROP
  365. $iptables -t mangle -A FORWARD -p tcp -s $LOCAL_NET -o ppp+ --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
  366. $iptables -t mangle -A FORWARD -p tcp -s $LOCAL_NET2 -o ppp+ --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
  367. #$iptables -t mangle -A FORWARD -p tcp -s $LOCAL_NET -o ppp+ --tcp-flags SYN,RST SYN -j TCPMSS --set-mss 600
  368.  
  369. if [[ `false` ]]; then
  370. $iptables -t nat -A POSTROUTING -s $LOCAL_NET -o ppp+ -j SNAT --to $PPP_IP
  371. $iptables -t nat -A POSTROUTING -s $LOCAL_NET2 -o ppp+ -j SNAT --to $PPP_IP
  372. $iptables -t nat -A POSTROUTING -s $LOCAL_NET3 -o ppp+ -j SNAT --to $PPP_IP
  373. $iptables -t nat -A POSTROUTING -s $LOCAL_NET -o wlan+ -j MASQUERADE
  374. $iptables -t nat -A POSTROUTING -s $LOCAL_NET2 -o wlan+ -j MASQUERADE
  375. $iptables -t nat -A POSTROUTING -s $LOCAL_NET3 -o wlan+ -j MASQUERADE
  376. else
  377. $iptables -t nat -A POSTROUTING -s $LOCAL_NET -o eth0 -j SNAT --to $PPP_IP
  378. $iptables -t nat -A POSTROUTING -s $LOCAL_NET2 -o eth0 -j SNAT --to $PPP_IP
  379. $iptables -t nat -A POSTROUTING -s $LOCAL_NET3 -o eth0 -j SNAT --to $PPP_IP
  380. $iptables -t nat -A POSTROUTING -s $LOCAL_NET -o wlan+ -j MASQUERADE
  381. $iptables -t nat -A POSTROUTING -s $LOCAL_NET2 -o wlan+ -j MASQUERADE
  382. $iptables -t nat -A POSTROUTING -s $LOCAL_NET3 -o wlan+ -j MASQUERADE
  383. fi
  384.  
  385. #$iptables -t nat -A POSTROUTING -s $LOCAL_NET -j SNAT --to 172.29.4.1
  386. #$iptables -t nat -A POSTROUTING -s $LOCAL_NET -o tun0 -j SNAT --to 172.29.4.1
  387.  
  388. $iptables -t nat -A POSTROUTING -d $LOCAL_NET3 -j ACCEPT
  389. $iptables -t nat -A POSTROUTING -s $LOCAL_NET3 -j ACCEPT
  390. $iptables -t nat -A POSTROUTING -s $LOCAL_NET -d $LOCAL_NET2 -j ACCEPT
  391. #$iptables -t nat -A POSTROUTING -s $LOCAL_NET -d $LOCAL_NET2 -j SNAT --to 172.29.4.1
  392. $iptables -t nat -A POSTROUTING -d $LOCAL_NET -j ACCEPT
  393. $iptables -t nat -A POSTROUTING -d $LOCAL_NET2 -j ACCEPT
  394. $iptables -t nat -A POSTROUTING -s $LOCAL_NET2 -j ACCEPT
  395. $iptables -t nat -A POSTROUTING -s $LOCAL_NET -o eth0 -j SNAT --to ${BEELINE_IP}
  396. $iptables -t nat -A POSTROUTING -s $LOCAL_NET2 -o eth0 -j SNAT --to ${BEELINE_IP}
  397. #$iptables -t nat -A POSTROUTING -s $LOCAL_NET -o eth0 -j SNAT --to 10.216.1.126
  398.  
  399. echo -n "1" > /proc/sys/net/ipv4/ip_forward
  400. echo -n "1" > /proc/sys/net/ipv4/ip_dynaddr
  401.  
  402. #$ip route add 172.29.4.0/24 via 172.29.2.14
  403. #$ip route add 172.29.2.101/32 via 172.29.2.2
  404.  
  405. #$route add default gw $REMOTE_PPP_IP
  406. #$route add default gw 172.29.4.1 dev wlan0 metric 1
  407.  
  408. #$ip route add 172.29.4.0/24 via 172.29.2.2
  409.  
  410. $iptables -I INPUT -p tcp --sport 443 --tcp-flags RST RST -j DROP
  411. echo 128 > /proc/sys/net/ipv4/ip_default_ttl
  412. exit 0
  413.  
Advertisement
Add Comment
Please, Sign In to add comment