This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions..

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions..

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions..

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions..

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions..

วันอังคารที่ 21 มกราคม พ.ศ. 2557

รายการไอพีที่ใช้ในประเทศไทย ทั้งหมด

เป็นรายการไอพีทั่วโลกแต่เราจะมากรองเอาแต่ของไทย
#wget ftp://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest
#wget ftp://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-extended-latest

 shell script แปลง


#!/bin/sh
#
# Classify ipv4 for TH and others
#
# Created: May 24, 2008
# By Manatsarin W.
#
#
SRC_DB="delegated-apnic-latest"
TH_DB="th_ipv4.db"
#
# Backup old database
mv $TH_DB $TH_DB.old 2> /dev/null
#
cat $SRC_DB | while read LINE; do
# Example of delegate file format from apnic.net:
# apnic|TH|ipv4|58.8.0.0|131072|20050208|allocated
# Col 1 = Registry {apnic}
# Col 2 = CC(Country Code)
# Col 3 = Type {asn,ipv4,ipv6}
# Col 4 = Network address
# Col 5 = Number of hosts
# Col 6 = Date allocation/assignment (YYYYMMDD)
# Col 7 = Status {allocated, assigned}
# Col 8 = Extensions
COUNTRY=`echo $LINE | awk -F "|" '{print $2}'`
if [ "$COUNTRY" = "TH" ]; then
TYPE=`echo $LINE | awk -F "|" '{print $3}'`
if [ "$TYPE" = "ipv4" ]; then
NETADDR=`echo $LINE | awk -F "|" '{print $4}'`
HOSTS=`echo $LINE | awk -F "|" '{print $5}'`
case "$HOSTS" in
'131072')
# 131072 = 2^17 --> network = 32-17 = 15 bits
# netmask = (128+64+32+16+8+4+2+1).(128+64+32+16+8+4+2+0).0.0 = 255.254.0.0
NETMASK="255.254.0.0"
;;
'65536')
# 65536 = 2^16 --> network = 32-16 = 16 bits
NETMASK="255.255.0.0"
;;
'32768')
# 32768 = 2^15 --> network = 32-15 = 17 bits
NETMASK="255.255.128.0"
;;
'16384')
# 16384 = 2^14 --> network = 32-14 = 18 bits
NETMASK="255.255.192.0"
;;
'8192')
# 8192 = 2^13 --> network = 32-13 = 19 bits
NETMASK="255.255.224.0"
;;
'4096')
NETMASK="255.255.240.0"
;;
'2048')
NETMASK="255.255.248.0"
;;
'1024')
NETMASK="255.255.252.0"
;;
'512')
NETMASK="255.255.254.0"
;;
'256')
NETMASK="255.255.255.0"
;;
'*')
echo "Unknow hosts value: $HOSTS"
NETMASK="Unknow"
;; 
printf "%s|%s|%s|%s\n" "$COUNTRY" "$NETADDR" "$HOSTS" "$NETMASK" >> $TH_DB
#printf "|%s|\n"  "$NETADDR"   >> $TH_DB
fi
fi
done

ตัวนี้เป็นเอาไปใส่ firewall
 #!/bin/sh
#
# Using iptables to mark international traffic.
#
IPT=/usr/sbin/iptables
IF_EXT=eth1
TH_DB="th_ipv4.db"
DOM_MARK="0x11"
INT_MARK="0x12"
#
$IPT -t mangle -F
cat $TH_DB | while read LINE; do
NET_ADDR=`echo $LINE | awk -F "|" '{print $2}'`
NET_MASK=`echo $LINE | awk -F "|" '{print $4}'`
# If source address is in TH, do nothing.
$IPT -t mangle -A PREROUTING -i $IF_EXT -s $NET_ADDR/$NET_MASK -j RETURN
done
# Otherwise, mark packets as international traffic.
$IPT -t mangle -A PREROUTING -i $IF_EXT -j MARK --set-mark $INT_MARK

#ที่มา http://ctc.kbu.ac.th/manatsarin/2008/06/24/thailand-ip-address-classification/

 

วันอังคารที่ 14 มกราคม พ.ศ. 2557

Boot usb ใน VitrualBox

ก่อนอื่นต้องมี USB ที่ boot ได้ก่อน
คลิกขวาที่ Computer เลือก Manage แล้วเลือก Disk Management ตามรูป



 จะเห็นได้ว่า USB เราเป็น Disk ที่เท่าไร จากตัวอย่างเป็น Disk1
 จากนั้นเข้า cmd ด้วยสิทธิ์ Administator พิมพ์ 
cd "C:\Program Files\Sun\VirtualBox"  คือเข้าไปยัง path ไฟล์ของ VirtureBox
แล้วต่อด้วยพิมพ์
VBoxManage internalcommands createrawvmdk -filename "%USERPROFILE%\usb.vmdk" -rawdisk\\.\PhysicalDrive1
สังเกตุที่่  PhysicalDrive1 ก็คือ Disk1 นั้นเอง

จากนั้นระบบจะเจนไฟล์ usb.vmdk จาก usb ให้เรา จากนี้เราก็ไปตั้งค่า boot ได้เลยครับ