Advertisement
Guest User

Untitled

a guest
May 7th, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. fwcmd="/sbin/ipfw -q add"
  4. fw="/sbin/ipfw -q"
  5. flush=`${fw} -f flush`
  6. flush_table=`${fw} table all flush`
  7. flush_pipe=`${fw} pipe flush`
  8. flush_nat=`${fw} -f nat flush`
  9. local_if="bce0"
  10. global_if="bce1"
  11. uaix_if="bce1.32"
  12. world_if="bce1.31"
  13. local_ip="10.10.10.10"
  14. global_ip="xxx.xxx.206.1"
  15. netall="10.10.0.0/16"
  16. realip="xxx.xxx.206.10"
  17. unisoft_if="bce1.36"
  18.  
  19. ${flush}
  20. ${flush_table}
  21. ${flush_pipe}
  22. ${flush_nat}
  23.  
  24.  
  25.  
  26. ${fwcmd} 5 allow ip from any 179 to any
  27. ${fwcmd} 5 allow ip from any to any 179
  28. #nata
  29.  
  30.  
  31. ${fw} nat 10 config ip ${realip} log same_ports
  32.  
  33. ${fwcmd} 10 nat 10 ip from ${netall} to any
  34. ${fwcmd} 11 nat 10 ip from any to ${realip}
  35.  
  36. ${fwcmd} 71 allow all from any to any via lo0
  37. ${fwcmd} 72 allow icmp from any to any icmptypes 0,8,11
  38.  
  39.  
  40. ${fwcmd} 74 deny ip from any to me dst-port 22 via ${uaix_if}
  41. ${fwcmd} 74 deny ip from any to me dst-port 22 via ${world_if}
  42. ${fwcmd} 74 deny ip from any to me dst-port 22 via ${unisoft_if}
  43.  
  44.  
  45.  
  46.  
  47. #trusted ips
  48. ${fw} table 14 add xxx.xxx.206.50
  49. .....
  50.  
  51. #real ips
  52. ${fw} table 15 add xxx.xxx.0.1
  53. ....
  54.  
  55. #spamers
  56. ${fw} table 16 add xxx.xxx.207.19
  57. ....
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. ${fwcmd} 99 deny tcp from table\(16\) to any 25 via bce0
  65.  
  66. ${fwcmd} 100 allow all from any to table\(14\)
  67. ${fwcmd} 110 allow all from table\(14\) to any
  68.  
  69. ${fwcmd} 120 allow all from any to table\(15\)
  70. ${fwcmd} 130 allow all from table\(15\) to any
  71.  
  72. ${fwcmd} 140 deny all from any to me 22
  73.  
  74.  
  75.  
  76. ${fwcmd} 6000 fwd 127.0.0.1,8080 tcp from table\(13\) to not me via ${local_if}
  77. ${fwcmd} 6001 allow all from any http,https,8080 to table\(13\)
  78.  
  79. ${fw} pipe 1002 config mask dst-ip 0xffffffff bw 256kbit/s
  80. ${fw} pipe 1003 config mask src-ip 0xffffffff bw 256kbit/s
  81. ${fw} pipe 1004 config mask dst-ip 0xffffffff bw 512kbit/s
  82. ${fw} pipe 1005 config mask src-ip 0xffffffff bw 512kbit/s
  83. ${fw} pipe 1006 config mask dst-ip 0xffffffff bw 1Mbit/s
  84. ${fw} pipe 1007 config mask src-ip 0xffffffff bw 1Mbit/s
  85. ${fw} pipe 1010 config mask dst-ip 0xffffffff bw 2Mbit/s
  86. ${fw} pipe 1011 config mask src-ip 0xffffffff bw 2Mbit/s
  87. ${fw} pipe 1016 config mask dst-ip 0xffffffff bw 5Mbit/s
  88. ${fw} pipe 1017 config mask src-ip 0xffffffff bw 5Mbit/s
  89. ${fw} pipe 1018 config mask dst-ip 0xffffffff bw 10Mbit/s
  90. ${fw} pipe 1019 config mask src-ip 0xffffffff bw 10Mbit/s
  91. ${fw} pipe 1020 config mask dst-ip 0xffffffff bw 20Mbit/s
  92. ${fw} pipe 1021 config mask src-ip 0xffffffff bw 20Mbit/s
  93. ${fw} pipe 1022 config mask dst-ip 0xffffffff bw 100Mbit/s
  94. ${fw} pipe 1023 config mask src-ip 0xffffffff bw 100Mbit/s
  95.  
  96.  
  97. ${fwcmd} 10004 pipe 1002 ip from any to table\(2\) out
  98. ${fwcmd} 10005 pipe 1003 ip from table\(2\) to any in
  99. ${fwcmd} 10006 allow ip from any to table\(2\)
  100. ${fwcmd} 10007 allow ip from table\(2\) to any
  101.  
  102. ${fwcmd} 10008 pipe 1004 ip from any to table\(3\) out
  103. ${fwcmd} 10009 pipe 1005 ip from table\(3\) to any in
  104. ${fwcmd} 10010 allow ip from any to table\(3\)
  105. ${fwcmd} 10011 allow ip from table\(3\) to any
  106.  
  107. ${fwcmd} 10012 pipe 1006 ip from any to table\(4\) out
  108. ${fwcmd} 10013 pipe 1007 ip from table\(4\) to any in
  109. ${fwcmd} 10014 allow ip from any to table\(4\)
  110. ${fwcmd} 10015 allow ip from table\(4\) to any
  111.  
  112. ${fwcmd} 10020 pipe 1010 ip from any to table\(6\) out
  113. ${fwcmd} 10021 pipe 1011 ip from table\(6\) to any in
  114. ${fwcmd} 10022 allow ip from any to table\(6\)
  115. ${fwcmd} 10023 allow ip from table\(6\) to any
  116.  
  117. ${fwcmd} 10032 pipe 1016 ip from any to table\(9\) out
  118. ${fwcmd} 10033 pipe 1017 ip from table\(9\) to any in
  119. ${fwcmd} 10034 allow ip from any to table\(9\)
  120. ${fwcmd} 10035 allow ip from table\(9\) to any
  121.  
  122. ${fwcmd} 10036 pipe 1018 ip from any to table\(10\) out
  123. ${fwcmd} 10037 pipe 1019 ip from table\(10\) to any in
  124. ${fwcmd} 10038 allow ip from any to table\(10\)
  125. ${fwcmd} 10039 allow ip from table\(10\) to any
  126.  
  127. ${fwcmd} 10040 pipe 1020 ip from any to table\(11\) out
  128. ${fwcmd} 10041 pipe 1021 ip from table\(11\) to any in
  129. ${fwcmd} 10042 allow ip from any to table\(11\)
  130. ${fwcmd} 10043 allow ip from table\(11\) to any
  131.  
  132. ${fwcmd} 10044 pipe 1022 ip from any to table\(12\) out
  133. ${fwcmd} 10045 pipe 1023 ip from table\(12\) to any in
  134. ${fwcmd} 10046 allow ip from any to table\(12\)
  135. ${fwcmd} 10047 allow ip from table\(12\) to any
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement