หน้า: [1]   ลงล่าง
  พิมพ์  
ผู้เขียน หัวข้อ: รบกวนด้วยครับ..แก้ไข config ของ firewall เพื่อขอรับ item เพราะรักจึงใ้ห้  (อ่าน 1330 ครั้ง)
0 สมาชิก และ 2 บุคคลทั่วไป กำลังดูหัวข้อนี้
Aofzza
สมาชิกร้านอินเตอร์เน็ตรุ่นพี่
****
สมาชิกเว็บเต็มตัว
***

ความดี 55
ออนไลน์ ออนไลน์

เพศ: ชาย
กระทู้: 419

เอาให้ตายไปเลย..พวกหมานำจับ!!


เว็บไซต์
« เมื่อ: พฤศจิกายน 29, 2010, 01:57:21 PM »

พอดีจะขอรับ ไอเทม โครงการเพราะรักจึงให้ พอกดที่จะขอรับ...เว๊ปมันแจ้งบอกว่า..

"* ขออภัยค่ะ ระบบพบว่า IP ที่ท่านใช้ Login ในขณะนี้ไม่ได้อยู่ในร้านที่เป็นสมาชิกของ iCafe Plus"

โทรไปถามที่ GG เค้าแจ้งว่าจะต้องทำการแก้ไข แก้ไข config ของ firewall
http://icafe.gg.in.th/WeLoveWeGive2/faq5.html

ผมไท้แน่ใจครับ ว่าจะต้องแก้ไขยังไงบ้าง เพราะผมทำไม่เป็น ไม่แน่ใจ

จึงอยากรบกวน ผู้ที่เคยแก้ไข ช่วยบอกว่าวิธีแก้ไขด้วยครับ...
บันทึกการเข้า

THE-HUNTER
****
สมาชิกเว็บรุ่นพี่

ความดี 80
ออฟไลน์ ออฟไลน์

กระทู้: 727



« ตอบ #1 เมื่อ: พฤศจิกายน 29, 2010, 11:53:07 PM »

- แนะนำเพิ่เติมนิดนึงครับ ถ้าจะถามปัญหาเกียวกับ Firewall ควรที่จะโพสท์ Firewall ที่ใช้อยู่ทั้งหมดด้วย
บันทึกการเข้า

" ไม่กินเหล้า ไม่สูบบุหรี่ เป็นคนดี มีรถขับ โทรศัพท์ถ่ายรูปได้ "

tanawat47
สมาชิกร้านอินเตอร์เน็ต
***
สมาชิกเว็บ
**

ความดี 26
ออนไลน์ ออนไลน์

กระทู้: 167


« ตอบ #2 เมื่อ: พฤศจิกายน 30, 2010, 01:44:00 AM »

ทางเวปเค้าก็มีทางออกให้นิครับ

สำหรับท่านที่ไม่สามารถแก้ไข Config ของ Linux server ได้เอง ท่านสามารถรับ item จากกิจกรรมเพราะรักจึงให้ได้ที่ http://icafe.gg.in.th:27930/WeLoveWeGive2/
บันทึกการเข้า
Aofzza
สมาชิกร้านอินเตอร์เน็ตรุ่นพี่
****
สมาชิกเว็บเต็มตัว
***

ความดี 55
ออนไลน์ ออนไลน์

เพศ: ชาย
กระทู้: 419

เอาให้ตายไปเลย..พวกหมานำจับ!!


เว็บไซต์
« ตอบ #3 เมื่อ: พฤศจิกายน 30, 2010, 09:30:13 AM »

- แนะนำเพิ่เติมนิดนึงครับ ถ้าจะถามปัญหาเกียวกับ Firewall ควรที่จะโพสท์ Firewall ที่ใช้อยู่ทั้งหมดด้วย
ใช่ตัวนี่หรือเปล่าครับ...
# -------------------------------------------------------------
# Author : Mr.Permpong  Chaorungmethee (Mr.Alexa)
# WebSite : http://www.zealzonecafe.com
# MSN : permpongc@ฮ็อตเมล์.com
# Email : alexa@zealzonecafe.com
#
# Script : Traffic Control for Internet cafe' Business
# Type : 2 WAN (Game 1 Net 1)
#
# -------------------------------------------------------------

My_Local_Net=192.168.0.0/16
My_IP=192.168.0.254
PPP0_Mark=0x8000
PPP1_Mark=0x8001

# -------------------------------------------------------------
# Controls settings
# -------------------------------------------------------------
   echo "1" > /proc/sys/net/ipv4/ip_forward
   echo "1" > /proc/sys/net/ipv4/conf/default/rp_filter
   echo "1" > /proc/sys/kernel/core_uses_pid

# -------------------------------------------------------------
# Flush all the rules in mangle table
# -------------------------------------------------------------
   iptables -t mangle -F

   modprobe ip_nat_ftp
   modprobe ip_tables
   modprobe iptable_nat
   modprobe ipt_conntrack
   modprobe ip_conntrack
   modprobe ip_conntrack_ftp
   modprobe ip_conntrack_irc
   modprobe ip_nat_irc
   modprobe ip_nat_snmp_basic

# -------------------------------------------------------------
# reset the default policies in the filter table.
# -------------------------------------------------------------
   iptables -P INPUT ACCEPT
   iptables -P FORWARD ACCEPT
   iptables -P OUTPUT ACCEPT

# -------------------------------------------------------------
# reset the default policies in the nat table.
# -------------------------------------------------------------
   iptables -t nat -P PREROUTING ACCEPT
   iptables -t nat -P POSTROUTING ACCEPT
   iptables -t nat -P OUTPUT ACCEPT

# -------------------------------------------------------------
# reset the default policies in the mangle table.
# -------------------------------------------------------------
   iptables -t mangle -P PREROUTING ACCEPT
   iptables -t mangle -P POSTROUTING ACCEPT
   iptables -t mangle -P INPUT ACCEPT
   iptables -t mangle -P OUTPUT ACCEPT
   iptables -t mangle -P FORWARD ACCEPT

# -------------------------------------------------------------
# CANCEL OLD IP MASQUERADE
# -------------------------------------------------------------
   # iptables -t nat -D POSTROUTING -o eth+ -j MASQUERADE > /dev/null
   iptables -t nat -D POSTROUTING -s $My_Local_Net -o ppp0 -j MASQUERADE > /dev/null
   iptables -t nat -D POSTROUTING -s $My_Local_Net -o ppp1 -j MASQUERADE > /dev/null
   iptables -t nat -D POSTROUTING -s $My_Local_Net -o ppp2 -j MASQUERADE > /dev/null

# -------------------------------------------------------------
# MAKE NEW IP MASQUERADE
# -------------------------------------------------------------
   # iptables -t nat -A POSTROUTING -o eth+ -j MASQUERADE
   iptables -t nat -A POSTROUTING -s $My_Local_Net -o ppp0 -j MASQUERADE
   iptables -t nat -A POSTROUTING -s $My_Local_Net -o ppp1 -j MASQUERADE
   iptables -t nat -A POSTROUTING -s $My_Local_Net -o ppp2 -j MASQUERADE

# ----- Squid
   if [ -f /var/run/squid.pid ]; then
      iptables -t nat -I PREROUTING -p tcp -m multiport --dports 80,5977 -j REDIRECT --to-port 3128

      # CSO
      iptables -t nat -I PREROUTING -p tcp -d 202.43.33.0/24 --dport 9898 -j REDIRECT --to-port 3128

      # Transparent Mode
      iptables -t filter -A INPUT -i eth1 -p tcp -m multiport --destination-port 80,5977,9898 -j ACCEPT
      iptables -t filter -A OUTPUT -o eth1 -p tcp -m multiport --destination-port 80,5977,9898 -j ACCEPT

      # SealOnline's Game Guard
      iptables -t nat -I PREROUTING -p tcp -d 61.47.39.89 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 61.47.39.88 --dport 80 -j ACCEPT

      # SF's Game Guard
      iptables -t nat -I PREROUTING -p tcp -d 61.90.203.4 --dport 80 -j ACCEPT

      # Pangya
      iptables -t nat -I PREROUTING -p tcp -d 58.64.24.163/24 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 164.115.2.134/24 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 203.195.98.6/24 --dport 80 -j ACCEPT

      # DotA
      iptables -t nat -I PREROUTING -p tcp -d 210.86.182.252/24 --dport 80 -j ACCEPT

      # Laghaim
      iptables -t nat -I PREROUTING -p tcp -d 61.90.198.122 --dport 80 -j ACCEPT

      # LastChaos
      iptables -t nat -I PREROUTING -p tcp -d 61.90.198.99/24 --dport 80 -j ACCEPT

      # RAN
      iptables -t nat -I PREROUTING -p tcp -d 202.142.207.240 --dport 80 -j ACCEPT

      # ฮ็อตเมล์
      iptables -t nat -I PREROUTING -p tcp -d 207.46.9.121/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 65.55.113.23/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 64.62.193.48/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 8.12.221.126/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 206.33.55.125/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 12.129.210.41/16 --dport 80 -j ACCEPT
   fi

# ----- Frox
   if [ -f /var/run/frox.pid ]; then
      iptables -t nat -I PREROUTING -p tcp --dport 21 -j REDIRECT --to-port 2121

      # HipStreet for Frox
      iptables -t nat -I PREROUTING -p tcp -d 58.97.46.0/24 --dport 8021 -j REDIRECT --to-port 2121

      # Transparent Mode
      iptables -t filter -A INPUT -i eth1 -p tcp -m multiport --destination-port 21,8021 -j ACCEPT
      iptables -t filter -A OUTPUT -o eth1 -p tcp -m multiport --destination-port 21,8021 -j ACCEPT
   fi

# #########################################################
#                  - START -   multi wan 2 Line                      #
# #########################################################

# ----------------------------NOTE---------------------------------
# PPP0 = 0x8000 / PPP1 = 0x8001/ PPP2 = 0x8002

# ----------Create our own CHAINS----------
   # ----- Create GOTO_GAME
      iptables -t mangle -N GOTO_GAME
      iptables -t mangle -F GOTO_GAME
      iptables -t mangle -A GOTO_GAME -j MARK --set-mark $PPP0_Mark
      iptables -t mangle -A GOTO_GAME -j ACCEPT

   # ----- Create CHECK_STREAMING_WEBS
      iptables -t mangle -N CHECK_STREAMING_WEBS
      iptables -t mangle -F CHECK_STREAMING_WEBS
      # Zheza.com
         iptables -t mangle -A CHECK_STREAMING_WEBS -d 202.142.207.140 -j ACCEPT

   # ----- Create CHECK_SERVICE_PORTS
      iptables -t mangle -N CHECK_SERVICE_PORTS
      iptables -t mangle -F CHECK_SERVICE_PORTS
      iptables -t mangle -A CHECK_SERVICE_PORTS -p tcp -m multiport --dports 20:25,80,443,554,1863,5050,5190,3128,3130,8080,9099,16667 -j ACCEPT
      iptables -t mangle -A CHECK_SERVICE_PORTS -p tcp -m multiport --dports 1863,6667,2009,2121,5977,6969,6889,8000,8021,9898 -j ACCEPT
      iptables -t mangle -A CHECK_SERVICE_PORTS -p udp -m multiport --dports 20:25,80,443,554,1863,5050,5190,3128,3130,8080,9099,16667 -j ACCEPT
      iptables -t mangle -A CHECK_SERVICE_PORTS -p udp -m multiport --dports 1863,6667,2009,2121,5977,6969,6889,8000,8021,9898 -j ACCEPT
      # Dns
      iptables -t mangle -A CHECK_SERVICE_PORTS -p tcp --destination-port 53 -j ACCEPT
      iptables -t mangle -A CHECK_SERVICE_PORTS -p udp --destination-port 53 -j ACCEPT

   # ----- Create CHECK_IPP2P
      iptables -t mangle -N CHECK_IPP2P
      iptables -t mangle -F CHECK_IPP2P
      iptables -t mangle -A CHECK_IPP2P -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT

   # ----- Create CHECK_GAMES
      iptables -t mangle -N CHECK_GAMES
      iptables -t mangle -F CHECK_GAMES
      # Abnormal game ports. CSO/Lineage2, check port of game patching. If so, using LoadBalance.
         # CSO
         iptables -t mangle -A CHECK_GAMES -d 202.43.33.0/24 -p tcp --dport 9898 -j ACCEPT
         # LN2
         iptables -t mangle -A CHECK_GAMES -d 61.90.199.6/32 -p tcp --dport 2009 -j ACCEPT
         # Cabal patching?
#         iptables -t mangle -A CHECK_GAMES -d 203.144.132.139/32 -p tcp --dport 6889 -j ACCEPT
         iptables -t mangle -A CHECK_GAMES -d 203.144.132.0/24 -p tcp --dport 6969 -j ACCEPT
         # SF's game guard?
#         iptables -t mangle -A CHECK_GAMES -d 61.78.35.29 -p tcp --dport 6060 -j ACCEPT
      # Audition Korean
         iptables -t mangle -A CHECK_GAMES -d 210.118.53.0/24 -j GOTO_GAME
      # Asiasoft
         iptables -t mangle -A CHECK_GAMES -d 203.144.0.0/16 -j GOTO_GAME
      # N-age, and <unknown games>
#         iptables -t mangle -A CHECK_GAMES -d 203.146.0.0/16 -j GOTO_GAME
      # Asiasoft International, SF,LN2
         iptables -t mangle -A CHECK_GAMES -d 61.90.0.0/16 -j GOTO_GAME
      # ProjectOne, DOMO
#         iptables -t mangle -A CHECK_GAMES -d 61.19.0.0/16 -j GOTO_GAME
      # RacyCity
         iptables -t mangle -A CHECK_GAMES -d 61.19.242.0/24 -j GOTO_GAME
      # Seal, HY, 3Kingdoms, 16, PVP
         iptables -t mangle -A CHECK_GAMES -d 61.47.0.0/16 -j GOTO_GAME
      # PFW, Eco
         iptables -t mangle -A CHECK_GAMES -d 61.91.0.0/16 -j GOTO_GAME
      # HipStreet
         iptables -t mangle -A CHECK_GAMES -d 58.97.46.10/32 -j GOTO_GAME
         iptables -t mangle -A CHECK_GAMES -d 58.97.46.16/32 -j GOTO_GAME
      # Pangya, Rebirth, Pucca, Flyff
         iptables -t mangle -A CHECK_GAMES -d 58.64.0.0/16 -j GOTO_GAME
      # DotA, Getamped
         iptables -t mangle -A CHECK_GAMES -d 210.86.0.0/16 -j GOTO_GAME
      # LunaOnline, pko, water, SDO, Secret, RYL
         iptables -t mangle -A CHECK_GAMES -d 202.43.0.0/16 -j GOTO_GAME
      # RAN
         iptables -t mangle -A CHECK_GAMES -d 202.142.207.0/24 -j GOTO_GAME
      # TalesRunner
         iptables -t mangle -A CHECK_GAMES -d 203.113.0.0/16 -j GOTO_GAME
      # GG
         iptables -t mangle -A CHECK_GAMES -d 74.55.122.70/24 -j GOTO_GAME
#         iptables -t mangle -A CHECK_GAMES -d 74.55.122.70:8687 -j GOTO_GAME
#         iptables -t mangle -A CHECK_GAMES -d 74.53.215.8:7456 -j GOTO_GAME
      # NosTale
         iptables -t mangle -A CHECK_GAMES -d 203.121.165.196/24 -j GOTO_GAME
   # ----- Create CHECK_BONUS
      iptables -t mangle -N CHECK_BONUS
      iptables -t mangle -F CHECK_BONUS
      iptables -t mangle -A CHECK_BONUS -d secure1.asiasoft.co.th -p tcp -m multiport --dports 443 -j GOTO_GAME
      iptables -t mangle -A CHECK_BONUS -d secure2.asiasoft.co.th -p tcp -m multiport --dports 443 -j GOTO_GAME

# ----- ----- ----- ----- ----- ----- ----- ----- #
# ----- Load Balance
# ----- ----- ----- ----- ----- ----- ----- ----- #
   # ----- Check all ppp interfaces
      PPP0=`/sbin/ifconfig | grep "ppp0"`
      PPP1=`/sbin/ifconfig | grep "ppp1"`

      ppp0=0;ppp1=0;ppp2=0;

      if [ -n "$PPP0" ]; then
         ppp0=1
      else
         ppp0=0
      fi

      if [ -n "$PPP1" ]; then
         ppp1=1
      else
         ppp1=0
      fi

      LBStatus=$ppp0$ppp1

   # ----- Get PPP and Gateway Address
      ppp0_addr=`ifconfig | grep -A1 ppp0 | tail -1 | cut -d : -f 2 | cut -f 1 -d " "`
      ppp1_addr=`ifconfig | grep -A1 ppp1 | tail -1 | cut -d : -f 2 | cut -f 1 -d " "`

      ppp0_gw=`ip route | grep ppp0 | head -1 | cut -f 1 -d " "`
      ppp1_gw=`ip route | grep ppp1 | head -1 | cut -f 1 -d " "`

   # ----- check status before setting LoadBalance
      if [ $LBStatus -eq 11 ]; then
         iptables -t mangle -F GOTO_GAME
         iptables -t mangle -A GOTO_GAME -j MARK --set-mark $PPP0_Mark
         iptables -t mangle -A GOTO_GAME -j ACCEPT
         ip route replace default table 250 proto static nexthop via $ppp1_gw dev ppp1 weight 200
      elif [ $LBStatus -eq 10 ]; then
         iptables -t mangle -F GOTO_GAME
         iptables -t mangle -A GOTO_GAME -j MARK --set-mark $PPP0_Mark
         iptables -t mangle -A GOTO_GAME -j ACCEPT
         ip route replace default table 250 proto static nexthop via $ppp0_gw dev ppp0 weight 200
      elif [ $LBStatus -eq 01 ]; then
         iptables -t mangle -F GOTO_GAME
         iptables -t mangle -A GOTO_GAME -j MARK --set-mark $PPP1_Mark
         iptables -t mangle -A GOTO_GAME -j ACCEPT
         ip route replace default table 250 proto static nexthop via $ppp1_gw dev ppp1 weight 200
      fi

# ----------START rule adding----------
   # Firstly, Allow to add IP-Bonus via ppp0
      iptables -t mangle -A PREROUTING -p tcp -s $My_Local_Net -j CHECK_BONUS

   # ipp2p
      iptables -t mangle -A PREROUTING -s $My_IP -j CHECK_IPP2P
      iptables -t mangle -A OUTPUT -s $My_IP -j CHECK_IPP2P
      iptables -t mangle -A FORWARD -s $My_IP -j CHECK_IPP2P

      iptables -t mangle -A PREROUTING -d $My_IP -j CHECK_IPP2P
      iptables -t mangle -A OUTPUT -d $My_IP -j CHECK_IPP2P
      iptables -t mangle -A FORWARD -d $My_IP -j CHECK_IPP2P

   # Service Ports
      iptables -t mangle -A PREROUTING -j CHECK_SERVICE_PORTS
      iptables -t mangle -A OUTPUT -j CHECK_SERVICE_PORTS
   #   iptables -t mangle -A FORWARD -j CHECK_SERVICE_PORTS

   # Streaming Webs
      iptables -t mangle -A PREROUTING -j CHECK_STREAMING_WEBS

   # Games
      # PREROUTING
         iptables -t mangle -A PREROUTING -p all -j CHECK_GAMES

   # DotA
      # Create DotA
         iptables -t mangle -A PREROUTING -p tcp -m multiport --sports 7051:7080,7101:7160 -j GOTO_GAME
         iptables -t mangle -A PREROUTING -p udp -m multiport --sports 7051:7080,7101:7160 -j GOTO_GAME
      # Join DotA
         iptables -t mangle -A PREROUTING -p tcp -m multiport --dports 6101:6200,7101:7200 -j GOTO_GAME
         iptables -t mangle -A PREROUTING -p udp -m multiport --dports 6101:6200,7101:7200 -j GOTO_GAME

   # BF2
      iptables -t mangle -A PREROUTING -p tcp --sport 4711 --dport 4711 -j GOTO_GAME

      iptables -t mangle -A PREROUTING -p tcp -m multiport --dports 29900,29901,29920,28910 -j GOTO_GAME
      iptables -t mangle -A PREROUTING -p udp -m multiport --dports 27900,29900,29910,27901,55123:55570,1500:4999,16567:16568 -j GOTO_GAME

   # Allow ipp2p only me
      iptables -t filter -D FORWARD -s $My_IP -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT
      iptables -t filter -I FORWARD -s $My_IP -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT

      iptables -t filter -D FORWARD -d $My_IP -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT
      iptables -t filter -I FORWARD -d $My_IP -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT
   
   # Allow ipp2p for Special Games (FIFA Online 2)
      iptables -t filter -D FORWARD -p all -s 61.91.68.0/24 -j ACCEPT
      iptables -t filter -I FORWARD -p all -s 61.91.68.0/24 -j ACCEPT

      iptables -t filter -D FORWARD -p all -d 61.91.68.0/24 -j ACCEPT
      iptables -t filter -I FORWARD -p all -d 61.91.68.0/24 -j ACCEPT

   # No match, use Load Balance
      iptables -t mangle -A PREROUTING -i eth1 -j ACCEPT

# ----- END rule adding

# #########################################################
#                  - END -      multi wan 2 Line                      #
# #########################################################
บันทึกการเข้า

THE-HUNTER
****
สมาชิกเว็บรุ่นพี่

ความดี 80
ออฟไลน์ ออฟไลน์

กระทู้: 727



« ตอบ #4 เมื่อ: พฤศจิกายน 30, 2010, 11:28:25 AM »

# -------------------------------------------------------------
# Author : Mr.Permpong  Chaorungmethee (Mr.Alexa)
# WebSite : http://www.zealzonecafe.com
# MSN : permpongc@ฮ็อตเมล์.com
# Email : alexa@zealzonecafe.com
#
# Script : Traffic Control for Internet cafe' Business
# Type : 2 WAN (Game 1 Net 1)
#
# -------------------------------------------------------------

My_Local_Net=192.168.0.0/16
My_IP=192.168.0.254
PPP0_Mark=0x8000
PPP1_Mark=0x8001

# -------------------------------------------------------------
# Controls settings
# -------------------------------------------------------------
   echo "1" > /proc/sys/net/ipv4/ip_forward
   echo "1" > /proc/sys/net/ipv4/conf/default/rp_filter
   echo "1" > /proc/sys/kernel/core_uses_pid

# -------------------------------------------------------------
# Flush all the rules in mangle table
# -------------------------------------------------------------
   iptables -t mangle -F

   modprobe ip_nat_ftp
   modprobe ip_tables
   modprobe iptable_nat
   modprobe ipt_conntrack
   modprobe ip_conntrack
   modprobe ip_conntrack_ftp
   modprobe ip_conntrack_irc
   modprobe ip_nat_irc
   modprobe ip_nat_snmp_basic

# -------------------------------------------------------------
# reset the default policies in the filter table.
# -------------------------------------------------------------
   iptables -P INPUT ACCEPT
   iptables -P FORWARD ACCEPT
   iptables -P OUTPUT ACCEPT

# -------------------------------------------------------------
# reset the default policies in the nat table.
# -------------------------------------------------------------
   iptables -t nat -P PREROUTING ACCEPT
   iptables -t nat -P POSTROUTING ACCEPT
   iptables -t nat -P OUTPUT ACCEPT

# -------------------------------------------------------------
# reset the default policies in the mangle table.
# -------------------------------------------------------------
   iptables -t mangle -P PREROUTING ACCEPT
   iptables -t mangle -P POSTROUTING ACCEPT
   iptables -t mangle -P INPUT ACCEPT
   iptables -t mangle -P OUTPUT ACCEPT
   iptables -t mangle -P FORWARD ACCEPT

# -------------------------------------------------------------
# CANCEL OLD IP MASQUERADE
# -------------------------------------------------------------
   # iptables -t nat -D POSTROUTING -o eth+ -j MASQUERADE > /dev/null
   iptables -t nat -D POSTROUTING -s $My_Local_Net -o ppp0 -j MASQUERADE > /dev/null
   iptables -t nat -D POSTROUTING -s $My_Local_Net -o ppp1 -j MASQUERADE > /dev/null
   iptables -t nat -D POSTROUTING -s $My_Local_Net -o ppp2 -j MASQUERADE > /dev/null

# -------------------------------------------------------------
# MAKE NEW IP MASQUERADE
# -------------------------------------------------------------
   # iptables -t nat -A POSTROUTING -o eth+ -j MASQUERADE
   iptables -t nat -A POSTROUTING -s $My_Local_Net -o ppp0 -j MASQUERADE
   iptables -t nat -A POSTROUTING -s $My_Local_Net -o ppp1 -j MASQUERADE
   iptables -t nat -A POSTROUTING -s $My_Local_Net -o ppp2 -j MASQUERADE

# ----- Squid
   if [ -f /var/run/squid.pid ]; then
      iptables -t nat -I PREROUTING -p tcp -m multiport --dports 80,5977 -j REDIRECT --to-port 3128

      # CSO
      iptables -t nat -I PREROUTING -p tcp -d 202.43.33.0/24 --dport 9898 -j REDIRECT --to-port 3128

      # Transparent Mode
      iptables -t filter -A INPUT -i eth1 -p tcp -m multiport --destination-port 80,5977,9898 -j ACCEPT
      iptables -t filter -A OUTPUT -o eth1 -p tcp -m multiport --destination-port 80,5977,9898 -j ACCEPT

      # SealOnline's Game Guard
      iptables -t nat -I PREROUTING -p tcp -d 61.47.39.89 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 61.47.39.88 --dport 80 -j ACCEPT

      # SF's Game Guard
      iptables -t nat -I PREROUTING -p tcp -d 61.90.203.4 --dport 80 -j ACCEPT

      # Pangya
      iptables -t nat -I PREROUTING -p tcp -d 58.64.24.163/24 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 164.115.2.134/24 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 203.195.98.6/24 --dport 80 -j ACCEPT

      # DotA
      iptables -t nat -I PREROUTING -p tcp -d 210.86.182.252/24 --dport 80 -j ACCEPT

      # Laghaim
      iptables -t nat -I PREROUTING -p tcp -d 61.90.198.122 --dport 80 -j ACCEPT

      # LastChaos
      iptables -t nat -I PREROUTING -p tcp -d 61.90.198.99/24 --dport 80 -j ACCEPT

      # RAN
      iptables -t nat -I PREROUTING -p tcp -d 202.142.207.240 --dport 80 -j ACCEPT

      # ฮ็อตเมล์
      iptables -t nat -I PREROUTING -p tcp -d 207.46.9.121/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 65.55.113.23/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 64.62.193.48/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 8.12.221.126/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 206.33.55.125/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 12.129.210.41/16 --dport 80 -j ACCEPT

      # item icafe #
      iptables -t nat -I PREROUTING -p tcp -d icafe.gg.in.th --dport 80 -j ACCEPT

   fi

# ----- Frox
   if [ -f /var/run/frox.pid ]; then
      iptables -t nat -I PREROUTING -p tcp --dport 21 -j REDIRECT --to-port 2121

      # HipStreet for Frox
      iptables -t nat -I PREROUTING -p tcp -d 58.97.46.0/24 --dport 8021 -j REDIRECT --to-port 2121

      # Transparent Mode
      iptables -t filter -A INPUT -i eth1 -p tcp -m multiport --destination-port 21,8021 -j ACCEPT
      iptables -t filter -A OUTPUT -o eth1 -p tcp -m multiport --destination-port 21,8021 -j ACCEPT
   fi

# #########################################################
#                  - START -   multi wan 2 Line                      #
# #########################################################

# ----------------------------NOTE---------------------------------
# PPP0 = 0x8000 / PPP1 = 0x8001/ PPP2 = 0x8002

# ----------Create our own CHAINS----------
   # ----- Create GOTO_GAME
      iptables -t mangle -N GOTO_GAME
      iptables -t mangle -F GOTO_GAME
      iptables -t mangle -A GOTO_GAME -j MARK --set-mark $PPP0_Mark
      iptables -t mangle -A GOTO_GAME -j ACCEPT

   # ----- Create CHECK_STREAMING_WEBS
      iptables -t mangle -N CHECK_STREAMING_WEBS
      iptables -t mangle -F CHECK_STREAMING_WEBS
      # Zheza.com
         iptables -t mangle -A CHECK_STREAMING_WEBS -d 202.142.207.140 -j ACCEPT
   
   # ----- Create CHECK_SERVICE_PORTS
      iptables -t mangle -N CHECK_SERVICE_PORTS
      iptables -t mangle -F CHECK_SERVICE_PORTS
      iptables -t mangle -A CHECK_SERVICE_PORTS -p tcp -m multiport --dports 20:25,80,443,554,1863,5050,5190,3128,3130,8080,9099,16667 -j ACCEPT
      iptables -t mangle -A CHECK_SERVICE_PORTS -p tcp -m multiport --dports 1863,6667,2009,2121,5977,6969,6889,8000,8021,9898 -j ACCEPT
      iptables -t mangle -A CHECK_SERVICE_PORTS -p udp -m multiport --dports 20:25,80,443,554,1863,5050,5190,3128,3130,8080,9099,16667 -j ACCEPT
      iptables -t mangle -A CHECK_SERVICE_PORTS -p udp -m multiport --dports 1863,6667,2009,2121,5977,6969,6889,8000,8021,9898 -j ACCEPT
      # Dns
      iptables -t mangle -A CHECK_SERVICE_PORTS -p tcp --destination-port 53 -j ACCEPT
      iptables -t mangle -A CHECK_SERVICE_PORTS -p udp --destination-port 53 -j ACCEPT

   # ----- Create CHECK_IPP2P
      iptables -t mangle -N CHECK_IPP2P
      iptables -t mangle -F CHECK_IPP2P
      iptables -t mangle -A CHECK_IPP2P -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT

   # ----- Create CHECK_GAMES
      iptables -t mangle -N CHECK_GAMES
      iptables -t mangle -F CHECK_GAMES
      # Abnormal game ports. CSO/Lineage2, check port of game patching. If so, using LoadBalance.
         # CSO
         iptables -t mangle -A CHECK_GAMES -d 202.43.33.0/24 -p tcp --dport 9898 -j ACCEPT
         # LN2
         iptables -t mangle -A CHECK_GAMES -d 61.90.199.6/32 -p tcp --dport 2009 -j ACCEPT
         # Cabal patching?
#         iptables -t mangle -A CHECK_GAMES -d 203.144.132.139/32 -p tcp --dport 6889 -j ACCEPT
         iptables -t mangle -A CHECK_GAMES -d 203.144.132.0/24 -p tcp --dport 6969 -j ACCEPT
         # SF's game guard?
#         iptables -t mangle -A CHECK_GAMES -d 61.78.35.29 -p tcp --dport 6060 -j ACCEPT
      # Audition Korean
         iptables -t mangle -A CHECK_GAMES -d 210.118.53.0/24 -j GOTO_GAME
      # Asiasoft
         iptables -t mangle -A CHECK_GAMES -d 203.144.0.0/16 -j GOTO_GAME
      # N-age, and <unknown games>
#         iptables -t mangle -A CHECK_GAMES -d 203.146.0.0/16 -j GOTO_GAME
      # Asiasoft International, SF,LN2
         iptables -t mangle -A CHECK_GAMES -d 61.90.0.0/16 -j GOTO_GAME
      # ProjectOne, DOMO
#         iptables -t mangle -A CHECK_GAMES -d 61.19.0.0/16 -j GOTO_GAME
      # RacyCity
         iptables -t mangle -A CHECK_GAMES -d 61.19.242.0/24 -j GOTO_GAME
      # Seal, HY, 3Kingdoms, 16, PVP
         iptables -t mangle -A CHECK_GAMES -d 61.47.0.0/16 -j GOTO_GAME
      # PFW, Eco
         iptables -t mangle -A CHECK_GAMES -d 61.91.0.0/16 -j GOTO_GAME
      # HipStreet
         iptables -t mangle -A CHECK_GAMES -d 58.97.46.10/32 -j GOTO_GAME
         iptables -t mangle -A CHECK_GAMES -d 58.97.46.16/32 -j GOTO_GAME
      # Pangya, Rebirth, Pucca, Flyff
         iptables -t mangle -A CHECK_GAMES -d 58.64.0.0/16 -j GOTO_GAME
      # DotA, Getamped
         iptables -t mangle -A CHECK_GAMES -d 210.86.0.0/16 -j GOTO_GAME
      # LunaOnline, pko, water, SDO, Secret, RYL
         iptables -t mangle -A CHECK_GAMES -d 202.43.0.0/16 -j GOTO_GAME
      # RAN
         iptables -t mangle -A CHECK_GAMES -d 202.142.207.0/24 -j GOTO_GAME
      # TalesRunner
         iptables -t mangle -A CHECK_GAMES -d 203.113.0.0/16 -j GOTO_GAME
      # GG
         iptables -t mangle -A CHECK_GAMES -d 74.55.122.70/24 -j GOTO_GAME
#         iptables -t mangle -A CHECK_GAMES -d 74.55.122.70:8687 -j GOTO_GAME
#         iptables -t mangle -A CHECK_GAMES -d 74.53.215.8:7456 -j GOTO_GAME
      # NosTale
         iptables -t mangle -A CHECK_GAMES -d 203.121.165.196/24 -j GOTO_GAME
   # ----- Create CHECK_BONUS
      iptables -t mangle -N CHECK_BONUS
      iptables -t mangle -F CHECK_BONUS
      iptables -t mangle -A CHECK_BONUS -d secure1.asiasoft.co.th -p tcp -m multiport --dports 443 -j GOTO_GAME
      iptables -t mangle -A CHECK_BONUS -d secure2.asiasoft.co.th -p tcp -m multiport --dports 443 -j GOTO_GAME

      # item icafe #
      iptables -t mangle -A CHECK_BONUS -d icafe.gg.in.th -j GOTO_GAME


# ----- ----- ----- ----- ----- ----- ----- ----- #
# ----- Load Balance
# ----- ----- ----- ----- ----- ----- ----- ----- #
   # ----- Check all ppp interfaces
      PPP0=`/sbin/ifconfig | grep "ppp0"`
      PPP1=`/sbin/ifconfig | grep "ppp1"`

      ppp0=0;ppp1=0;ppp2=0;

      if [ -n "$PPP0" ]; then
         ppp0=1
      else
         ppp0=0
      fi

      if [ -n "$PPP1" ]; then
         ppp1=1
      else
         ppp1=0
      fi

      LBStatus=$ppp0$ppp1

   # ----- Get PPP and Gateway Address
      ppp0_addr=`ifconfig | grep -A1 ppp0 | tail -1 | cut -d : -f 2 | cut -f 1 -d " "`
      ppp1_addr=`ifconfig | grep -A1 ppp1 | tail -1 | cut -d : -f 2 | cut -f 1 -d " "`

      ppp0_gw=`ip route | grep ppp0 | head -1 | cut -f 1 -d " "`
      ppp1_gw=`ip route | grep ppp1 | head -1 | cut -f 1 -d " "`

   # ----- check status before setting LoadBalance
      if [ $LBStatus -eq 11 ]; then
         iptables -t mangle -F GOTO_GAME
         iptables -t mangle -A GOTO_GAME -j MARK --set-mark $PPP0_Mark
         iptables -t mangle -A GOTO_GAME -j ACCEPT
         ip route replace default table 250 proto static nexthop via $ppp1_gw dev ppp1 weight 200
      elif [ $LBStatus -eq 10 ]; then
         iptables -t mangle -F GOTO_GAME
         iptables -t mangle -A GOTO_GAME -j MARK --set-mark $PPP0_Mark
         iptables -t mangle -A GOTO_GAME -j ACCEPT
         ip route replace default table 250 proto static nexthop via $ppp0_gw dev ppp0 weight 200
      elif [ $LBStatus -eq 01 ]; then
         iptables -t mangle -F GOTO_GAME
         iptables -t mangle -A GOTO_GAME -j MARK --set-mark $PPP1_Mark
         iptables -t mangle -A GOTO_GAME -j ACCEPT
         ip route replace default table 250 proto static nexthop via $ppp1_gw dev ppp1 weight 200
      fi

# ----------START rule adding----------
   # Firstly, Allow to add IP-Bonus via ppp0
      iptables -t mangle -A PREROUTING -p tcp -s $My_Local_Net -j CHECK_BONUS

   # ipp2p
      iptables -t mangle -A PREROUTING -s $My_IP -j CHECK_IPP2P
      iptables -t mangle -A OUTPUT -s $My_IP -j CHECK_IPP2P
      iptables -t mangle -A FORWARD -s $My_IP -j CHECK_IPP2P

      iptables -t mangle -A PREROUTING -d $My_IP -j CHECK_IPP2P
      iptables -t mangle -A OUTPUT -d $My_IP -j CHECK_IPP2P
      iptables -t mangle -A FORWARD -d $My_IP -j CHECK_IPP2P

   # Service Ports
      iptables -t mangle -A PREROUTING -j CHECK_SERVICE_PORTS
      iptables -t mangle -A OUTPUT -j CHECK_SERVICE_PORTS
   #   iptables -t mangle -A FORWARD -j CHECK_SERVICE_PORTS

   # Streaming Webs
      iptables -t mangle -A PREROUTING -j CHECK_STREAMING_WEBS

   # Games
      # PREROUTING
         iptables -t mangle -A PREROUTING -p all -j CHECK_GAMES

   # DotA
      # Create DotA
         iptables -t mangle -A PREROUTING -p tcp -m multiport --sports 7051:7080,7101:7160 -j GOTO_GAME
         iptables -t mangle -A PREROUTING -p udp -m multiport --sports 7051:7080,7101:7160 -j GOTO_GAME
      # Join DotA
         iptables -t mangle -A PREROUTING -p tcp -m multiport --dports 6101:6200,7101:7200 -j GOTO_GAME
         iptables -t mangle -A PREROUTING -p udp -m multiport --dports 6101:6200,7101:7200 -j GOTO_GAME

   # BF2
      iptables -t mangle -A PREROUTING -p tcp --sport 4711 --dport 4711 -j GOTO_GAME

      iptables -t mangle -A PREROUTING -p tcp -m multiport --dports 29900,29901,29920,28910 -j GOTO_GAME
      iptables -t mangle -A PREROUTING -p udp -m multiport --dports 27900,29900,29910,27901,55123:55570,1500:4999,16567:16568 -j GOTO_GAME

   # Allow ipp2p only me
      iptables -t filter -D FORWARD -s $My_IP -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT
      iptables -t filter -I FORWARD -s $My_IP -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT

      iptables -t filter -D FORWARD -d $My_IP -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT
      iptables -t filter -I FORWARD -d $My_IP -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT
   
   # Allow ipp2p for Special Games (FIFA Online 2)
      iptables -t filter -D FORWARD -p all -s 61.91.68.0/24 -j ACCEPT
      iptables -t filter -I FORWARD -p all -s 61.91.68.0/24 -j ACCEPT

      iptables -t filter -D FORWARD -p all -d 61.91.68.0/24 -j ACCEPT
      iptables -t filter -I FORWARD -p all -d 61.91.68.0/24 -j ACCEPT

   # No match, use Load Balance
      iptables -t mangle -A PREROUTING -i eth1 -j ACCEPT

# ----- END rule adding

# #########################################################
#                  - END -      multi wan 2 Line                      #
# #########################################################
บันทึกการเข้า

" ไม่กินเหล้า ไม่สูบบุหรี่ เป็นคนดี มีรถขับ โทรศัพท์ถ่ายรูปได้ "

Aofzza
สมาชิกร้านอินเตอร์เน็ตรุ่นพี่
****
สมาชิกเว็บเต็มตัว
***

ความดี 55
ออนไลน์ ออนไลน์

เพศ: ชาย
กระทู้: 419

เอาให้ตายไปเลย..พวกหมานำจับ!!


เว็บไซต์
« ตอบ #5 เมื่อ: พฤศจิกายน 30, 2010, 06:27:54 PM »

ขอบคุณคุณ THE-HUNTER  จากใจจริงครับ...ผมได้ความรู้จากบอร์ดและุคุณ THE-HUNTER  มาก็ไม่ใช่น้อย...

อีกนิดหนึ่งครับ..ในกรณีผมแก้ และเซฟลงไปนี้..ต้องรีเครื่องก่อนหรือเปล่าครับ..หรือสามารถใช้งานได้เลย..

และพอมีเว๊ปแนะนำสำหรับการเรียนรู้วิธีเขียน โค๊ตของ CC ไหมครับ..
บันทึกการเข้า

THE-HUNTER
****
สมาชิกเว็บรุ่นพี่

ความดี 80
ออฟไลน์ ออฟไลน์

กระทู้: 727



« ตอบ #6 เมื่อ: ธันวาคม 01, 2010, 12:36:08 AM »

ไม่ต้อง Restart เครื่อง Restart แค่ Firewall พอครับ

service firewall restart

ส่วนเรื่องการเขียน Code ใน CC แนะนำให้ศึกษาเรื่อง iptables อ่านให้เข้าใจ มันยากแค่ตอนเริ่ม ผมเองก็เริ่มจากไม่รู้เหมือนกันครับ

ถ้าคุณเข้าใจ iptables คุณก็ใช้ Linux ได้ทุกตัวแหละครับ เพราะ iptables มันไม่ได้มีแค่การเขียน Code แต่คุณต้องมีจินตนาการมานั่งหาคำสั่งทำนู่นทำนี่ ก็จะได้ฝึกฝนคำสั่ง Linux ไปในตัว

ที่สำคัญคุณต้องมีเป้าหมายว่าจะทำไปเพื่ออะไร ถ้าไม่มีเป้าหมายคุณก็ไม่รู้จะทำเพื่ออะไร จะทำไปทำไม มันจะไม่มีกำลังใจครับ

อย่างผมหัดเขียน iptables เพราะเวลาเล่นเกมส์ไปแล้วพอโหลดบิทเกมส์มันจะแลค ผมมีเป้าหมายแค่ทำยังไงก็ได้ให้เล่นเกมส์ไปด้วย โหลดบิทไปด้วย แล้วเกมส์ไม่แลค

ที่แย่กว่านั้นร้านผมได้เน็ตสูงสุด 1mb ของ tot นะครับ ก่อนย้ายร้านมาอีกที่นึง มันเลยต้องหาวิธีทำยังไงก็ได้ให้แก้ปัญหาที่เจอให้ได้
บันทึกการเข้า

" ไม่กินเหล้า ไม่สูบบุหรี่ เป็นคนดี มีรถขับ โทรศัพท์ถ่ายรูปได้ "

Aofzza
สมาชิกร้านอินเตอร์เน็ตรุ่นพี่
****
สมาชิกเว็บเต็มตัว
***

ความดี 55
ออนไลน์ ออนไลน์

เพศ: ชาย
กระทู้: 419

เอาให้ตายไปเลย..พวกหมานำจับ!!


เว็บไซต์
« ตอบ #7 เมื่อ: ธันวาคม 01, 2010, 11:39:09 AM »

ขแบคุณครับ... Cry
บันทึกการเข้า

Aofzza
สมาชิกร้านอินเตอร์เน็ตรุ่นพี่
****
สมาชิกเว็บเต็มตัว
***

ความดี 55
ออนไลน์ ออนไลน์

เพศ: ชาย
กระทู้: 419

เอาให้ตายไปเลย..พวกหมานำจับ!!


เว็บไซต์
« ตอบ #8 เมื่อ: มกราคม 19, 2011, 03:20:38 PM »

ขอรบกวนอีกครั้งครับ พอดี เซิฟเวอร์ผมมีปัญหา ผมจึงลงใหม่ ตั้งค่าใหม่ตามเดิม แต่กลับเข้าไป ไม่ได้เหมือนเดิม รีสอร์ท ficewall แล้ว ccsquid แล้วก็ยังไม่ได้ครับ ขอรบกวนอีกครั้ง

ขอบคุณครับ

นี่ firewall ที่ลง
# -------------------------------------------------------------
# Author : Mr.Permpong  Chaorungmethee (Mr.Alexa)
# WebSite : http://www.zealzonecafe.com
# MSN : permpongc@ฮ็อตเมล์.com
# Email : alexa@zealzonecafe.com
#
# Script : Traffic Control for Internet cafe' Business
# Type : 2 WAN (Game 1 Net 1)
#
# -------------------------------------------------------------

My_Local_Net=192.168.0.0/16
My_IP=192.168.0.254
PPP0_Mark=0x8000
PPP1_Mark=0x8001

# -------------------------------------------------------------
# Controls settings
# -------------------------------------------------------------
   echo "1" > /proc/sys/net/ipv4/ip_forward
   echo "1" > /proc/sys/net/ipv4/conf/default/rp_filter
   echo "1" > /proc/sys/kernel/core_uses_pid

# -------------------------------------------------------------
# Flush all the rules in mangle table
# -------------------------------------------------------------
   iptables -t mangle -F

   modprobe ip_nat_ftp
   modprobe ip_tables
   modprobe iptable_nat
   modprobe ipt_conntrack
   modprobe ip_conntrack
   modprobe ip_conntrack_ftp
   modprobe ip_conntrack_irc
   modprobe ip_nat_irc
   modprobe ip_nat_snmp_basic

# -------------------------------------------------------------
# reset the default policies in the filter table.
# -------------------------------------------------------------
   iptables -P INPUT ACCEPT
   iptables -P FORWARD ACCEPT
   iptables -P OUTPUT ACCEPT

# -------------------------------------------------------------
# reset the default policies in the nat table.
# -------------------------------------------------------------
   iptables -t nat -P PREROUTING ACCEPT
   iptables -t nat -P POSTROUTING ACCEPT
   iptables -t nat -P OUTPUT ACCEPT

# -------------------------------------------------------------
# reset the default policies in the mangle table.
# -------------------------------------------------------------
   iptables -t mangle -P PREROUTING ACCEPT
   iptables -t mangle -P POSTROUTING ACCEPT
   iptables -t mangle -P INPUT ACCEPT
   iptables -t mangle -P OUTPUT ACCEPT
   iptables -t mangle -P FORWARD ACCEPT

# -------------------------------------------------------------
# CANCEL OLD IP MASQUERADE
# -------------------------------------------------------------
   # iptables -t nat -D POSTROUTING -o eth+ -j MASQUERADE > /dev/null
   iptables -t nat -D POSTROUTING -s $My_Local_Net -o ppp0 -j MASQUERADE > /dev/null
   iptables -t nat -D POSTROUTING -s $My_Local_Net -o ppp1 -j MASQUERADE > /dev/null
   iptables -t nat -D POSTROUTING -s $My_Local_Net -o ppp2 -j MASQUERADE > /dev/null

# -------------------------------------------------------------
# MAKE NEW IP MASQUERADE
# -------------------------------------------------------------
   # iptables -t nat -A POSTROUTING -o eth+ -j MASQUERADE
   iptables -t nat -A POSTROUTING -s $My_Local_Net -o ppp0 -j MASQUERADE
   iptables -t nat -A POSTROUTING -s $My_Local_Net -o ppp1 -j MASQUERADE
   iptables -t nat -A POSTROUTING -s $My_Local_Net -o ppp2 -j MASQUERADE

# ----- Squid
   if [ -f /var/run/squid.pid ]; then
      iptables -t nat -I PREROUTING -p tcp -m multiport --dports 80,5977 -j REDIRECT --to-port 3128

      # CSO
      iptables -t nat -I PREROUTING -p tcp -d 202.43.33.0/24 --dport 9898 -j REDIRECT --to-port 3128

      # Transparent Mode
      iptables -t filter -A INPUT -i eth1 -p tcp -m multiport --destination-port 80,5977,9898 -j ACCEPT
      iptables -t filter -A OUTPUT -o eth1 -p tcp -m multiport --destination-port 80,5977,9898 -j ACCEPT

      # SealOnline's Game Guard
      iptables -t nat -I PREROUTING -p tcp -d 61.47.39.89 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 61.47.39.88 --dport 80 -j ACCEPT

      # SF's Game Guard
      iptables -t nat -I PREROUTING -p tcp -d 61.90.203.4 --dport 80 -j ACCEPT

      # Pangya
      iptables -t nat -I PREROUTING -p tcp -d 58.64.24.163/24 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 164.115.2.134/24 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 203.195.98.6/24 --dport 80 -j ACCEPT

      # DotA
      iptables -t nat -I PREROUTING -p tcp -d 210.86.182.252/24 --dport 80 -j ACCEPT

      # Laghaim
      iptables -t nat -I PREROUTING -p tcp -d 61.90.198.122 --dport 80 -j ACCEPT

      # LastChaos
      iptables -t nat -I PREROUTING -p tcp -d 61.90.198.99/24 --dport 80 -j ACCEPT

      # RAN
      iptables -t nat -I PREROUTING -p tcp -d 202.142.207.240 --dport 80 -j ACCEPT

      # ฮ็อตเมล์
      iptables -t nat -I PREROUTING -p tcp -d 207.46.9.121/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 65.55.113.23/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 64.62.193.48/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 8.12.221.126/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 206.33.55.125/16 --dport 80 -j ACCEPT
      iptables -t nat -I PREROUTING -p tcp -d 12.129.210.41/16 --dport 80 -j ACCEPT
      
      # item icafe #
            iptables -t nat -I PREROUTING -p tcp -d icafe.gg.in.th --dport 80 -j ACCEPT

   fi

# ----- Frox
   if [ -f /var/run/frox.pid ]; then
      iptables -t nat -I PREROUTING -p tcp --dport 21 -j REDIRECT --to-port 2121

      # HipStreet for Frox
      iptables -t nat -I PREROUTING -p tcp -d 58.97.46.0/24 --dport 8021 -j REDIRECT --to-port 2121

      # Transparent Mode
      iptables -t filter -A INPUT -i eth1 -p tcp -m multiport --destination-port 21,8021 -j ACCEPT
      iptables -t filter -A OUTPUT -o eth1 -p tcp -m multiport --destination-port 21,8021 -j ACCEPT
   fi

# #########################################################
#                  - START -   multi wan 2 Line                      #
# #########################################################

# ----------------------------NOTE---------------------------------
# PPP0 = 0x8000 / PPP1 = 0x8001/ PPP2 = 0x8002

# ----------Create our own CHAINS----------
   # ----- Create GOTO_GAME
      iptables -t mangle -N GOTO_GAME
      iptables -t mangle -F GOTO_GAME
      iptables -t mangle -A GOTO_GAME -j MARK --set-mark $PPP0_Mark
      iptables -t mangle -A GOTO_GAME -j ACCEPT

   # ----- Create CHECK_STREAMING_WEBS
      iptables -t mangle -N CHECK_STREAMING_WEBS
      iptables -t mangle -F CHECK_STREAMING_WEBS
      # Zheza.com
         iptables -t mangle -A CHECK_STREAMING_WEBS -d 202.142.207.140 -j ACCEPT

   # ----- Create CHECK_SERVICE_PORTS
      iptables -t mangle -N CHECK_SERVICE_PORTS
      iptables -t mangle -F CHECK_SERVICE_PORTS
      iptables -t mangle -A CHECK_SERVICE_PORTS -p tcp -m multiport --dports 20:25,80,443,554,1863,5050,5190,3128,3130,8080,9099,16667 -j ACCEPT
      iptables -t mangle -A CHECK_SERVICE_PORTS -p tcp -m multiport --dports 1863,6667,2009,2121,5977,6969,6889,8000,8021,9898 -j ACCEPT
      iptables -t mangle -A CHECK_SERVICE_PORTS -p udp -m multiport --dports 20:25,80,443,554,1863,5050,5190,3128,3130,8080,9099,16667 -j ACCEPT
      iptables -t mangle -A CHECK_SERVICE_PORTS -p udp -m multiport --dports 1863,6667,2009,2121,5977,6969,6889,8000,8021,9898 -j ACCEPT
      # Dns
      iptables -t mangle -A CHECK_SERVICE_PORTS -p tcp --destination-port 53 -j ACCEPT
      iptables -t mangle -A CHECK_SERVICE_PORTS -p udp --destination-port 53 -j ACCEPT

   # ----- Create CHECK_IPP2P
      iptables -t mangle -N CHECK_IPP2P
      iptables -t mangle -F CHECK_IPP2P
      iptables -t mangle -A CHECK_IPP2P -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT

   # ----- Create CHECK_GAMES
      iptables -t mangle -N CHECK_GAMES
      iptables -t mangle -F CHECK_GAMES
      # Abnormal game ports. CSO/Lineage2, check port of game patching. If so, using LoadBalance.
         # CSO
         iptables -t mangle -A CHECK_GAMES -d 202.43.33.0/24 -p tcp --dport 9898 -j ACCEPT
         # LN2
         iptables -t mangle -A CHECK_GAMES -d 61.90.199.6/32 -p tcp --dport 2009 -j ACCEPT
         # Cabal patching?
#         iptables -t mangle -A CHECK_GAMES -d 203.144.132.139/32 -p tcp --dport 6889 -j ACCEPT
         iptables -t mangle -A CHECK_GAMES -d 203.144.132.0/24 -p tcp --dport 6969 -j ACCEPT
         # SF's game guard?
#         iptables -t mangle -A CHECK_GAMES -d 61.78.35.29 -p tcp --dport 6060 -j ACCEPT
      # Audition Korean
         iptables -t mangle -A CHECK_GAMES -d 210.118.53.0/24 -j GOTO_GAME
      # Asiasoft
         iptables -t mangle -A CHECK_GAMES -d 203.144.0.0/16 -j GOTO_GAME
      # N-age, and <unknown games>
#         iptables -t mangle -A CHECK_GAMES -d 203.146.0.0/16 -j GOTO_GAME
      # Asiasoft International, SF,LN2
         iptables -t mangle -A CHECK_GAMES -d 61.90.0.0/16 -j GOTO_GAME
      # ProjectOne, DOMO
#         iptables -t mangle -A CHECK_GAMES -d 61.19.0.0/16 -j GOTO_GAME
      # RacyCity
         iptables -t mangle -A CHECK_GAMES -d 61.19.242.0/24 -j GOTO_GAME
      # Seal, HY, 3Kingdoms, 16, PVP
         iptables -t mangle -A CHECK_GAMES -d 61.47.0.0/16 -j GOTO_GAME
      # PFW, Eco
         iptables -t mangle -A CHECK_GAMES -d 61.91.0.0/16 -j GOTO_GAME
      # HipStreet
         iptables -t mangle -A CHECK_GAMES -d 58.97.46.10/32 -j GOTO_GAME
         iptables -t mangle -A CHECK_GAMES -d 58.97.46.16/32 -j GOTO_GAME
      # Pangya, Rebirth, Pucca, Flyff
         iptables -t mangle -A CHECK_GAMES -d 58.64.0.0/16 -j GOTO_GAME
      # DotA, Getamped
         iptables -t mangle -A CHECK_GAMES -d 210.86.0.0/16 -j GOTO_GAME
      # LunaOnline, pko, water, SDO, Secret, RYL
         iptables -t mangle -A CHECK_GAMES -d 202.43.0.0/16 -j GOTO_GAME
      # RAN
         iptables -t mangle -A CHECK_GAMES -d 202.142.207.0/24 -j GOTO_GAME
      # TalesRunner
         iptables -t mangle -A CHECK_GAMES -d 203.113.0.0/16 -j GOTO_GAME
      # GG
         iptables -t mangle -A CHECK_GAMES -d 74.55.122.70/24 -j GOTO_GAME
#         iptables -t mangle -A CHECK_GAMES -d 74.55.122.70:8687 -j GOTO_GAME
#         iptables -t mangle -A CHECK_GAMES -d 74.53.215.8:7456 -j GOTO_GAME
      # NosTale
         iptables -t mangle -A CHECK_GAMES -d 203.121.165.196/24 -j GOTO_GAME

            # item icafe #
               iptables -t mangle -A CHECK_BONUS -d icafe.gg.in.th -j GOTO_GAME


   # ----- Create CHECK_BONUS
      iptables -t mangle -N CHECK_BONUS
      iptables -t mangle -F CHECK_BONUS
      iptables -t mangle -A CHECK_BONUS -d secure1.asiasoft.co.th -p tcp -m multiport --dports 443 -j GOTO_GAME
      iptables -t mangle -A CHECK_BONUS -d secure2.asiasoft.co.th -p tcp -m multiport --dports 443 -j GOTO_GAME

# ----- ----- ----- ----- ----- ----- ----- ----- #
# ----- Load Balance
# ----- ----- ----- ----- ----- ----- ----- ----- #
   # ----- Check all ppp interfaces
      PPP0=`/sbin/ifconfig | grep "ppp0"`
      PPP1=`/sbin/ifconfig | grep "ppp1"`

      ppp0=0;ppp1=0;ppp2=0;

      if [ -n "$PPP0" ]; then
         ppp0=1
      else
         ppp0=0
      fi

      if [ -n "$PPP1" ]; then
         ppp1=1
      else
         ppp1=0
      fi

      LBStatus=$ppp0$ppp1

   # ----- Get PPP and Gateway Address
      ppp0_addr=`ifconfig | grep -A1 ppp0 | tail -1 | cut -d : -f 2 | cut -f 1 -d " "`
      ppp1_addr=`ifconfig | grep -A1 ppp1 | tail -1 | cut -d : -f 2 | cut -f 1 -d " "`

      ppp0_gw=`ip route | grep ppp0 | head -1 | cut -f 1 -d " "`
      ppp1_gw=`ip route | grep ppp1 | head -1 | cut -f 1 -d " "`

   # ----- check status before setting LoadBalance
      if [ $LBStatus -eq 11 ]; then
         iptables -t mangle -F GOTO_GAME
         iptables -t mangle -A GOTO_GAME -j MARK --set-mark $PPP0_Mark
         iptables -t mangle -A GOTO_GAME -j ACCEPT
         ip route replace default table 250 proto static nexthop via $ppp1_gw dev ppp1 weight 200
      elif [ $LBStatus -eq 10 ]; then
         iptables -t mangle -F GOTO_GAME
         iptables -t mangle -A GOTO_GAME -j MARK --set-mark $PPP0_Mark
         iptables -t mangle -A GOTO_GAME -j ACCEPT
         ip route replace default table 250 proto static nexthop via $ppp0_gw dev ppp0 weight 200
      elif [ $LBStatus -eq 01 ]; then
         iptables -t mangle -F GOTO_GAME
         iptables -t mangle -A GOTO_GAME -j MARK --set-mark $PPP1_Mark
         iptables -t mangle -A GOTO_GAME -j ACCEPT
         ip route replace default table 250 proto static nexthop via $ppp1_gw dev ppp1 weight 200
      fi

# ----------START rule adding----------
   # Firstly, Allow to add IP-Bonus via ppp0
      iptables -t mangle -A PREROUTING -p tcp -s $My_Local_Net -j CHECK_BONUS

   # ipp2p
      iptables -t mangle -A PREROUTING -s $My_IP -j CHECK_IPP2P
      iptables -t mangle -A OUTPUT -s $My_IP -j CHECK_IPP2P
      iptables -t mangle -A FORWARD -s $My_IP -j CHECK_IPP2P

      iptables -t mangle -A PREROUTING -d $My_IP -j CHECK_IPP2P
      iptables -t mangle -A OUTPUT -d $My_IP -j CHECK_IPP2P
      iptables -t mangle -A FORWARD -d $My_IP -j CHECK_IPP2P

   # Service Ports
      iptables -t mangle -A PREROUTING -j CHECK_SERVICE_PORTS
      iptables -t mangle -A OUTPUT -j CHECK_SERVICE_PORTS
   #   iptables -t mangle -A FORWARD -j CHECK_SERVICE_PORTS

   # Streaming Webs
      iptables -t mangle -A PREROUTING -j CHECK_STREAMING_WEBS

   # Games
      # PREROUTING
         iptables -t mangle -A PREROUTING -p all -j CHECK_GAMES

   # DotA
      # Create DotA
         iptables -t mangle -A PREROUTING -p tcp -m multiport --sports 7051:7080,7101:7160 -j GOTO_GAME
         iptables -t mangle -A PREROUTING -p udp -m multiport --sports 7051:7080,7101:7160 -j GOTO_GAME
      # Join DotA
         iptables -t mangle -A PREROUTING -p tcp -m multiport --dports 6101:6200,7101:7200 -j GOTO_GAME
         iptables -t mangle -A PREROUTING -p udp -m multiport --dports 6101:6200,7101:7200 -j GOTO_GAME

   # BF2
      iptables -t mangle -A PREROUTING -p tcp --sport 4711 --dport 4711 -j GOTO_GAME

      iptables -t mangle -A PREROUTING -p tcp -m multiport --dports 29900,29901,29920,28910 -j GOTO_GAME
      iptables -t mangle -A PREROUTING -p udp -m multiport --dports 27900,29900,29910,27901,55123:55570,1500:4999,16567:16568 -j GOTO_GAME

   # Allow ipp2p only me
      iptables -t filter -D FORWARD -s $My_IP -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT
      iptables -t filter -I FORWARD -s $My_IP -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT

      iptables -t filter -D FORWARD -d $My_IP -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT
      iptables -t filter -I FORWARD -d $My_IP -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j ACCEPT
   
   # Allow ipp2p for Special Games (FIFA Online 2)
      iptables -t filter -D FORWARD -p all -s 61.91.68.0/24 -j ACCEPT
      iptables -t filter -I FORWARD -p all -s 61.91.68.0/24 -j ACCEPT

      iptables -t filter -D FORWARD -p all -d 61.91.68.0/24 -j ACCEPT
      iptables -t filter -I FORWARD -p all -d 61.91.68.0/24 -j ACCEPT

   # No match, use Load Balance
      iptables -t mangle -A PREROUTING -i eth1 -j ACCEPT

# ----- END rule adding

# #########################################################
#                  - END -      multi wan 2 Line                      #
# #########################################################
บันทึกการเข้า

Aofzza
สมาชิกร้านอินเตอร์เน็ตรุ่นพี่
****
สมาชิกเว็บเต็มตัว
***

ความดี 55
ออนไลน์ ออนไลน์

เพศ: ชาย
กระทู้: 419

เอาให้ตายไปเลย..พวกหมานำจับ!!


เว็บไซต์
« ตอบ #9 เมื่อ: มกราคม 20, 2011, 02:34:35 AM »

  แก้ได้แล้ว..
บันทึกการเข้า

หน้า: [1]   ขึ้นบน
  พิมพ์  
 
กระโดดไป:  


ติดต่อโฆษณา สำหรับบริษัท หรือท่านใดที่ต้องการทำกิจกรรมร่วมกับเว็บไซต์ ICT.in.th ติดต่อได้ที่ ictnetcafe@gmail.com

ข้อความ หรือรูปภาพที่ปรากฏในเว็บไซต์แห่งนี้ เกิดจากการเขียนโดยสาธารณชน และถูกส่งขึ้นโดยอัตโนมัติจากบุคคลทั่วไป ซึ่งทาง ICT.in.th มิได้มีส่วนร่วมรู้เห็น ตรวจสอบ หรือพิสูจน์ข้อเท็จจริงใดๆ ทั้งสิ้น ผู้อ่านจึงควรใช้วิจารณญาณในการรับข่าวสารข้อมูล หากท่านพบเห็นข้อความ หรือรูปภาพที่ไม่เหมาะสม กรุณาแจ้งให้ทีมงานทราบ เพื่อดำเนินการต่อไป

Tags: จับลิขสิทธิ์ บ่อนออนไลน์ internetcafe รายได้เสริมร้านเน็ต ชมรมร้านเกมส์ ร้านเน็ตคาเฟ่ เปิด ร้าน เน็ต คาเฟ่ เกมออนไลน์ใหม่ แนะนำ ร้าน เน็ต คาเฟ่ หมานำจับ เข้า youtube ไม่ได้ เข้า msn ไม่ได้ แทงกันในร้านเกม เปิดร้านเน็ต ลิขสิทธิ์ ตารางผสมของ dota 6.73 ตารางออกของdota 6.73 ผสมของdotaใหม่ล่าสุด map dota 6.74 ผสมของ dota 6.73 internet cafe โปรแกรม เน็ต คาเฟ่ หูฟังดังข้างเดียว พ.ร.บ.ภาพยนตร์และวีดิทัศน์ กลุ่มร้านเน็ต 6.73 มีอะไรใหม่ ร้านอินเทอร์เน็ตสีขาว สมาคมร้านอินเตอร์เน็ต ลิขสิทธิ์ร้านเกมส์ กลุ่มเครือข่ายร้านเน็ต เกมส์ออนไลน์ทั้งหมด dota 6.74 มีอะไรใหม่ สมัครเน็ตคาเฟ่ เกมส์ออนไลน์ฟรี hon lan ยังไง icct ict ตลาดอินเตอร์เน็ต seo คอนแทคเลนส์