วันพฤหัสบดีที่ 30 พฤษภาคม พ.ศ. 2556

การอัพเกรด HOSxP_PCU_MySQL_Upgrade 5.5 (จากแหล่งอ้างอิง)

อ้างอิงจากลิงค์ของส้ม http://hosxp.net/index.php?option=com_smf&Itemid=28&
topic=29909.msg245569#new  เพื่อการอัพเกรด MySQL 5.5
เนื่องด้วยขณะนี้ มีรพ.สต. หลายแห่งที่มี version mysql เป็น 5.1.XX  ซึ่งค่อนข้างเก่าเกินไป และอาจจะมีผลทำให้ upgrade structure ใน version 3.56.5.7 ไม่ผ่านค่ะ  วันนี้เราเลยนำ
HOSxP_PCU_MySQL_Upgrade 5.5 มาฝากค่ะ  ตามลิงค์นี้นะคะ

http://hosxp.net/bms/HOSxP_PCU_MySQL_Upgrade_5.5.31.exe 

ข้อแนะนำ
1. ติดตั้ง HOSxP_PCU_MySQL_Upgrade_5.5.25.exe ควร Run  As Administrator
2. เมื่อติดตั้งเสร็จแล้ว เวลาเข้าใช้งาน HOSxP PCU ควร Run  As Administrator
***อ้างอิงลิงค์ของนัน http://hosxp.net/index.php?option=com_smf&Itemid=28&topic=29866.msg245558#new  เพื่อการcreate event ใน trigger ของ Inventory สำหรับหน่วยที่มีการใช้ Inventory PCU
3.แก้ไฟล์ my.ini ใน C:\Windows
     วิธีการคือ  3.1 เข้า start>run   พิมพ์   cmd
                  3.2 พิมพ์  net stop mysql
                  3.3 แก้ไขไฟล์  my.ini   เพิ่ม event_scheduler=1 แล้ว Save
                  3.4 พิมพ์  net start mysql แล้วเข้าใช้งานครับ

***** อย่าลืมตอนติดตั้งตัว Upgrade mysql ต้องปิดระบบ Security ของ Antivirus หรือคลิกขวา Run as Administrator ทุกครั้งครับ **


วันพุธที่ 3 เมษายน พ.ศ. 2556

ZABBIX VMware ESX Monitoring

https://blog-softnixtech.rhcloud.com/2013/01/29/zabbix-vmware-esx-monitoring/


ZABBIX VMware ESX Monitoring


ปัจจุบันต้องยอมรับว่า Vmware ESX คือ Patform หลักที่ได้รับความนิยมสูงสุดที่ใช้ในการขับเคลือน Virtualization Server อยู่ในปัจจุบัน ด้วยความสามารถด้านระบบบริหารจัดการ เสถียรภาพ และบริการหลังการขาย แต่อีกสิ่งหนึ่งที่มีความจำเป็นไม่ใช่น้อยนั้นก็คือระบบ Monitoring ซึ่งจะเป็นระบบที่ใช้สำหรับตรวจสอบการทำงานของ Vmware ESX ตรวจสอบทรัพยากรระบบที่ถูกใช้ไป รวมถึงระบบ Alert เมื่อมีเหตุการณ์ผิดปกติเกิดขึ้น
ดังนั้นในบทความนี้จะอธิบาย ZABBIX ในการ Monitor ระบบ Vmware ESX Host Server โดยจะยังไม่กล่าวถึงการ Monitor Virtual Server ที่รันอยู่ภายใน  เพื่อให้ทุกท่านที่สนใจได้รับทราบว่า ZABBIX มีความสามารถเพียงใด เพื่อประกอบการพิจารณาในการเลือกใช้งาน
zabbix vmware monitor
Top 100 Event Triggers
Triggers ความหมายของ ZABBIX คือค่าของเหตุการณ์สูงสุดที่ยอมรับได้หรือค่าที่บ่งบอกถึงความผิดปกติที่เกิดขึ้น เช่น ค่า trigger เป็น 0 เมื่อ ZABBIX Server ไม่สามารถ Ping Server เป้าหมายได้นานเกิน 10 นาที หรือ trigger เป็น 1 เมื่อ Traffic Bandwidth ของ Router สูงถึง 8Mbps นานติดต่อกันเกิน 15 นาที เงือนไขการตรวจสอบเหล่านี้ถือสิ่งที่ ZABBIX รองรับ ซึ่งเป็นเหตุให้ ZABBIX มีความยืดหยุ่นสูงในการใช้งาน
ZABBIX รองรับรายงาน (Report) ที่รวบรวมจำนวนครั้งของเหตุการณ์ผิดปกติ (Trigger) เพื่อให้ผู้ดูแลระบบทราบ ดังตัวอย่างภาพ
Top100 triggers
ระบบสามารถเลือกดูเหตุการณ์ตามช่วงเวลาได้อย่างง่ายดาย ด้วยเหตุนี้จึงทำให้ง่ายต่อการวิเคราะห์การทำงานของระบบ เพื่อช่วยให้วางแผนการปรับปรุงระบบเพื่อตอบสนองต่อการใช้งานของผู้ใช้หรือธุรกิจได้อย่างถูกต้อง
ZABBIX Graph
Availability Report
ZABBIX สามารถรวบรวมเหตุการณ์ผิดปกติเพื่อคำนวณค่า % ของเหตุการณ์ที่ปกติ (Status OK) และผิดปกติ (Status Problem) ต่อช่วงเวลาที่กำหนดได้ ทำให้ผู้ดูแลระบบทราบได้ทันทีว่า ปริมาณของเหตุการณ์ผิดปกตินั้นมากเพียงใด เพื่อสรุปเป็นรายงานเชิงมาตรฐาน ตัวชี้วัด (KPI) ได้
Availability Report
Availability Report2
Performance Monitor
สำหรับ Vmware ESX Server ซึ่งรองรับ VM จำนวนมาก จะมีอัตรา Read/Write Disk จำนวนมาก เราสามารถใช้ ZABBIX ในการรายงานปริมาณอัตรา Read/Write Disk ได้
ZABBIX Disk Write rate
นอกจากนั้น ZABBIX ยังสามารถ Monitor ค่าต่างๆของ  Vmware ESX Server ได้อย่างมากมาย อทิเช่น  CPU, RAM, Network Traffic
performance monitor
Maps
ZABBIX มีระบบสร้าง Map ที่เรียกว่า Dynamic Map โดยการลาก icon และวางยังตำแหน่งที่ต้องการ เรายังสามารถเพิ่ม icon หรือ ภาพ background เพื่อง่ายต่อความเข้าใจของเรา สร้างการ Monitor ที่เรียกว่า High Level View หรือ Business Level View
zabbix map

บทสรุป
ZABBIX คือหนึ่งใน Software Monitoring System ซึ่งมีประสิทธิภาพสูง ด้วยความสามารถที่หลากหลายเช่นเดียวกับ Software Monitoring ราคาแพงทั่วไป จึงนับได้ว่า ZABBIX คืออีกหนึ่งทางเลือกที่คุ้มค่าที่สุด เมื่อเทียบกับต้นทุนที่ใช้ไปในการใช้ระบบนี้ต่อประโยชน์ที่จะได้รับ ดังนั้นปัจจัยที่มีผลโดยตรงกับการเลือก ZABBIX คือ ระยะเวลาในการ Implement รวมไปจนถึงความยากง่ายในการเรียนรู้ รวมไปจนถึงบริการหลังการขายอย่างมืออาชีพ ที่จะคอยช่วยเหลือ
Softnix คือบริษัทที่เป็นตัวแทนอย่างเป็นทางการของ ZABBIX SIA ที่จะช่วยให้คำปรึกษา ออกแบบ และติดตั้ง รวมไปจนถึงการอบรมการใช้งาน ช่วยให้นำ Software ตัวนี้มาใช้ประโยชน์ได้อย่างเต็มที่คุ้มค่าที่สุด และใช้เวลาที่สั้นที่สุด
ท่านที่สนใจสามารถสอบถามข้อมูลเพิ่มเติมได้ที่ http://www.softnix.co.th/v2/contact.php

VMWARE ESXi 5.x กับเครื่อง PC

VMWARE ESXi  5.x  กับเครื่อง PC

จริงๆๆ เป็นคนไม่บอ VM  เพราะว่ามันทำให้ os ที่ใช้งาน VM ทำงานไม่เต็มที่

แต่จำเป็นต้องใช้เพราะว่าปีหน้าต้องเปลียนเครื่อง SERVER  .ใหม่ ตัวเก่าจะใช้มาเกิน 5 ปีแล้ว

เลยจำเป็นต้องใช้ครับ   เพราะว่าคงซื้อได้ตัวเดียว   แต่ว่าจะำเป็นต้องลงให้ os ให้เท่ากับตัวเดิม 3 ตัว




-----------------------------------------------------------------------------------------------------------
ต้องหาซื้อตัวนีด้วย


เราสามารถเพิ่มความเร็วให้กับ Guest VM ใน VMware ESX โดยใช้เทคโนโลยีของ Fusion-io ได้อย่างไร

13 August 2012 -- Fusion-io มีเทคโนโลยีที่สามารถช่วยเพิ่มความเร็วในการประมวลผลข้อมูลของ Guest VM ใน VMWare ESX Server ได้เป็นอย่างดี โดยใช้ Software ที่ชื่อว่า ioTurbine ร่วมกับ Fusion-io Hardware (Enterprise PCIe Flash Memory) โดย Software นี้มีข้อดีอย่างไรบ้างให้ดูตามรายละเอียดด้านล่างนี้ได้เลยครับ

  • เป็น Very High Speed Disk Read Caching ให้กับ Guest VM นั่นหมายความว่า หาก Guest VM นั้นมี Application workload ที่มีการอ่านข้อมูลเพื่อการประมวลผลเป็นอย่างมากแล้ว เช่นพวก ระบบ Database, ระบบ Email Messaging (Microsoft Exchange, Lotus Notes) เราสามารถเพิ่มความเร็วให้กับ Guest VM นั้นได้ ทั้งในเชิงของ Response Time ที่รวดเร็วขึ้นกว่าเดิมมาก (จากเดิมต้องใช้เวลารอ I/O ถึงระดับ Milliseconds  สามารถลดได้เหลือระดับ Microseconds),  สามารถรองรับจำนวน Query ต่อหน่วยเวลาได้ดียิ่งขึ้น และ สามารถเพิ่ม Disk IOPS ให้สูงขึ้นได้ด้วยเช่นกัน   

  • สามารถลดภาระ (Offload Disk I/O Activity) ของ Shared Storage ได้เป็นอย่างดี ทำให้ Shared Storage ของ ESX Cluster นั้น เหลือทรัพยากรที่จะรองรับการเขียนข้อมูล (Write Workload) จาก Guest VM ต่างๆ ได้ดีมากกว่าเดิมมากๆ  สาเหตุที่เป็นแบบนี้เพราะ Read I/O นั้นถูก Caching ขึ้นไปที่ ESX Server อยู่บน Fusion-io Flash Memory Hardware เรียบร้อยแล้ว



ซึ่งจากภาพด้านบน ภาพซ้ายมือคือ รูป Architecture แบบปกติ ของ VMware ESX Cluster ที่เป็นลักษณะที่มี Shared Storage ระหว่าง VMware ESX Server เพื่อให้ Guest VM สามารถใช้ข้อมูลและทำ vMotion ข้าม ESX Server กันได้  ถ้าดูในภาพซ้ายมือนี้ จะพบว่า I/O Performance จะถูกซอยย่อย แบ่งๆ กันไปในแต่ละ Guest VM จนทำให้ แต่ละ Guest VM มี I/O Performance ที่ไม่มากพอ ที่จะรองรับ I/O Intensive Workload หนักๆ ได้ (จริงๆ สามารถจะทำให้ภาพด้านซ้ายรองรับ Workload หนักๆได้เหมือนกัน แต่ว่า ต้องไป Upgrade Shared Storage ให้สามารถรองรับ IOPS, Bandwidth ได้มากขึ้น โดยการเพิ่มจำนวน Disk Spindle เข้าไปใน SAN/NFS Shared Storage นั้นๆ แต่ว่า ก็ไม่ได้ทำให้  Latency นั้นลดลงเหลือระดับ Microsecond ได้อยู่ดี )  ซึ่งเรามีตัวเลือกการลงทุนแก้ปัญหาในเรื่องนี้ที่ดีกว่าในภาพด้านขวาครับ

แต่หากดูภาพขวา กรณีที่มีการใช้ Fusion-io Solution มาช่วยเพิ่มประสิทธิภาพของ VMWare ESX Cluster นี้ สิ่งที่เกิดขึ้นคือ เราสามารถทำให้แต่ละ Guest VM มี I/O Performance เป็นของตนเอง ที่สามารถรองรับ I/O Intensive Workload สูงๆ ได้ โดยที่ Shared Storage ยังคงเป็น Shared Storage ตัวเดิม (ไม่ต้อง Upgrade แต่อย่างใด) สาเหตุที่ทำได้เพราะว่า มีการติดตั้ง Fusion-io Hardware (Enterprise PCIe Flash) เข้าไปในแต่ละ ESX Server และ ก็มีการใช้ เทคโนโลยีของ ioTurbine Software มาช่วยในการทำ Very High Speed Disk Caching บน ESX Server นั่นเอง

หน้าตาของ Fusion-io Hardware เป็นไปตามภาพด้านล่าง ซึ่งจัดเป็น Enterprise Grade PCIe Flash ครับ เราสามารถเลือกได้หลายขนาด แต่ว่ามีขนาดที่เป็นชุด Bundle Package แล้ว ที่เรียกว่า ioCache 600GB ซึ่งจะมาทั้ง Hardware และ Software ioTurbine ในราคาพิเศษ (ถูกกว่า ซื้อแยก)


การใช้ตัวเลือกนี้ในการ เพิ่มความเร็วในการประมวลผลให้กับ Guest VM นั้นจะเป็นวิธีที่แก้ปัญหาได้ตรงจุดที่สุด ได้ Performance สูงสุด และ Latency (ความล่าช้าในการ access storage I/O หรือ delay) ต่ำที่สุด เพราะว่า Fusion-io Hardware นั้นทำงานที่ความเร็วระดับ Microsecond เท่านั้น  (จะไม่เหมือนกับที่ Shared Storage ที่มีความเร็วระดับ Milliseconds ซึ่งช้ากว่าเป็นพันเท่า โดยเทียบหน่วย ระหว่าง 10 ยกกำลัง -6  กับ 10 ยกกำลัง -3)  นั่นหมายความว่า เวลาที่ Guest VM ต้องการอ่านข้อมูลจาก Storage จะสามารถอ่านได้เร็วกว่าเดิมมากๆ ก็เลยเป็นที่มาว่าทำไม Guest VM จึงมี Performance ในการทำ Data Processing สูงขึ้นนั่นเอง

โดยส่วนตัว ผมได้ใช้กับ Guest VM ที่เป็น Database Server (IBM DB/2) ก็พบว่าใช้งานได้ดีเลยครับ โดยมี Cache Hit สูงถึง 80% นั่นหมายความว่า 80% ของเวลา Database Server (Guest VM) นี้อ่านข้อมูลจาก Fusion-io Hardware Flash Card นั่นเอง ส่วนอีก 20% นั้นอ่านจาก Shared Storage เพราะเป็นข้อมูลที่ไม่ได้อยู่ใน Cache ณ เวลาที่ต้องการอ่าน หรือจะแปลเป็นอีกความหมายหนึ่งว่า การใช้ Fusion-io Solution นี้ จะช่วยลด Workload ที่เกิดขึ้นที่ Shared Storage ได้สูงถึง 80% นั่นเอง (สำหรับ Guest VM นี้ๆ)

แต่ทั้งหลายทั้งปวง ถ้า Guest VM นั้นไม่ได้มี Workload ประเภทที่ต้องเขียน/อ่าน ข้อมูลกับ Storage Disk นั้น Solution นี้จะไม่ได้ช่วยเร่งหรือเพิ่มความเร็วอย่างแน่นอนครับ ดังนั้น Solution นี้จะเหมาะกับ Guest VM ที่เป็น Application ประเภทเกี่ยวกับการประมวลผลข้อมูลจะเหมาะสมที่สุด

สนใจข้อมูลเพิ่มเติมเกี่ยวกับเทคโนโลยีนี้ สามารถติดต่อตัวแทนจำหน่าย Fusion-io อย่างเป็นทางการประจำประเทศไทยได้ที่ บริษัท แทนเจอรีน จำกัด

วันจันทร์ที่ 17 กันยายน พ.ศ. 2555

วิธีการ Block Ultrasurf ให้อยู่หมัดด



Ultrasurf เป็นโปรแกรมทะลุทะลวงบล็อค ครับ 
ไม่ว่าเราจะเขียน script acl บล็อคเว็บไม่เหมาะสม  พวกxxx ต่างๆบน Squid
โปรแกรมนี้ทะลวงบล็อคได้หมดครับ 
สมมติว่า ผมเขียน script บล็อคเว็บ xxx ไว้ ไม่ให้นักเรียนเข้า
แต่ เมื่อเด็กนักเรียนใช้โปรแกรมนี้ เว็บต่างๆที่เราบล็อคไว้ หลุดหมดครับ
ในตัวโปรแกรมนี้ วิ่งผ่านพอร์ต 443 9666 โดยมี www.ultrareach.com เป็นเว็บ proxy ครับ

โค๊ด: [Select]
แก้ Ultrasurf ได้แล้วนะครับ

เครดิตเว็บ http://wow1973.blogspot.com/

วิธีทำ
1. ผมสร้างไฟล์ชื่อ secial.txt  ไว้ที่ /etc/squid/special.txt
โดยที่ ไฟล์ special.txt คือ ชื่อเว็บที่ผม อนุญาตให้เข้าได้ครับ
ในตัวไฟล์ ผมจะพิมพ์ชื่อเว็บ หรือชื่อไอพีของเว็บที่อนุญาต เช่น
hotmail.com
yahoo.com
gmail.com
login.yahoo.com
login.live.com
mail.live.com
65.54.165.136
65.54.165.137
65.54.165.139
65.54.165.169
หรืออะไรก็ว่าไป

2. นำคำสั่งเหล่านี้ ไปแทรกไว้ในตัวไฟล์ชื่อ firewall.iptables ที่ etc/firewall.iptables
หรือใช้คำสั่ง vi /etc/firewall.iptables

IPALLOW=`cat /etc/squid/special.txt | awk ''{print $1}''`
iptables -N DROP_CUSTOM
   for ipall in $IPALLOW
   do
   iptables -A DROP_CUSTOM -s $ipall -j ACCEPT
    iptables -A DROP_CUSTOM -d $ipall -j ACCEPT
   done
iptables -A DROP_CUSTOM -j DROP

iptables -A FORWARD -p tcp --dport 443 -j DROP_CUSTOM
iptables -A FORWARD -p udp --dport 443 -j DROP_CUSTOM

เสร็จแล้ว ทำการ save แล้ว restart เครื่อง แล้ว รอดูผลงาน

Ref : http://www.linuxthai.org/forum/index.php?topic=13401.0

โค๊ด: [Select]
#Block Ultrasurf
iptables -A FORWARD -p tcp --dport 9666 -j DROP
iptables -A FORWARD -p udp --dport 9666 -j DROP

iptables -A INPUT -s 67.15.183.30 -j DROP
iptables -A FORWARD -s 67.15.183.30 -j DROP
iptables -A OUTPUT -s 67.15.183.30 -j DROP

iptables -A INPUT -p tcp -m tcp --dport 9666 -j DROP
iptables -A FORWARD -p tcp -m tcp --dport 9666 -j DROP
iptables -A OUTPUT -p tcp -m tcp --dport 9666 -j DROP

IPALLOW=`cat /etc/squid/special.txt | awk ''{print $1}''`
iptables -N DROP_CUSTOM
   for ipall in $IPALLOW
   do
   iptables -A DROP_CUSTOM -s $ipall -j ACCEPT
    iptables -A DROP_CUSTOM -d $ipall -j ACCEPT
   done
iptables -A DROP_CUSTOM -j DROP

iptables -A FORWARD -p tcp --dport 443 -j DROP_CUSTOM
iptables -A FORWARD -p udp --dport 443 -j DROP_CUSTOM


ใส่เข้าไปด้วยครับ

อีก Trip

ป้องกัน Ultrasurf tips จาก yim แห่งthaibsd
สำหรับ freebsd   ใช้  route add -net 65.49.2.0/24 10.00.2 
สำหรับ linux ใช้ route add -net 65.49.2.0/24 gw 127.0.0.1

ของท่าน chet แห่ง linuxthai
ไฟล์วอลผมครับ

โค๊ด: [Select]
#!/bin/sh
#
# Firewall script for ChilliSpot
# A Wireless LAN Access Point Controller
#
# Uses $EXTIF (eth0) as the external interface (Internet or intranet) and
# $INTIF (eth1) as the internal interface (access points).
#
#
# SUMMARY
# * All connections originating from chilli are allowed.
# * Only ssh is allowed in on external interface.
# * Nothing is allowed in on internal interface.
# * Forwarding is allowed to and from the external interface, but disallowed
#   to and from the internal interface.
# * NAT is enabled on the external interface.

IPTABLES="/sbin/iptables"
EXTIF="eth0"
INTIF="eth1"

#Flush all rules
$IPTABLES -F
$IPTABLES -F -t nat
$IPTABLES -F -t mangle

#Set default behaviour
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -P OUTPUT ACCEPT

#Block Ultrasurf
iptables -A FORWARD -p tcp --dport 9666 -j DROP
iptables -A FORWARD -p udp --dport 9666 -j DROP

$IPTABLES -A INPUT -s 67.15.183.30 -j DROP
$IPTABLES -A FORWARD -s 67.15.183.30 -j DROP
$IPTABLES -A OUTPUT -s 67.15.183.30 -j DROP

$IPTABLES -A INPUT -p tcp -m tcp --dport 9666 -j DROP
$IPTABLES -A FORWARD -p tcp -m tcp --dport 9666 -j DROP
$IPTABLES -A OUTPUT -p tcp -m tcp --dport 9666 -j DROP

#iptables -A FORWARD -p tcp --dport 443 -j DROP_CUSTOM
#iptables -A FORWARD -p udp --dport 443 -j DROP_CUSTOM


IPALLOW=`cat /root/special.txt | awk ''{print $1}''`
iptables -N DROP_CUSTOM
   for ipall in $IPALLOW
   do
   iptables -A DROP_CUSTOM -s $ipall -j ACCEPT
    iptables -A DROP_CUSTOM -d $ipall -j ACCEPT
   done
 iptables -A DROP_CUSTOM -j DROP

# เจอคำพวกนี้ผ่านตา อย่าให้เล็ดลอด
iptables -A FORWARD -m string --string "info_hash" --algo bm --to 65535 -j DROP
iptables -A FORWARD -m string --string ".torrent" --algo bm --to 65535 -j DROP
iptables -A FORWARD -m string --string "get_peers" --algo bm --to 65535 -j DROP
iptables -A FORWARD -m string --string "announce_peers" --algo bm --to 65535 -j DROP

#Allow related and established on all interfaces (input)
$IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

#Allow releated, established and ssh on $EXTIF. Reject everything else.
$IPTABLES -A INPUT -i $EXTIF -p tcp -m tcp --dport 22 --syn -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -j REJECT

#Allow related and established from $INTIF. Drop everything else.
$IPTABLES -A INPUT -i $INTIF -j DROP

#Allow http and https on other interfaces (input).
#This is only needed if authentication server is on same server as chilli
$IPTABLES -A INPUT -p tcp -m tcp --dport 80 --syn -j ACCEPT
$IPTABLES -A INPUT -p tcp -m tcp --dport 443 --syn -j ACCEPT
$IPTABLES -A INPUT -p tcp -m tcp --dport 22 --syn -j ACCEPT

#Allow 3990 on other interfaces (input).
$IPTABLES -A INPUT -p tcp -m tcp --dport 3990 --syn -j ACCEPT

#Allow ICMP echo on other interfaces (input).
$IPTABLES -A INPUT -p icmp --icmp-type echo-request -j ACCEPT

#Allow everything on loopback interface.
$IPTABLES -A INPUT -i lo -j ACCEPT

# Drop everything to and from $INTIF (forward)
# This means that access points can only be managed from ChilliSpot
$IPTABLES -A FORWARD -i $INTIF -j DROP
$IPTABLES -A FORWARD -o $INTIF -j DROP

##### chalee edit
#Allow releated, established and ssh on $EXTIF. Reject everything else.
$IPTABLES -A INPUT -i $EXTIF -p tcp -m tcp --dport 22 --syn -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -p tcp -m tcp --dport 80 --syn -j ACCEPT
$IPTABLES -A INPUT -i $EXTIF -p tcp -m tcp --dport 10000 --syn -j ACCEPT

#Allow 3990 on other interfaces (input).
$IPTABLES -A INPUT -p tcp -m tcp --dport 3990 --syn -j ACCEPT
$IPTABLES -A INPUT -p tcp -m tcp --dport 3128 --syn -j ACCEPT
$IPTABLES -A INPUT -p tcp -m tcp --dport 3306 --syn -j ACCEPT
$IPTABLES -A INPUT -p tcp -m tcp --dport 22 --syn -j ACCEPT
$IPTABLES -A INPUT -p tcp -m tcp --dport 10000 --syn -j ACCEPT

#Enable NAT on output device
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

##Allow transparent proxy ##
$IPTABLES -A INPUT -p tcp -m tcp --dport 8080 --syn -j ACCEPT
$IPTABLES -t nat -A PREROUTING -i tun0 -p tcp -m tcp --dport 8080 --syn -j DROP
$IPTABLES -t nat -A PREROUTING -i tun0 -p tcp -m tcp -d 192.168.0.0/16 --dport 80 -j RETURN
$IPTABLES -t nat -A PREROUTING -i tun0 -p tcp -m tcp -d 172.16.0.0/12 --dport 80 -j RETURN
$IPTABLES -t nat -A PREROUTING -i tun0 -p tcp -m tcp -d 10.0.0.0/8 --dport 80 -j RETURN
$IPTABLES -t nat -A PREROUTING -i tun0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080

# Drop package wrom Virus Input, Output
$IPTABLES -A INPUT -p tcp --dport 135 -j DROP
$IPTABLES -A INPUT -p udp --dport 135 -j DROP
$IPTABLES -A INPUT -p tcp --dport 445 -j DROP
$IPTABLES -A INPUT -p udp --dport 445 -j DROP
$IPTABLES -A INPUT -p tcp --dport 4444 -j DROP
$IPTABLES -A INPUT -p udp --dport 4444 -j DROP
$IPTABLES -A INPUT -p tcp --dport 5554 -j DROP
$IPTABLES -A INPUT -p udp --dport 5554 -j DROP
$IPTABLES -A INPUT -p tcp --dport 9996 -j DROP
$IPTABLES -A INPUT -p udp --dport 9996 -j DROP
$IPTABLES -A INPUT -p tcp --dport 137 -j DROP
$IPTABLES -A INPUT -p udp --dport 137 -j DROP
$IPTABLES -A INPUT -p tcp --dport 138 -j DROP
$IPTABLES -A INPUT -p udp --dport 138 -j DROP
$IPTABLES -A INPUT -p tcp --dport 139 -j DROP
$IPTABLES -A INPUT -p udp --dport 139 -j DROP

$IPTABLES -A OUTPUT -p tcp --dport 135 -j DROP
$IPTABLES -A OUTPUT -p udp --dport 135 -j DROP
$IPTABLES -A OUTPUT -p tcp --dport 445 -j DROP
$IPTABLES -A OUTPUT -p udp --dport 445 -j DROP
$IPTABLES -A OUTPUT -p tcp --dport 4444 -j DROP
$IPTABLES -A OUTPUT -p udp --dport 4444 -j DROP
$IPTABLES -A OUTPUT -p tcp --dport 5554 -j DROP
$IPTABLES -A OUTPUT -p udp --dport 5554 -j DROP
$IPTABLES -A OUTPUT -p tcp --dport 9996 -j DROP
$IPTABLES -A OUTPUT -p udp --dport 9996 -j DROP
$IPTABLES -A OUTPUT -p tcp --dport 137 -j DROP
$IPTABLES -A OUTPUT -p udp --dport 137 -j DROP
$IPTABLES -A OUTPUT -p tcp --dport 138 -j DROP
$IPTABLES -A OUTPUT -p udp --dport 138 -j DROP
$IPTABLES -A OUTPUT -p tcp --dport 139 -j DROP


ส่วนไอพีที่ผมใส่ไปมีแค่นี้ครับ
217.12.8.76
64.4.20.169
97.74.144.165 

Ref : http://wow1973.blogspot.com/




credit : http://www.giffyhackman.com/webboard/index.php?topic=671.0

วันจันทร์ที่ 3 กันยายน พ.ศ. 2555

วันอังคารที่ 28 สิงหาคม พ.ศ. 2555

Acronis True Image Home 2012

Comes with Installer
Serial: AKH7K4E3-XXN4H5BQ-CYP64NAA-WF98JT7T-CLFS3BBM-LKUMEJU4-N78YSFZ8-VZZEYMXW

Registry file to block checking for updates: 
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESOFTWAREAcronisTrueImageHomeSettings]
"AutocheckUpdates"=dword:00000000

Not sure if it still works beyond that however.
Also have user's help guide.

วันพุธที่ 18 กรกฎาคม พ.ศ. 2555

การติดตั้ง bind 9 บน ClearOS 5.2

การติดตั้ง bind 9 บน ClearOS 5.2



สำหรับท่านที่ตั้งค่า squid,frox เรียบร้อยแล้ว อาจจะงงๆ ว่าบางครั้ง patch เก็บบ้างไม่เก็บบ้าง ยกตัวอย่าง
เกมส์ audition อัพแพทช์ผ่าน frox  ชื่อโฮส auto3.asiasoft.co.th  ซึ่งจะมี IP หลาย IP เช่น
122.155.11.6
122.155.11.5
203.144.132.3
203.144.132.4
203.144.132.118
203.144.132.119
203.144.132.120

เวลาอัพมันจะวนไปเรื่อยๆ ไม่ซ้ำกัน ทำให้ squid,frox มองว่าเป็นคนล่ะ ip เลยทำการโหลด patch ใหม่อีก แทนที่จะเรียกของเดิมซ้ำ
ซึ่งต้องแก้ไขด้วยการติดตั้ง bind9 ซึ่งในขณะนี้คือรุ่น 9.3.6
yum install bind-chroot
หรือติดตั้ง package ดังนี้
bind-9.3.6-4.P1.el5_5.3.i386.rpm                
bind-utils-9.3.6-4.P1.el5_5.3.i386.rpm         
bind-chroot-9.3.6-4.P1.el5_5.3.i386.rpm         
bind-libs-9.3.6-4.P1.el5_5.3.i386.rpm

จากนั้น เข้า putty ไป
กำหนด premission ของ folder ดังนี้
chmod 755 /var/named/
chmod 775 /var/named/chroot/
chmod 775 /var/named/chroot/var/
chmod 775 /var/named/chroot/var/named/
chmod 775 /var/named/chroot/var/run/
chmod 777 /var/named/chroot/var/run/named/
cd /var/named/chroot/var/named/
ln -s ../../ chroot
cp /usr/share/doc/bind-9.3.6/sample/var/named/named.local /var/named/chroot/var/named/named.local
cp /usr/share/doc/bind-9.3.6/sample/var/named/named.root /var/named/chroot/var/named/named.root
หากมี bind รุ่นใหม่มาอาจต้องแก้ไปตามรุ่นที่ติดตั้ง /usr/share/doc/bind-9.x.x
จากนั้นสร้าง ไฟล์ด้วย
touch /var/named/chroot/etc/named.conf
ตั้งค่า service bind ทุกครั้งหลัง restart server
chkconfig --levels 235 named on
สั้งให้ service bind ทำงาน
/etc/init.d/named start
หรือจะใช้
service named start

จากนั้นเป็นการแก้ไขค่า config  โดย
cd /var/named/chroot/etc
rndc-confgen > rndc.key
ขั้นตอนนี้อาจมี error บ้างไม่ต้องสนใจ
chown root:named rndc.key
 จากนั้น
nano rndc.key
key "rndckey" {
        algorithm       hmac-md5;
        secret          "7gfPMW2w6DPngANRu2qQww4Cg59utJ2k";
};
จากนั้น แก้ไข file rndc.key ให้เหลือคล้ายๆแบบนี้ บรรทัดอื่นลบไปให้หมด

หมดขั้นตอนนี้ bind9 ก็ใช้งานได้

จากนั้นเรามา เริ่มด้วยการสร้างไฟล์  named.conf
touch /var/named/chroot/etc/named.conf
การแก้ไขไฟล์ name.conf ที่ /var/named/chroot/etc/named.conf
nano /var/named/chroot/etc/named.conf
+++++++++++++++++++++++
// we include the rndckey (copy-paste from rndc.key created earlier)
    include "/var/named/chroot/etc/rndc.key";
// assume our server has the IP 192.168.0.1 serving the 192.168.0.0/24 subnet
    controls {
    inet 127.0.0.1 allow { 127.0.0.1; } keys { "rndckey"; };
    inet 192.168.xx.x allow { 192.168.xx.0/24; } keys { "rndckey"; };
    };
    options {
    directory "/var/named";
    pid-file "/var/run/named/named.pid";
    recursion yes;
    allow-recursion {
    127.0.0.1;
    192.168.xx.0/24;
    };
// these are the opendns servers (optional)
    forwarders {
    8.8.8.8;
    202.69.137.137;
    202.69.137.138;
    203.121.130.39;
    };
    listen-on {
    127.0.0.1;
    192.168.xx.x;
    };
    /*
    * If there is a firewall between you and nameservers you want
    * to talk to, you might need to uncomment the query-source
    * directive below. Previous versions of BIND always asked
    * questions using port 53, but BIND 8.1 uses an unprivileged
    * port by default.
    */
    #query-source address * port 53;
 // so people can't try to guess what version you're running
    version "REFUSED";
    allow-query {
    127.0.0.1;
    192.168.xx.0/24;
    };
    };
    server 192.168.xx.x {
    keys { rndckey; };
    };
++++++++++++++++
เช่น clearos server ip 192.168.2.1 ก็แทน 192.168.xx.x  และในกลุ่ม 192.168.xx.0 ด้วย 192.168.2.0
แล้วแก้ไข nameserver ที่ /etc/resolv.conf
nano /etc/resolv.conf
เพิ่ม
nameserver 192.168.xx.x
nameserver 127.0.0.1

สำหรับ audition เพิ่มสคริปตามนี้ ที่บรรทัดสุดท้่าย ของ named.conf
// AUDITION PATCH SERVER //
    include "/var/named/chroot/etc/audition.zone";



จากนั้นก็ สร้างไฟล์ audition.zone ที่ /var/named/chroot/etc/
nano /var/named/chroot/etc/audition.zone

แล้วใส่สคริปตามนี้
zone "auto1.asiasoft.co.th" {
   type master;
   file "/var/named/chroot/etc/audition1.zone";
};
zone "auto2.asiasoft.co.th" {
   type master;
   file "/var/named/chroot/etc/audition2.zone";
};
zone "auto3.asiasoft.co.th" {
   type master;
   file "/var/named/chroot/etc/audition3.zone";
};
zone "auto4.asiasoft.co.th" {
   type master;
   file "/var/named/chroot/etc/audition4.zone";
};

สร้างไฟล์ audition1.zone (จะต้องสร้าง 4 ไฟล์ audition1-4) ที่ /var/named/chroot/etc/
nano /var/named/chroot/etc/audition1.zone
ใส่สคริปตามนี้
*ไฟล์นี้คือ การกำหนดไอพี (fix host) ที่ต้องการ เช่น ไฟล์ audition1.zone ตั้งค่า auto1.asiasoft.co.th เป็นไอพี 122.155.11.8
และไฟล์ audition2.zone ตั้งค่า auto2.asiasoft.co.th ไอพี 122.155.11.7 เป็นต้น

$TTL 24h
@ IN SOA localhost. root.localhost. (
2003052800 86400 300 604800 3600 )
@ IN NS localhost.
@ IN A 122.155.11.8
* IN A 122.155.11.8

ของ auto2.asiasoft.co.th จะป็น
$TTL 24h
@ IN SOA localhost. root.localhost. (
2003052800 86400 300 604800 3600 )
@ IN NS localhost.
@ IN A 122.155.11.4
* IN A 122.155.11.4

ของ auto3.asiasoft.co.th จะป็น
$TTL 24h
@ IN SOA localhost. root.localhost. (
2003052800 86400 300 604800 3600 )
@ IN NS localhost.
@ IN A 122.155.11.6
* IN A 122.155.11.6

ของ auto4.asiasoft.co.th จะป็น
$TTL 24h
@ IN SOA localhost. root.localhost. (
2003052800 86400 300 604800 3600 )
@ IN NS localhost.
@ IN A 122.155.11.5
* IN A 122.155.11.5

สร้างไปจนครบ 4 ไฟล์

# service named restart
***ตัวอย่างการตั้งค่าเกมส์ xshot โหลดแพทช์ผ่าน squid***
สคริปไฟล์ /var/named/chroot/etc/name.conf
// XSHOT PATCH SERVER //
    include "/var/named/chroot/etc/xshot.zone";
สคริปไฟล์ /var/named/chroot/etc/xshot.zone
zone "patchxshot.winner.co.th" {
   type master;
   file "/var/named/chroot/etc/xshot2.zone";
};
สคริปไฟล์ /var/named/chroot/etc/xshot2.zone
$TTL 24h

@ IN SOA localhost. root.localhost. (
2003052800 86400 300 604800 3600 )
@ IN NS localhost.
@ IN A 202.43.35.174
* IN A 202.43.35.174
แก้ไขไฟล์ squid.conf
refresh_pattern ^http://*.winner.* 14400 90% 43200 ignore-reload override-lastmod reload-into-ims override-expire ignore-no-cache ignore-private
แล้วสั่ง
#service squid reload
ท่านใดงง ลองโหลดไฟล์แนบไปศึกษาดูนะครับ 



วิธีติดตั้ง Bind9 บน ClearOS


วิธีติดตั้ง Bind9 บน ClearOS

yum install bind-chroot
chmod 755 /var/named/
chmod 775 /var/named/chroot/
chmod 775 /var/named/chroot/var/
chmod 775 /var/named/chroot/var/named/
chmod 775 /var/named/chroot/var/run/
chmod 777 /var/named/chroot/var/run/named/

cd /var/named/chroot/var/named/
ln -s ../../ chroot
cp /usr/share/doc/bind-9.3.6/sample/var/named/named.local /var/named/chroot/var/named/named.local
cp /usr/share/doc/bind-9.3.6/sample/var/named/named.root /var/named/chroot/var/named/named.root

touch /var/named/chroot/etc/named.conf

chkconfig --levels 235 named on

service named start

cd /var/named/chroot/etc
rndc-confgen > rndc.key
chown root:named rndc.key

vi /var/named/chroot/etc/named.conf  (แก้ไข หรือ Copy ให้ได้ตามตัวอย่างครับ และเปลี่ยน IP 192.168.1.0 ให้ ตรงกับ SERVER เราด้วย)

###############################################################
// we include the rndckey (copy-paste from rndc.key created earlier)
include "/var/named/chroot/etc/rndc.key";

// assume our server has the IP 192.168.1.254 serving the 192.168.1.0/24 subnet
controls {
inet 192.168.1.254 allow { 192.168.1.0/24; } keys { "rndckey"; };
inet 127.0.0.1 allow { 127.0.0.1; } keys { "rndckey"; };
};

options {
directory "/var/named";
pid-file "/var/run/named/named.pid";

recursion yes;

allow-recursion {
192.168.1.0/24;
127.0.0.1;
};

// these are the opendns servers (optional)
forwarders {
8.8.8.8;
208.67.222.222;
202.69.137.137;
202.69.137.138;
203.121.130.39;
};

listen-on {
192.168.1.254;
127.0.0.1;
};

/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
#query-source address * port 53;

// so people can't try to guess what version you're running
version "REFUSED";

allow-query {

192.168.1.0/24;
127.0.0.1;
};
};

server 192.168.1.254 {
keys { rndckey; };
};
###########################################################

service named start

เครติดคุณ Ton-Or

วันอังคารที่ 15 พฤษภาคม พ.ศ. 2555

เทคนิคการดู พื้นที่ในแต่ละ Folder ของ Linux


เทคนิคการดู พื้นที่ในแต่ละ Folder ของ Linux

IN: LINUX
17Jun2010
วันนี้ Server ที่ทำงานอยู่มีปัญหา Hard disk เต็ม เลยได้โอกาสลองหาวิธีการจัดการดู ถ้าปัญหานี้เกิดบน Mac คงใช้โปรแกรม OmniDisksWeeper ในการตรวจสอบ แต่บน Linux ไม่รู้ใช้ตัวไหนดี เลยลองคำสั่ง classic ดู
$ du / -h | grep "[0-9]G"
du -h คือให้แสดงขนาดของ Folder ออกมาทั้งหมด โดยแสดงขนาดเป็นหน่วยที่คน (h=human) อ่านออก
grep "[0-9]G" คือให้หยิบมาเฉพาะบรรทัดที่มี ตัวเลขตามด้วยอักษร G
ผลที่ได้จะออกมาประมาณนี้
7.6G /home/xxx/.VirtualBox/HardDisks
7.7G /home/xxx/.VirtualBox
18G /home/xxx
20G /home
พอลอง search เพิ่มเติม ก็พบว่ามันสามารถ sort ได้ด้วย
$du -h | grep "[0-9]G" | sort -n -r > du.txt
$du -h | grep "[0-9]G" | sort -n -r | less
ใครอยากดูแบบละเอียดก็เปลี่ยน G เป็น M แทนนะครับ
ที่มา : apirak.com

วันอาทิตย์ที่ 6 พฤษภาคม พ.ศ. 2555

block virus

#!/bin/sh #--- check ip wan ---# ppp0=`ifconfig | grep -A1 ppp0 | tail -1 | cut -d : -f 2 | cut -f 1 -d " "` ppp1=`ifconfig | grep -A1 ppp1 | tail -1 | cut -d : -f 2 | cut -f 1 -d " "` ppp2=`ifconfig | grep -A1 ppp2 | tail -1 | cut -d : -f 2 | cut -f 1 -d " "` #--- check gw wan ---# ppp0_gw=`ip route | grep ppp0 | head -1 | cut -f 1 -d " "` ppp1_gw=`ip route | grep ppp1 | head -1 | cut -f 1 -d " "` ppp2_gw=`ip route | grep ppp2 | head -1 | cut -f 1 -d " "` #--- add new SNAT ---# iptables -t nat -A POSTROUTING -o ppp0 -j SNAT --to-source $ppp0 iptables -t nat -A POSTROUTING -o ppp1 -j SNAT --to-source $ppp1 iptables -t nat -A POSTROUTING -o ppp2 -j SNAT --to-source $ppp2 #iptables -I INPUT -j ACCEPT iptables -I FORWARD -j ACCEPT iptables -I OUTPUT -j ACCEPT iptables -t nat -A PREROUTING -i eth1 -p tcp -m tcp -d 10.0.1.1/20 --dport 3128 -j DROP iptables -t nat -A PREROUTING -i tun0 -p tcp -m tcp -d 10.0.1.1/20 --dport 3128 -j DROP #--- gmember ---# iptables -t nat -I PREROUTING -i eth1 -p tcp -d youtube.com --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d hi5.com --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d facebook.com --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d gmember.com --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 203.151.207.0/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d song.gmember.com --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 174.36.4.0/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 174.36.56.0/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 208.43.218.0/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d rcw.ms --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d forums.overclockzone.com --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d overclockzone.com --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 202.170.126.119/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 216.239.61.100/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 203.144.244.116/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 164.115.2.135/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 174.36.56.184/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 203.146.140.137/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 208.43.218.80/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 38.117.107.188/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 174.36.242.26/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 69.65.59.240/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 209.17.69.4/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i eth1 -p tcp -d 61.19.12.17/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i tun0 -p tcp -d youtube.com --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i tun0 -p tcp -d hi5.com --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i tun0 -p tcp -d facebook.com --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i tun0 -p tcp -d gmember.com --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i tun0 -p tcp -d 203.151.207.0/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i tun0 -p tcp -d song.gmember.com --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i tun0 -p tcp -d 174.36.4.0/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i tun0 -p tcp -d 174.36.56.0/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i tun0 -p tcp -d 208.43.218.0/24 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i tun0 -p tcp -d rcw.ms --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i tun0 -p tcp -d forums.overclockzone.com --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i tun0 -p tcp -d overclockzone.com --dport 80 -j ACCEPT #--- HTTP Proxy service ---# if [ -f /var/run/squid.pid ]; then iptables -t nat -D PREROUTING -s 0/0 -i eth1 -p tcp --dport 80 -j REDIRECT --to-ports 3128 iptables -t nat -D PREROUTING -s 0/0 -i tun0 -p tcp --dport 80 -j REDIRECT --to-ports 3128 iptables -t nat -D PREROUTING -i eth1 -p tcp -d 10.0.1.1 --dport 80 -j ACCEPT iptables -t nat -D PREROUTING -i tun0 -p tcp -d 10.0.1.1 --dport 80 -j ACCEPT iptables -t nat -A PREROUTING -s 0/0 -i eth1 -p tcp --dport 80 -j REDIRECT --to-ports 3128 iptables -t nat -A PREROUTING -s 0/0 -i tun0 -p tcp --dport 80 -j REDIRECT --to-ports 3128 iptables -t nat -I PREROUTING -i eth1 -p tcp -d 10.0.1.1 --dport 80 -j ACCEPT iptables -t nat -I PREROUTING -i tun0 -p tcp -d 10.0.1.1 --dport 80 -j ACCEPT fi iptables -t mangle -A PREROUTING -i tun0 -m state --state NEW -j MULTIWAN_MARK iptables -t mangle -A PREROUTING -i tun0 -m state --state RELATED,ESTABLISHED -j MULTIWAN_RESTORE iptables -t mangle -A PREROUTING -m state --state NEW -j MULTIWAN_MARK iptables -t mangle -A PREROUTING -m state --state RELATED,ESTABLISHED -j MULTIWAN_RESTORE iptables -t mangle -I PREROUTING -j ACCEPT # Algo string iptables -A FORWARD -m string --algo bm --string "BitTorrent" -j DROP iptables -A FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP iptables -A FORWARD -m string --algo bm --string "peer_id=" -j DROP iptables -A FORWARD -m string --algo bm --string ".torrent" -j DROP iptables -A FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROP iptables -A FORWARD -m string --algo bm --string "torrent"" -j DROP iptables -A FORWARD -m string --algo bm --string "announce"" -j DROP iptables -A FORWARD -m string --algo bm --string "info_hash" -j DROP #codered virus iptables -A FORWARD -m string --algo bm --string "/default.ida?" -j DROP #nimda virus iptables -A FORWARD -m string --algo bm --string ".exe?/c+dir" -j DROP iptables -A FORWARD -m string --algo bm --string ".exe?/c_tftp" -j DROP # Block Bit 100% iptables -t filter -I FORWARD -i eth+ -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j DROP iptables -t filter -I FORWARD -i tun0 -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j DROP iptables -t filter -I FORWARD -i ppp+ -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j DROP iptables -t filter -I FORWARD -m ipp2p --kazaa --gnu --edk --dc --bit --apple --soul --winmx --ares -j DROP # bittorrent key iptables -A FORWARD -m string --string "peer_id" --algo kmp --to 65535 -j DROP iptables -A FORWARD -m string --string "BitTorrent" --algo kmp --to 65535 -j DROP iptables -A FORWARD -m string --string "BitTorrent protocol" --algo kmp --to 65535 -j DROP iptables -A FORWARD -m string --string "bittorrent-announce" --algo kmp --to 65535 -j DROP iptables -A FORWARD -m string --string "announce.php?passkey=" --algo kmp --to 65535 -j DROP # ----- Block Bit iptables -A FORWARD -m ipp2p --ipp2p -j DROP iptables -I INPUT -s 0.0.0.0/0 -m string --string "info_hash" --algo bm -j DROP iptables -I INPUT -s 0.0.0.0/0 -m string --string "torrent" --algo bm -j DROP iptables -I INPUT -s 0.0.0.0/0 -m string --string "announce" --algo bm -j DROP # DHT keyword iptables -A FORWARD -m string --string "info_hash" --algo kmp --to 65535 -j DROP iptables -A FORWARD -m string --string "get_peers" --algo kmp --to 65535 -j DROP iptables -A FORWARD -m string --string "announce" --algo kmp --to 65535 -j DROP iptables -A FORWARD -m string --string "announce_peers" --algo kmp --to 65535 -j DROP #--- Block Bit layer7 ---# iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu iptables -I OUTPUT -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu iptables -I FORWARD -m ipp2p --bit -j DROP iptables -I INPUT -m ipp2p --bit -j DROP iptables -I OUTPUT -m ipp2p --bit -j DROP # Drop package wrom Virus Input iptables -I INPUT -p tcp --dport 135 -j DROP iptables -I INPUT -p udp --dport 135 -j DROP iptables -I INPUT -p tcp --dport 4444 -j DROP iptables -I INPUT -p udp --dport 4444 -j DROP iptables -I INPUT -p tcp --dport 5554 -j DROP iptables -I INPUT -p udp --dport 5554 -j DROP iptables -I INPUT -p tcp --dport 9996 -j DROP iptables -I INPUT -p udp --dport 9996 -j DROP iptables -I INPUT -p tcp --dport 137 -j DROP iptables -I INPUT -p udp --dport 137 -j DROP iptables -I INPUT -p tcp --dport 138 -j DROP iptables -I INPUT -p udp --dport 138 -j DROP iptables -I INPUT -p tcp --dport 139 -j DROP iptables -I INPUT -p udp --dport 139 -j DROP # Drop package wrom Virus Output iptables -I OUTPUT -p tcp --dport 135 -j DROP iptables -I OUTPUT -p udp --dport 135 -j DROP iptables -I OUTPUT -p tcp --dport 4444 -j DROP iptables -I OUTPUT -p udp --dport 4444 -j DROP iptables -I OUTPUT -p tcp --dport 5554 -j DROP iptables -I OUTPUT -p udp --dport 5554 -j DROP iptables -I OUTPUT -p tcp --dport 9996 -j DROP iptables -I OUTPUT -p udp --dport 9996 -j DROP iptables -I OUTPUT -p tcp --dport 137 -j DROP iptables -I OUTPUT -p udp --dport 137 -j DROP iptables -I OUTPUT -p tcp --dport 138 -j DROP iptables -I OUTPUT -p udp --dport 138 -j DROP iptables -I OUTPUT -p tcp --dport 139 -j DROP

มาปรับจูน DNS Server

มาปรับจูน DNS Server กันเถอะ(Clear os) Posted on 2011/09/05 DNS เป็นระบบจัดการในการแปลงจากชื่อไปเป็นหมายเลข IP Address (name-to-IP Address mapping) หรือในทางกลับกันมันก็สามารถแปลงจาก IP Address ไปเป็นชื่อที่มีการตั้งไว้ DNS ถือเป็นฐานข้อมูลแบบ กระจายชนิดหนึ่งที่มีการถูกเรียกใช้งานมากที่สุดและมีการเปลี่ยนแปลงมากที่สุดบนโลกใบนี้ ในระบบ DNS จะมี การเก็บชื่อและ IP Address ของเครื่องที่เกี่ยวข้องอย่างเป็นระบบลักษณะการทำงานจะเป็นแบบ Client/Server โดยที่ตัว Server จะเป็นตัวเก็บข้อมูลต่าง ๆ ที่เรียกว่าเป็น DNS Server (ที่มา : http://www.asiamediasoft.net/content/newboard/HowDNS) Dnsmasq เป็น DNS Server ชนิด forwarder+Caching แบบง่ายๆ ตัวเล็ก ประสิทธิภาพสูง (ถึงไม่เท่า Bind ก็เถอะ) และยังสามารถแจก DHCP ได้อีกด้วย ทุกอย่างที่ว่านี้มีอยู่ใน Clark Connect อยู่แล้วครับ ถ้าตอนติดตั้งไม่ลืมเลือกหัว DHCP and Caching DNS Servers มาด้วย จะเกิดอะไรขึ้นถ้า DNS Server หลักล้ม หรือไม่อัพเดทฐานข้อมูล หรืออัพเดทช้า หรือบางเว็บไซต์ที่นิยมๆถูกบล็อกจาก DNS บาง Server ลองนึกสภาพที่ไม่มี DNS Server อยู่ในร้านดูสิครับ จะเกิดอะไรขึ้น!!! เริ่มแรกกันเลย Copy สคิปที่อยู่ด้านล่างไปแทนที่อันเก่าที่ /etc/dnsmasq.conf # The “interface” parameter is set by the network policy (LAN/DMZ interfaces) bogus-priv # maybe make larger cache-size=512 # dhcp-authoritative dhcp-lease-max=1000 # block silly requests domain-needed filterwin2k # domain=system.lan expand-hosts # no-negcache strict-order user=nobody # Can make specific servers here and not use resolv.conf server=203.146.237.237 # csloxinfo 39 server=203.121.130.40 # Pacific 39.9 server=203.144.255.72 # asianet 40.9 server=202.69.137.137 # Triple T Global Net 41 server=202.44.144.33 # KSC 41.5 server=203.146.102.231 # truefaster 42.5 server=203.144.255.71 # asianet 42.8 server=202.129.27.134 # cattelecom 43.6 server=202.69.137.138 # Triple T Global Net 45 server=203.146.237.222 # csloxinfo 48.5 server=202.57.160.129 # Issp 48.9 server=202.6.100.1 # ABAC 50 server=203.121.130.39 # Pacific 51.5 server=203.155.33.1 # KSC 51.9 server=202.44.68.3 # Sripatum 52.7 server=203.144.207.49 # asianet (True) 54.5 server=203.144.207.29 # asianet (True) 58.1 server=202.57.128.71 # SGA 62 server=203.147.0.3 # Jasmine Internet 62.4 server=61.19.245.246 # cattelecom * server=61.19.254.134 # cattelecom * server=202.47.249.4 # cattelecom * server=203.148.255.70 # A-Net * server=203.148.255.78 # A-Net * server=203.149.0.2 # Samart * server=203.149.0.3 # Samart * server=203.146.222.3 # buddybb * server=203.158.144.1 # Rmutp * server=203.146.64.33 # Tnet * server=202.182.0.1 # FarEast * server=202.182.0.2 # FarEast * server=192.150.249.11 # Thammasat * server=208.67.222.222 # OpenDNS 277.8 server=208.67.220.220 # OpenDNS 285.1 # include another configuration conf-file=/etc/dnsmasq/dhcp.conf แก้ไข /etc/resolv.conf ตามสคิปด้านล่าง โค๊ด: nameserver 127.0.0.1 nameserver 192.168.1.1 สั่ง service dnsmasq restart ถ้าใครมีอะไีรเพิ่มเติมหรือชี้แนะ ก็เชิญได้เต็มที่เลยครับ เพราะผมก็ศึกษามาแบบงูๆปลาๆเหมือนกัน ส่วน list รายชื่อ dns server ที่ผมใส่มานั้น ผมได้ใช้เวลาหามาเกือบ 1 วันเต็ม จัดเรียงตามเร็ว (ping x+y+z/n) และคัดอันที่ใช้ไม่ได้หรือมีปัญหาิทิ้งแล้ว และทุกรายชื่อใช้ข้ามค่ายกันได้ครับ ใครมีรายชื่อเพิ่มเติมนอกจากนี้ก็โพทบอกได้เลยครับ (ควรเอา DNS ที่ตรง ISP ไปไว้แรกๆ) หรือถ้าใครอยากศึกษาคำสั่งเพิ่มเติม ก็ไปศึกษาได้ที่นี้เลยครับ http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

วันพุธที่ 29 กุมภาพันธ์ พ.ศ. 2555

ข้อดีของการเช่าในระบบ Cloud Computing

เชื่อมต่อสาขาได้ทันที : เหมาะสำหรับธุรกิจที่มีสาขา และต้องการดูข้อมูลรวมทุกสาขา
Server แรง : SML ลงทุนเครื่อง Server ขนาดใหญ่ และหลายเครื่อง เพื่อให้งานของผู้ใช้ ทำงานรวดเร็ว ไม่สดุด แม้มีจำนวนผู้ใช้มาก
ใช้ได้ตลอดเวลา : ใช้งานได้ตลอด 24 ชม. แม้หน้าร้านปิดไปแล้ว ก็สามารถตรวจสอบข้อมูลที่บ้านได้
ลดการลงทุน : ท่านไม่ต้องซื้อ Server หลายหมื่นบาท และไม่ต้องจ้างพนักงานดูแลระบบ
ประหยัดค่าใช้จ่าย : ไม่ต้องเช่า Internet ความเร็วสูง หรือทำ Fixed IP สำหรับ Server ของท่าน เพราะ Cloud สามารถรองรับการใช้งานพร้อมกันได้ปริมาณมาก และที่สาขาสามารถใช้ Net อะไรก็ได้ เพื่อเข้าใช้ระบบ เช่น 3BB Hotsport ก็แค่เดือนละ 100 แค่นี้ก็เชื่อมสาขาได้ทุกที่
ปลอดภัย : เข้ารหัสถึงสองชั้น เพื่อป้องกันข้อมูลรั่วไหล
รวดเร็ว : ท่านสามารถขึ้นระบบได้ทันที และเชื่อมต่อสาขาได้ทันที
มั่นคง : มีระบบการสำรองข้อมูลให้ทุกเวลา โดยท่านสามารถ Backup ข้อมูลไปเก็บไว้ได้เอง