• 21Oct

    บทความนี้ สอนการสร้าง iSCSI บน Linux ทั้ง Target (Filer /Server) และ Initiator (Slient) สนใจก็ลองศึกษาดูนะครับ

    Linux target framework (tgt) aims to simplify various SCSI target driver (iSCSI, Fibre Channel, SRP, etc) creation and maintenance. The key goals are the clean integration into the scsi-mid layer and implementing a great portion of tgt in user space.

    The developer of IET is also helping to develop Linux SCSI target framework (stgt) which looks like it might lead to an iSCSI target implementation with an upstream kernel component. iSCSI Target can be useful:

    a] To setup stateless server / client (used in diskless setups).
    b] Share disks and tape drives with remote client over LAN, Wan or the Internet.
    c] Setup SAN – Storage array.
    d] To setup loadbalanced webcluser using cluster aware Linux file system etc.

    In this tutorial you will learn how to have a fully functional Linux iSCSI SAN using tgt framework.

    Continue reading »

  • 04Oct

    Q. How do I configure Sender Policy Framework (SPF) anti spam forgery system under Redhat Linux BIND server? I was advised to configure SPF for our corporate domain to identify and reject forged addresses in the SMTP MAIL FROM (Return-Path), a typical nuisance in e-mail spam.

    A. Spammer always tries to spoof e-mail. Normal SMTP allows any computer to send an e-mail claiming to be from anyone. Thus, it’s easy for spammers to send e-mail from forged addresses. This makes it difficult to trace back to where the spam truly comes from, and easy for spammers to hide their true identity in order to avoid responsibility. Many believe that the ability for anyone to forge sender addresses (also known as Return-Paths) is a security flaw in modern SMTP, caused by an undesirable side-effect of the deprecation of source routes.

    Steps to configure Sender Policy Framework

    First, you need to access to DNS server zone files. Some domain registers / ISPs provides front end (control panel) to define SPF records. You need to set a TXT record by editing zone file. It allows you define real IP address of your mail server and other hosts such as webserver.
    Continue reading »

  • 04Oct

    SPF (Sender Policy Framework) เป็นอีกหนึ่งกลไกที่ถูกนำมาใช้ใน ระบบ Internet Mail System โดย SPF version 1 ซึ่งกำลังเริ่มใช้กัน เป็นการเพิ่มข้อมูล(record) เข้าไปใน DNS เพื่อให้ Mail Server ปลายทางสามารถตรวจสอบได้ว่า เมล์ที่ส่งเข้ามา ส่งมาจากต้นทางที่เหมาะสมหรือไม่ มีการปลอมตัวมาส่งหรือไม่


    Continue reading »

  • 24Jul

    http://www.pfsense.org

    http://www.untangle.com/Product-Overview

  • 11Jul

    DNS free สำหรับผู้ที่ต้องการใช้ DNS ที่เป็นกลางและมีความเร็วสูง

    208.67.222.222
    208.67.220.220

     ที่มา: www.opendns.com

     

  • 04Jul

    ส่วนหนึ่งของ พรบ.ด้านคอมพิวเตอร์ ปี 2550 คือต้องปรับเวลาของเครื่องคอมพิวเตอร์ให้ตรงกับเวลามาตรฐาน เพราะจะมีผลต่อ log file ต่างๆ ที่อยู่ในเครื่อง เพื่อการตรวจสอบย้อนหลัง

    ในบทความนี้จะแนะนำวิธีการคอนฟิก NTP ในลินุกซ์ เพื่อให้มีเวลาตรงกับมาตรฐาน โดยจะมีตัวอย่างการคอนฟิกของ Fedora 9

     

    NTP คืออะไร
    NTP ย่อมาจาก Network Time Protocol ถือว่าเป็น protocol หนึ่ง (UDP Port 123) ที่ใช้ในการปรับเวลาของเครื่องต่างๆ ที่อยู่บนเครือข่ายให้มีเวลาตรงกันตลอดเวลา โดยเครื่อง client จะรัน ntpd เพื่อใช้เทียบเวลา server อยู่เรื่อยๆ ตลอดเวลา ซึ่งถ้าเวลาไม่ตรง โปรแกรม ntpd จะค่อยๆ ปรับเวลาของเครื่อง client ให้ใกล้เคียงเรื่อยๆ จนตรงกับ server ในที่สุด

    ในการใช้งาน จะมีวิธีการอ้างอิงเวลาเป็นลำดับขั้นที่เรียกว่า stratum โดยบนเครื่องคอมพิวเตอร์ค่าเริ่มต้นจะตั้งแต่ 1 ซึ่งถือเป็นเวลามาตรฐานกลาง เครื่องที่ทำหน้าที่เป็น stratum 1 นั้น จะมีกระบวนการเทียบเวลาจากอุปกรณ์ชนิดอื่นๆ ที่ไม่ใช่คอมพิวเตอร์  เช่น GPS เป็นต้น (อุปกรณ์จำพวกนี้ ถือว่าเป็น stratum 0, หาอ่านเพิ่มเติมได้จากในส่วนของ ข้อมูลอ้างอิง)

    ตอนคอนฟิก ถ้าเราไม่มีอุปกรณ์ที่เป็น stratum 0 แล้ว เราก็ต้องต่ออินเตอร์เน็ต เพื่ออ้างอิง (sync) เวลามาจากเครื่องที่เป็น stratum 1 และเมื่อเวลาตรงกันแล้ว เครื่องของเราก็จะถือว่าเป็น stratum 2 แล้วถ้าเครื่องที่มาอ้างอิงเวลาจากเครื่องนี้อีกที ก็จัดเป็น stratum 3, 4 เรื่อยๆ

    ประโยชน์ในการจัดเป็น stratum คือจะลดโหลดที่เกิดขึ้น คือแทนที่ทุกเครื่องจะไปอ้างอิง (sync) เวลามาจาก stratum 1 ก็กระจายโหลดไป ทั้งลดโหลดบน stratum 1 เอง แล้วก็ประหยัด bandwidth อินเตอร์เน็ตด้วย

    คำแนะนำ : ในทางปฎิบัติ แนะนำให้คอนฟิก NTP บนเครื่องเดียวหรือสองเครื่อง ที่ต่ออินเตอร์เน็ตได้ ให้ไปเทียบเวลาจาก  stratum 1 ส่วนเครื่องอื่นๆ ในสำนักงานของเรา ก็คอนฟิกเพื่อมาเทียบเวลาจากเครื่องนี้แทน หรืออาจจะมี ลำดับ 3, 4 ต่อไปอีกก็ได้ แล้วแต่จำนวนเครื่องที่มีอยู่ เช่น มีเครื่องที่ทำหน้าที่ stratum 2 ที่ต่ออินเตอร์เน็ตอยู่ 2 เครื่อง แล้วมี stratum 3 อีกจำนวนหนึ่งของแต่ละฝ่าย ส่วนเครื่อง client ที่อยู่ในฝ่ายก็คอนฟิกให้เทียบเวลาจาก stratum 3 อีกที ก็จะเป็น statum 4

    เริ่มคอนฟิก NTP
    โดยดีฟอลต์แล้ว NTP จะติดตั้งมาพร้อมกับ Fedora และจะมีคอนฟิกไฟล์หลักคือ /etc/ntp.conf ในคอนฟิกจะอ้างอิงเวลากับ stratum 1 ซึ่งเป็น time server จำนวน 3 ตัว ซึ่งเป็นของทาง redhat.com แต่ถ้าดูแล้วยังไม่มีการติดตั้ง ก็ติดตั้ง rpm ที่ชื่อ ntp-4.2.4p4-6.fc9

    ตัวอย่างคอนฟิก NTP ที่ติดตั้งมากับ Fedora 9

    [root@server ~]# cat /etc/ntp.conf
    ...
    # Use public servers from the pool.ntp.org project.
    # Please consider joining the pool (http://www.pool.ntp.org/join.html).
    server 0.fedora.pool.ntp.org dynamic
    server 1.fedora.pool.ntp.org dynamic
    server 2.fedora.pool.ntp.org dynamic
    ...

    หลังจากตรวจสอบการติดตั้งและคอนฟิก ขั้นต่อไปคือการรัน service โดยจะมี ntpdate และ ntpd ที่ต้องรัน ntpdate จะเป็นโปรแกรมที่รันครั้งเดียวปรับเวลาของเครื่องให้ใกล้เคียงกับ server มากที่สุด ส่วนการปรับโดยละเอียดจะเป็นหน้าที่ของ ntpd ซึ่งจะรันเป็น daemon อยู่ตลอดเวลา ค่อยๆ ปรับเวลาให้ตรงกับ server ซึ่งบางครั้งต้องใช้เวลานานพอสมควร

    ในตัวอย่าง จะแสดงการรันคำสั่ง พร้อมทั้งข้อความที่ขึ้นในไฟล์ /var/log/messages ด้วย เพื่อแสดงสถานะการปรับเวลา

    ตัวอย่างการรัน service NTP

    [root@server ~]# /etc/init.d/ntpdate start
    Aug 31 22:02:55 server ntpdate[20097]: step time server 66.187.233.4 offset -47.741249 sec
    [root@server ~]# /etc/init.d/ntpd start
    Aug 31 22:05:43 server ntpd[20149]: ntpd 4.2.4p4@1.1520-o Mon Apr  7 17:39:41 UTC 2008 (1)
    Aug 31 22:05:43 server ntpd[20150]: precision = 22.000 usec
    Aug 31 22:05:43 server ntpd[20150]: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled
    Aug 31 22:05:43 server ntpd[20150]: Listening on interface #1 wildcard, ::#123 Disabled
    Aug 31 22:05:43 server ntpd[20150]: Listening on interface #2 lo, ::1#123 Enabled
    Aug 31 22:05:43 server ntpd[20150]: Listening on interface #3 eth0, fe80::20c:29ff:feef:f18c#123 Enabled
    Aug 31 22:05:43 server ntpd[20150]: Listening on interface #4 lo, 127.0.0.1#123 Enabled
    Aug 31 22:05:43 server ntpd[20150]: Listening on interface #5 eth0, 192.168.1.1#123 Enabled
    Aug 31 22:05:43 server ntpd[20150]: kernel time sync status 0040
    Aug 31 22:09:59 server ntpd[20150]: synchronized to 66.187.233.4, stratum 1
    Aug 31 22:09:59 server ntpd[20150]: time reset -0.299785 s
    Aug 31 22:14:30 server ntpd[20150]: synchronized to 66.187.224.4, stratum 1

    การใช้คำสั่ง ntptrace เพื่อแสดงสถานะ stratum
    เราสามารถใช้คำสั่ง ntptrace เพื่อตรวจสอบว่า ตอนนี้เครื่องของเรา เป็น stratum เท่าไร ซึ่ง stratum 16 หมายถึง เครื่องของเรายังไม่สามารถปรับเวลาให้ตรงกับ stratum 1 ได้ ต้องใช้เวลา

    [root@server etc]# ntptrace
    server.spalinux.com: stratum 16, offset 0.000000, synch distance 0.001800

    เมื่อเวลาผ่านไปซักพัก เมื่อเครื่องของเราสามารถปรับเวลาให้ตรงได้แล้ว จะมีข้อความดังตัวอย่าง ขึ้นในไฟล์ /var/log/messages

    Aug 31 22:22:01 server ntpd[20150]: synchronized to 66.187.233.4, stratum 1
    Aug 31 22:25:59 server ntpd[20150]: time reset -0.271322 s
    Aug 31 22:25:59 server ntpd[20150]: kernel time sync status change 0001
    Aug 31 22:35:18 server ntpd[20150]: synchronized to 66.187.233.4, stratum 1

    ซึ่งถ้าเราใช้คำสั่ง ntptrace ตรวจสอบดู จะเห็นว่าเครื่องของเรากลายเป็น stratum 2 แล้ว ซึ่งถือว่าเครื่องเรามีเวลาเป็นมาตรฐานแล้ว

    [root@server etc]# ntptrace
    server.spalinux.com: stratum 2, offset 0.014226, synch distance 0.225802
    clock1.redhat.com: stratum 1, offset -0.000001, synch distance 0.000330, refid 'CDMA'

    การเปิด server ตอนบู๊ตเครื่อง
    สุดท้ายอย่าลืมเปิด service ทั้งสองอัน สำหรับตอนบู๊ตเครื่องด้วย ซึ่งสามารถทำได้ตามตัวอย่าง

    ตัวอย่างการเปิด server NTP สำหรับตอนบู๊ตเครื่อง

    [root@server etc]# chkconfig ntpd on
    [root@server etc]# chkconfig ntpdate on
    [root@server etc]# ls -l /etc/rc3.d/*ntp*
    lrwxrwxrwx 1 root root 17 2008-08-31 22:07 /etc/rc3.d/S57ntpdate -> ../init.d/ntpdate
    lrwxrwxrwx 1 root root 14 2008-08-31 22:07 /etc/rc3.d/S58ntpd -> ../init.d/ntpd

    การคอนฟิก NTP สำหรับเครื่อง Client
    ส่วนการคอนฟิกในเครื่องอื่นๆ นั้น ถ้าเป็นลินุกซ์ก็แก้ไฟล์ /etc/ntp.conf ให้ชี้มาเครื่องที่เราคอนฟิกเป็น stratum 2 นี้ หรือถ้าเป็น Windows XP สามารถ double-click ที่เวลาแล้วเลือกไปที่ Internet Time คลิกเพื่อเลือก [x] Automatically synchronize with an Internet time server แล้วใส่ server ให้เป็น ip address ของเครื่อง stratum 2 สุดท้ายก็กด Update Now ถ้าถูกต้องจะมีข้อความขึ้นเป็น  The time has been successfully synchronized with 192.168.1.1 on 31/08/08 at 10:46 PM.

    ที่มา: http://spalinux.com/2008/08/configure_ntp_on_linux

  • 04Jul

    step ที่ 1
    #yum install ntp

    step 2
    # crontab -e

    step 3
    # vi /etc/ntp.conf
    สำหรับบันทัดนี้ มันจะเป็นแหล่งที่เรา ไป sync กับตัว หลัก
    server clock.nectec.or.th prefer
    บันทัดนี้ สำหรับ server รอง
    server 202.142.213.175
    อนุญาติให้ ทุกๆ client ติดต่อสั่ง ntpdate ได้
    restrict 0.0.0.0 mask 0.0.0.0 nomodify

    step 4
    # chkconfig ntpd on
    # vi /etc/sysconfig/ntpd
    SYNC_HWCLOCK=yes
    (write the sync time to CMOS)

    Final
    # pgrep ntpd
    (checking the ntpd process ID)
    # netstat -ntlup
    (checking the sync status)
    # ntpq -p
    (checking the port’s status)
    configure the firewall rule, make sure the UDP:123 is accept.
    #service ntpd start
    (start the ntp server)
    Client may get the ntpserver time after 5~10 min.

  • 10May

    ปัญหาการใช้ resource สูงผิดปกติของผู้ใช้บางราย แต่เมื่อทำการ ps ดู กลับไม่สามารถดูได้ เนื่องจากทุก process เป็นของ user ชื่อ www-data 

    ดังนั้นการที่จะทำให้สามารถตรวจสอบว่า script ของผู้ใช้รายใดมีปัญหา จึงต้องใช้เทคนิค MaxRequestsPerChild

    ต่อไปเป็นวิธีการที่มีผู้เขียนบทความไว้ดังนี้ Continue reading »

  • 12Mar

    ตอนที่ 1-9

    ตอนที่ 1 การออกแบบเครือข่าย และเตรียมอุปกรณ์ก่อนการติดตั้ง ( Planning )
    ตอนที่ 2 การติดตั้งโปรแกรม ClarkConnect 4.2 Enterprise (Installation)
    ตอนที่ 3 หน้าตาโปรแกรม ClarkConnect (Console / Webbase Config)
    ตอนที่ 4 การเชื่อมต่ออินเตอร์เน็ต (Network Configuration)
    ตอนที่ 5 การลงทะเบียน ClarkConnect (Register)
    ตอนที่ 6 การอัพเดทและลงโปรแกรมเพิ่ม (Update)
    ตอนที่ 7 การเชื่อมต่ออินเตอร์เน็ตแบบหลายเส้น ( Multi-WAN 1 )
    ตอนที่ 8 การเชื่อมต่ออินเตอร์เน็ตแบบหลายเส้น ( Multi-WAN 2 iptables )
    ตอนที่ 9 ปรับแต่ง Firewall ให้ Create Dot A ( Port forwarding )

    http://www.hadyaiinternet.com/datasheet/CC42-xxxkung.pdf

    ตอนที่ 10 – 19

    ตอนที่ 10 ติดตั้ง WebProxy เพิ่มความเร็วให้เน็ต ( Squid )
    ตอนที่ 11 การปรับแต่ง squid.conf
    ตอนที่ 12 ติดตั้ง FTP Proxy เก็บแพทเกมส์ ( Frox )
    ตอนที่ 13 การปรับแต่ง frox.conf
    ตอนที่ 14 ติดตั้ง Samba สำหรับแชร์ไฟล์ (Windows Files Sharing)
    ตอนที่ 15 การปรับแต่งระบบเส้นสำรองแทนเส้นหลักที่มีปัญหา ( failed over )
    ตอนที่ 16 ระบบ VPN เชื่อมต่อมาจากภายนอก
    ตอนที่ 17 ระบบป้องกันเวปที่ไม่พึงประสงค์ (Web Filtering )
    ตอนที่ 18 ระบบบันทึกข้อมูลการใช้งานของผู้ใช้ เป็นเวลา 90 วัน (Logging)
    ตอนที่ 19 การดูแลรักษา และแก้ปัญหาเบื้องต้น