/
rc.firewall
executable file
·67 lines (51 loc) · 2.01 KB
/
rc.firewall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
. /usr/local/etc/imslu/config.sh
####### IPFW #######
${IPFW} -f flush
${IPFW} -f queue flush
${IPFW} -f pipe flush
${IPFW} -f table all flush
##### External Interface Rules - WAN #####
### NAT ###
# NB: Change "192.168.1" with real IP addresses!
#${IPFW} nat 1 config ip 192.168.1.236
#${IPFW} nat 2 config ip 192.168.1.237
#${IPFW} nat 3 config ip 192.168.1.238
#${IPFW} add 1000 nat tablearg ip from any to table\(15\) recv ${IFACE_EXTERNAL}* in
#${IPFW} table 15 add 192.168.1.236/32 1
#${IPFW} table 15 add 192.168.1.237/32 2
#${IPFW} table 15 add 192.168.1.238/32 3
#${IPFW} add 1100 nat tablearg ip from table\(16\) to any xmit ${IFACE_EXTERNAL}* out
#${IPFW} table 16 add 10.0.0.0/25 1
#${IPFW} table 16 add 10.0.0.128/25 2
#${IPFW} table 16 add 10.0.1.0/25 1
#${IPFW} table 16 add 10.0.1.128/25 2
#${IPFW} table 16 add 10.0.2.0/24 3
### END NAT ###
${IPFW} add 1200 allow ip from any to any via ${IFACE_EXTERNAL}*
##### Internal Interface Rules - LAN #####
${IPFW} add 2001 allow ip from any to me
${IPFW} add 2002 allow ip from me to any
# Incoming packets - download
# High priority for download
# BGP peer - national traffic
${IPFW} add 2100 skipto 2500 ip from table\(11\) to any out
# International traffic
${IPFW} add 2200 pipe tablearg ip from any to table\(3\) out
# ADD HERE kind traffic: three four five ...
# Outgoing packets - upload
# BGP peer - national traffic
${IPFW} add 2300 skipto 2501 ip from any to table\(11\) in
# International traffic
${IPFW} add 2400 pipe tablearg ip from table\(4\) to any in
# ADD HERE kind traffic: three four five ...
# BGP peer - national traffic
${IPFW} add 2500 pipe tablearg ip from any to table\(1\)
${IPFW} add 2501 pipe tablearg ip from table\(2\) to any
secondary() {
### Expired Users ###
${IPFW} add 65499 fwd localhost,3000 tcp from any to any dst-port 80 recv ng*
${IPFW} add 65500 fwd localhost,3000 tcp from any to any dst-port 80 recv ${IFACE_INTERNAL}*
${IPFW} add 65501 allow ip from any to any src-port 80,3000 out
}
sleep 60 && secondary &