วันจันทร์ที่ 18 มิถุนายน พ.ศ. 2555

CentOS 5.5 ติดตั้ง ไทยฟอนท์

ดาวน์โหลดฟอนท์

# wget ftp://linux.thai.net/pub/ThaiLinux/software/thai-ttf/thai-ttf-0.4.9.tar.gz

แตกไฟล์
# tar xvfz thai-ttf-0.4.9.tar.gz

เข้าไปที่ไดเรคทอรี
# cd thai-ttf-0.4.9

สร้างไดเรคทอรี่
# mkdir /usr/share/fonts/thai-ttf

คัดลอกฟอนท์ไปที่ไดเรคทอรี่ที่สร้างไว้
# cp . /usr/share/fonts/thai-ttf/

เพิ่มรายการฟอนท์ไทย เข้าไปในระบบ
# chkfontpath -a /usr/share/fonts/thai-ttf

ตรวจสอบฟอนท์ในระบบ
#chkfontpath -l

Restart เครื่อง
# shutdown -r now

FreeBSD: mount cdrom

 ตรวจสอบดูว่า ระบบตรวจสอบอุปกรณ์ อะไรพบบ้าง
# dmesg

acd0: CDRW at ata1-master UDMA33
ums0: on usbus1
rl0: port 0xdc00-0xdcff mem 0xdfdfff00-0xdfdfffff irq 17 at device 10.0 on pci3
fdc0: port 0x3f2-0x3f3,0x3f4-0x3f5,0x3f7 irq 6 drq 2 on acpi0
ad0: 152627MB at ata0-master UDMA100


# mkdir /mnt/cdrom
# mount /dev/acd0 /mnt/cdrom

FreeBSD: How to install and configure a FreeBSD 8 Desktop with Xorg and KDE?

http://rhyous.com/2009/12/18/how-to-install-and-configure-a-freebsd-8-desktop-with-xorg-and-kde/

FreeBSD: ports/pkg command

Ports :
http://www.freebsd.org/doc/handbook/ports-using.html

# cd /usr/ports/www/apache22
# less Makefile               ; aplication info
# make instal                  ; install pakages
# make clean                  ; delete complie files
# make install && make clean
# make install clean         ; install and delete complie files
# make fetch                  ; load all files before install
# make search name=apache              ; search  apache port

# make build-depends-list                   ;
# make run-depends-list                     ;
# make fetch-recursive





Package :

# less pkg-descr

# pkg_info | less                ; installed pakages
# pkg_version -v               ; verify installed pakages version
# ll /var/db/pkg


# pkg_add -r kde              ; install kde pakage
# rehash                            ; regenerates system's cached

FreeBSD: Upgrade ports โดยโปรแกรม CVSUP

การ Upgrade FreeBSD ports  โดยโปรแกรม CVSUP (current version system update)

ขั้นตอน


1. ติดตั้งโปรแกรม

# cd /usr/ports/net/cvsup-without-gui
# make install clean


   จะดาวน์โหลดไฟล์และติดตั้ง ประมาณ30 นาที
    cvsup-16.1h_4
    ezm33-1.2.1         10 MB


2. กำหนด server ที่จะไปดาวโหลดไฟล์สำหรับ upgrade

# cp /usr/share/examples/cvsup/ports-supfile  /root
# ee /root/ports-supfile

*default host=cvsup.tw.freebsd.org      

*default base=/var/db
*default prefix=/usr
*default release=cvs tag=.
*default delete use-rel-suffix

กด control+c
: exit


3. การ upgrade ports

# cvsup -g -L 2 ports-supfile

FreeBSD: Install jdk16 on FreeBSD81


# cd /usr/ports/java/jdk16
# make build-depends-list

# make fetch-recursive

Port ไม่สามารถที่จะดาวน์โหลด Java อัตโนมัติ เนื่องจากต้องมีการยอมรับใน Term and Condition ในการที่จะใช้งาน Java จึงต้องดาวน์โหลดเอง ไปเก็บไว้ที่ /usr/ports/distfiles

# cd /usr/ports/distfiles
#fetch http://www.badcode.net/tzupdater-1_3_29-2010f.zip
# fetch ftp://www.kuzbass.ru/pub/freebsd/mix/bsd-jdk16-patches-4.tar.bz2
# fetch http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-bin-b05-jrl-24_sep_2007.jar
# fetch http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-src-b05-jrl-24_sep_2007.jar
# fetch http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-mozilla_headers-b05-unix-24_sep_2007.jar

ไฟล์ ที่เหลืออื่นๆให้ ports ดาวน์โหลดให้เอง
# cd /usr/ports/java/jdk16
# make install clean

ระหว่าง ติดตั้ง
ตอบ yes เพื่อยอมรับ license

FreeBSD: Restart Interface Network Card

Restart Interface Network Card
#/etc/rc.d/netif restart

FreeBSD: Install บน VirtualBox แบบ Text mode

[1] บูทเครื่องจากแผ่นติดตั้งใน VirtualBox
     เลือกติดตั้งแบบ Text Mode
       1. Thailand
       2. USA (ISO)
       3. Standard installation
       4. standard install a standard MBR (No Boot Manager)
       5.  Create patition
               5.1 A = entire disk
                     c = create (all size = 165)
                     q = quit

               5.2 Standard Install a standard MBR (no boot manager)

                          A = Create patition
                          c = create (all size = 165)
                          q = quit

                 สร้าง Partition (โดยประมาณ)
                 /           768M
                 swap     512M
                  /tmp    512M
                  /var     768M
                  /usr     8G

       6. Choose distribution
           Custom
            [x]  base
            [x]  kernels
            [x]  Document --> EN
            [x]  man
            [x]  src  --> all  --> ยกเว้น game
            [x] ports

        7. Choose Installation Media
            CD/DVD

        ตอบคำถามระหว่างติดตั้ง

Last Chance:
Yes    :Ethernet Adapter
No    :IPV6
No    :DHCP
Yes     :Brink interface up
No     :machine to be a network gateway
No     :would like to configure inetd and network services
YES         :enable SSH (secure shell) login
No        :anonymous FTP access to this machine
No    :Fuction as an NFS Server
No    :Fuction as an NFS client
Yes    :Customize console setting
Yes         :Time zone
No         : CMOS
         - Asia
         - 44 Thailand
Yes     :Set Clock to UTC ?

No    : enable Linux binary compatibility
Yes     : browse the applications
YES        : add a user account.
                    member groups = [wheel] ; to allow the user to become root/administrator  
No        : Visit the general configuration menu for a chance to set any last options ?
   
[exit install]

ตรวจสอบหลังติดตั้ง

ตรวจสอบเนื้อที่ ฮาร์ดดิส
     # df -h  
Filesystem     Size        Used   Avail Capacity  Mounted on
/dev/ad0s1a    859M    172M    618M    22%     /
devfs              1.0K     1.0K      0B       100%    /dev
/dev/ad0s1d    496M    12K      456M     0%     /tmp
/dev/ad0s1f     19G      1.4G     16G     8%      /usr
/dev/ad0s1e    989M    534K    910M     0%     /var

บางครั้งติดตั้งใน virtual box แล้ว CPU ของเครื่อง Peak ให้เพิ่มคำสั่ง แล้ว reboot เครื่องใหม่
#ee /boot/loader.conf
kern.hz=100

FreeBSD: Ports update โดย CSUP

1. สำรองไฟล์ config เดิมเก็บไว้
# cp /usr/share/examples/cvsup/ports-supfile  /usr/share/examples/cvsup/ports-supfile-ori

2. แก้ไข Server ที่จะดาวโหลดไฟล์
# ee /usr/share/examples/cvsup/ports-supfile



เช่น
*default host=cvsup.sg.FreeBSD.org
*default host=cvsup5.jp.FreeBSD.org

ดูเซิร์ฟเวอร์ทั้งหมดได้จาก
http://www.freebsd.org/doc/en/books/handbook/cvsup.html.
ping -c 5 cvsup5.jp.freebsd.org


อัพเดท Ports
To update the ports collection
# csup -g -L 2 /usr/share/examples/cvsup/ports-supfile
# rehash

FreeBSD: Kernel compile

ตรวจ Kernel source ว่ามีหรือไม่:
   1. ดูว่ามีไดเรคทรอรี /usr/src/sys หรือไม่ ถ้าไม่มีให้ติดตั้ง

# cd /usr/src/sys/i386/conf/
# mkdir /root/kernels
# cp GENERIC /root/kernels/NewKernel
# ln -s /root/kernels/NewKernel

    2. แก้ไข option ที่ต้องการให้รองรับ สำหรับ Kernel ใหม่

# ee NewKernel

#cpu            I486_CPU
#cpu            I586_CPU
  cpu             I686_CPU
  ident           Kernel_with_NAT

#<-- ถ้าต้องการเพิ่ม option NAT 

options         IPDIVERT                                        # enable NAT

#<<-- Firewall
options         IPFIREWALL                                     # enable Firewall
options         IPFIREWALL_VERBOSE                      # ipfw logging
options         IPFIREWALL_VERBOSE_LIMIT=120    # limit to 120 identical log entri
options         IPFIREWALL_DEFAULT_TO_ACCEPT  #
options         IPFIREWALL_FORWARD      # port forward

options         MROUTING

options         QUOTA
options         HZ=100                              # origial HZ=1000 : reduce high CPU consume
options         DEVICE_POLLING

#<-- ถ้าต้องการเพิ่ม Traffic Shaping

options         DUMMYNET
options         ALTQ
options         ALTQ_CBQ                # class Bases Queuing(CBQ)
options         ALTQ_RED                # Random Early Detection (RED)
options         ALTQ_RIO                # RED in/out
options         ALTQ_HFSC               # Hierachical Packet Scheduler (HFSC)
options         ALTQ_PRIQ               # Priority Queuing(PRIQ)
options         ALTQ_NOPCC            # Required for SMP build


#<-- ถ้าต้องการเพิ่ม Packet Filter

device          pf
device          pflog
device          pfsync





----------------------------------------------------------------------


เริ่ม Compile
# config NoomKernel
# cd /usr/src/sys/i386/compile/NewKernel
# make; make install              
# make cleandepend && make depend
# reboot

# uname -a
FreeBSD a1.aculala.com 8.2-RELEASE-p2 FreeBSD 8.2-RELEASE-p2 #0: Thu Jul 21 12:54:15 ICT 2011    
pee@a1.aculala.com:/usr/src/sys/i386/compile/NewKernel  i386

FreeBSD: Name Server

ขั้นตอนกำหนดค่า Name Server
1. ตรวจสอบ ว่าติดตั้ง Name Server แล้วหรือยัง (ปกติ จะมีติดตั้งมาพร้อมกับ OS)

# named -v
BIND 9.8.1-P1

  ---------- สำหรับ ป้องกันคำสั่ง make ไม่ไให้  build BIND เป็น base version  --------------------
                  กรณีที่ rebuild FreeBSD จาก source

#cp /etc/make.conf /etc/make.conf-original
#echo "NO_BIND = YES" >> /etc/make.conf   

 ------------- Backup config file ------------------

# cd /var/named/etc/namedb
# cp named.conf named.conf-original

-------------- กำหนดชื่อแบบ Local host ------------------
#/ee /etc/hosts
::1                          localhost localhost.aculala.com
127.0.0.1               localhost localhost.aculala.com


------------ Generate Key ให้กับ Name Server ----------
# rndc-confgen -a
# cat rndc.key >> named.conf

--------------- กำนด ชื่ออ้างอิงและที่อยู่ไฟล์อ้างอิง -------

# ee /var/named/etc/namedb/named.conf
// line 21 comment

//      listen-on       { 127.0.0.1; };

//line (~43-47)

forwarders {
        8.8.8.8; 203.144.255.71; 203.144.255.71;
};

// ------- เพิ่ม Zone file ท้ายไฟล์

zone "name.com" {
    type master;
    file "/etc/namedb/master/name.com";
    allow-transfer { localhost; };
    allow-update { key rndc-key; };
};

zone "1.0.24.in-addr.arpa" {
    type master;
    file "/etc/namedb/master/name.com.rev";
    allow-transfer { localhost; };
    allow-update { key rndc-key; };
};



-----------------------------------------------

# cd /var/named/etc/namedb/master
# ee name.com

$TTL    3600

name.com.   IN    SOA   n1.name.com.    root.name.com. (
                                1            ;           Serial
                                10800    ;           Refresh
                                3600      ;           Retry
                                604800  ;           Expire
                                86400 )  ;           Minimum TTL
;DNS Servers
name.com.         IN      NS              n1.name.com.                

;Machine Names
n1.name.com.    IN      A                   24.0.1.25    

;Aliases
www                          IN      CNAME             n1.name.com.  

;MX Record
name.com.         IN      MX      10      n1.name.com.  

------------ Reverse lookup  file --------------------------------------

# ee name.com.rev
$TTL    3600

1.0.24.in-addr.arpa. IN  SOA n1.name.com.  root.name.com.   ( 
                       1       ;       Serial
                       10800   ;       Refresh
                       3600    ;       Retry
                       604800  ;       Expire
                       86400 ) ;       Minimum TTL
;DNS Servers
1.0.24.in-addr.arpa.   IN      NS              n1.name.com.  

;Machine IPs
11                     IN      PTR             n1.name.com.
11                     IN      PTR             www.name.com.


----------------------------------------------------------------------

# cd /var/named/etc/namedb/master
# cp name.com ../dynamic
# cp name.com.rev ../dynamic
# chown -R bind /var/named/etc/namedb/dynamic

------------ กำหนดชื่อ Domain Name Server สำหรับการค้นหาชื่อ Domain
# ee /etc/resolv.conf
domain noomloveu.com
nameserver 127.0.0.1
nameserver 24.0.1.1
nameserver 8.8.8.8


------------ สั่งให้ Start Name Server เมื่อ Boot เครื่อง -------------
#echo named_enable="YES"  >> /etc/rc.conf
# /etc/rc.d/named onestart
# /etc/rc.d/named status


------------ทดสอบ ---------------------

# dig google.com

; <<>> DiG 9.8.1-P1 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26857
;; flags: qr rd; QUERY: 1, ANSWER: 11, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;google.com.                    IN      A

;; ANSWER SECTION:
google.com.             106     IN      A       173.194.38.130
google.com.             106     IN      A       173.194.38.131
google.com.             106     IN      A       173.194.38.132
google.com.             106     IN      A       173.194.38.133
google.com.             106     IN      A       173.194.38.134
google.com.             106     IN      A       173.194.38.135
google.com.             106     IN      A       173.194.38.136
google.com.             106     IN      A       173.194.38.137
google.com.             106     IN      A       173.194.38.142
google.com.             106     IN      A       173.194.38.128
google.com.             106     IN      A       173.194.38.129

;; Query time: 43 msec
;; SERVER: 24.0.1.1#53(24.0.1.1)
;; WHEN: Fri Apr 27 00:12:09 2012
;; MSG SIZE  rcvd: 204

# dig name.com axfr

FreeBSD: Mysql55-Server

------------------- เริ่มเลย ------

[1] ติดตั้ง

# cd /usr/ports/databases/mysql55-server

-------------------ติดตั้งแบบใช้ ตัวอักษร ภาษาไทย แบบ UTF8 ---------------

# make WITH_CHARSET=utf8 WITH_xCHARSET=all WITH_CALLATION=utf8_general_ci WITH_OPENSSL=yes  BUILD_OPTIMIZED=yes WITH_FEDERATED=yes WITH_NDB=yes WITH_ARCHIVE=yes install clean


-------------------ติดตั้งแบบใช้ ตัวอักษร ภาษาไทย แบบ tis620--------------

# make WITH_CHARSET=tis620 WITH_xCHARSET=all WITH_CALLATION=tis620_thai_ci WITH_OPENSSL=yes  BUILD_OPTIMIZED=yes WITH_FEDERATED=yes WITH_NDB=yes WITH_ARCHIVE=yes install clean


************************************************************************

Remember to run mysql_upgrade (with the optional --datadir= flag)
the first time you start the MySQL server after an upgrade from an
earlier version.

************************** ผลการติดตั้ง ***********************************


      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/libexec/mysqld

      This port has installed the following startup scripts which may cause
      these network services to be started at boot time.
/usr/local/etc/rc.d/mysql-server

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
http://www.mysql.com/

------------------------ ตรวจสอบผลการติดตั้ง ------------------

 -- ตรวจสอบ user ที่มีขึ้นมาใหม่

# cat /etc/passwd
mysql:*:88:88:MySQL Daemon:/var/db/mysql:/usr/sbin/nologin

 -- ตรวจสอบ Package ที่ติดตั้ง

# pkg_info |grep mysql
mysql-client-5.1.48 Multithreaded SQL database (client)
mysql-server-5.1.48 Multithreaded SQL database (server)

--------------------- Config [system] -------------
# ee /etc.rc.conf
  mysql_enable ="YES"

# cp /usr/local/share/mysql/my-large.cnf  /etc/my.cnf

#ll /etc/my.cnf
-rw-r--r--  1 root  wheel  4649 Jul 16 06:41 /etc/my.cnf

เปลี่ยน group

# chown root:sys /etc/my.cnf
# ls -l /etc/my.cnf
-rw--r--r--  1 root  sys  4757 Oct  6 21:29 /etc/my.cnf

หรือ

# chmod 644 /etc/my.cnf
# ls -l /etc/my.cnf
-rw-r--r--  1 root  sys  4757 Oct  6 21:29 /etc/my.cnf


# rehash

---------------------  Start Mysql Deamon  -------
# mysqld_safe &                                      ; To initial MySQL daemon

#/usr/local/etc/rc.d/mysql-server start        ; To start the MySQL daemon

--------------------- Monitor ---------------------

# ps waux | grep mysql       ; check process
    mysql 13771  0.0  0.6  3632  1352  ??  Is    7:32PM   0:00.07 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf
    mysql 13851  0.0 18.0 188616 44204  ??  I     7:32PM   0:01.00 [mysqld]

# mysqlshow -p            ; display database
Enter password:            ; ยังไม่มี password ให้ enter ผ่าน
+--------------------+
|     Databases            |
+--------------------+
| information_schema    |
| mysql                         |
| performance_schema |
| test                            |
+--------------------+

--------- Kill process ----------------
# killall mysqld


--------------------- Config [database] -----------

# mysql_install_db --user=mysql                          ; Installing MySQL system tables.
# mysqladmin -u root password 'password'         ; To set a password for root user
# mysqladmin -u root -h  n1.name.com password 'password'

----------------------------- Test-----------------------------------
# mysql -u root -p
mysql> status;
mysql> \s
mysql> create database noomdb;
mysql> grant all privileges on noomdb.* to noom@24.0.1.122;
mysql> grant usage on noomdb.* to noom@24.0.1.122 identified by 'noomdbpassword';

====  Add user ŧ㹠mysql:user table ¾ÃéÍÁ¡Ó˹´ÊÔ·¸Ô
mysql> \? add      ;  help for add

mysql>

mysql> use mysql
mysql> select User,Password,Grant_priv from user;

+-----------+-------------------------------------------+------------+
| User          | Password                                                   | Grant_priv |
+-----------+-------------------------------------------+------------+
| root          | *85E26B8AB29FEE8453201A3511DAE24A24059109         | Y          |
| root          |                                                                                                  | Y          |
| root          |                                                                                                  | Y          |
| root          |                                                                                                  | Y          |
|                 |                                                                                                  | N          |
|                 |                                                                                                  | N          |
+-----------+-------------------------------------------+------------+

mysql> update user set password=password('password') where user='root';
mysql> flush privileges;
mysql> grant all on *.* to noomloveu@localhost identified by 'password';
mysql> grant all on *.* to noomloveu identified by 'password';
mysql> grant all on *.* to noomloveu@localhost;
mysql> update user set grant_priv='Y' where user='noomloveu';

 mysql> select User,Password,Grant_priv from user;

+-----------+-------------------------------------------+------------+
| User          | Password                                                   | Grant_priv |
+-----------+-------------------------------------------+------------+
| root          | *85E26B8AB29FEE8453201A3511DAE24A24059109         | Y          |
| root          |                                                                                                  | Y          |
| root          |                                                                                                  | Y          |
| root          |                                                                                                  | Y          |
|                 |                                                                                                  | N          |
|                 |                                                                                                  | N          |
| noomloveu | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19    |Y         |
+-----------+-------------------------------------------+------------+

FreeBSD: Apache

     --------------------- Apache เริ่มเลย -------------------------

กำหนด ชื่อเครื่อง  หรือ DNS ให้เรียบร้อยก่อนติดตั้ง

# ee /etc/hosts
::1                         localhost localhost.name.com
127.0.0.1             localhost localhost.name.com
192.168.1.10       host.name.com





#ee /etc/resolve.conf
     nameserver  127.0.0.1


1 # cd /usr/ports/www/apache22

2 # make WITH_SSL_MODULES=yes WITH_THREADS=yes  WITH_AUTHN_ALIAS=yes  WITH_LOG_FORENSIC=yes WITH_CGI=yes  WITH_USERTRACK=yes WITH_CERN_META=yes  WITH_EXPIRES=yes WITH_MIME_MAGIC=yes  WITH_REWRITE=yes WITH_VHOST_ALIAS=yes  WITH_HEADERS=yes install clean


====== หรือ force to install
# make WITH_FORCE_PKG_REGISTER=yes WITH_SSL_MODULES=yes WITH_THREADS=yes WITH_AUTHN_ALIAS=yes WITH_LOG_FORENSIC=yes WITH_CGI=yes WITH_USERTRACK=yes WITH_CERN_META=yes WITH_EXPIRES=yes WITH_MIME_MAGIC=yes WITH_REWRITE=yes WITH_VHOST_ALIAS=yes WITH_HEADERS=yes install clean
======
3 # rehash

5 # ee /etc/rc.conf
      apache22_enable="YES"
      apache22_http_accept_enable="YES"

6 # cp /usr/local/etc/apache22/httpd.conf /usr/local/etc/apache22/httpd.conf-original

7 # ee /usr/local/etc/apache22/httpd.conf
  ServerAdmin noomloveu@name.com                 ;(~140)
  ServerName n1.name.com:80                            ;(~149),
  Include etc/apache22/extra/httpd-ssl.conf           ;(~451)

!Remark
  Include etc/apache22/extra/httpd-ssl.conf
      ¶éÒ config äÁè¶Ù¡·ÓãËé  error wanning fail to start ä´é



# ee /usr/local/etc/apache22/extra/httpd-ssl.conf
  ServerName host.example.com:443             ;(~78)
  ServerAdmin you@example.com
  SSLCertificateFile /usr/local/openssl/certs/orchid3.siamnk.net-cert.pem  ;(~99)
  SSLCertificateKeyFile /usr/local/openssl/certs/orchid3.siamnk.net-unencrypted-key.pem  ;(~107)



== Loading the accf_http module
On FreeBSD you must load the accf_module before you can start apache,
otherwise you are sure to get an httpready error.
# kldload accf_http

If it loaded successfully then it will not give any errors or output.
To have it load on boot
#ee /boot/loader.conf
accf_http_load="YES"

== Starting Apache
ก่อน restarting หรือ starting Apache ควรใช้คำสั่ง configtest เพื่อ check errors ใน httpd.conf

# apachectl configtest

Apache is controlled with apachectl

# apachectl start
# apachectl restart
# apachectl graceful
# apachectl stop

# /usr/local/etc/rc.d/apache22 onestart
# /usr/local/etc/rc.d/apache22 restart

== Test

# telnet localhost 80
# openssl s_client -connect localhost:443

Window : Add Routing

วิธีดูตาราง Routing Table
1.Start
2.Run
3.พิมพ์ cmd ลงในช่อง run
4.ในหน้าจอ command line พิมพ์ route print
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.1.1      192.168.1.2     25
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      192.168.1.0    255.255.255.0         On-link       192.168.1.2    281
      192.168.1.2  255.255.255.255         On-link       192.168.1.2    281
    192.168.1.255  255.255.255.255         On-link       192.168.1.2    281
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
        224.0.0.0        240.0.0.0         On-link       192.168.1.2    281
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
  255.255.255.255  255.255.255.255         On-link       192.168.1.2    281
===========================================================================

การอ่านตาราง
- Gateway ที่มี network destination เป็น 0.0.0.0 จะเป็น Default gateway.
  คือ ถ้าไม่พบเน็ตเวิร์คปลายทาง(network destination)กำหนดไว้ในตาราง คอมพิวเตอร์จะส่งแพคเกจนั้นๆออกไป โดยผ่านไปทาง Default gateway

- Computer จะส่งแพคเกจแบบ multicast(224.xxx.xxx.xxx -240.xxx.xxx.xxx)
ออกไปยังเน็ตเวิร์คปลายทาง 224.0.0.0 โดยผ่านไปทางอินเตอร์เฟส 192.168.1.2
และ Loop back อินเตอร์เฟส (127.0.0.1)

กำหนดเส้นทาง(Routing) ใน Windows Routing Table
Routing Table เป็นตัวกำหนดเส้นทาง ที่แพ็กเกจทั้งหมดจะไป เมื่อออกจากระบบ ซึ่งแพคเกจทั้งหมดจะถูกส่งไปยัง Router หรือ Switch และจากนั้น จะออกไปยังอินเทอร์เน็ต

ในบางกรณีที่อาจมีเครือข่าย ที่ต้องการไปถึง การกำหนดค่าเครือข่าย จึงจำเป็นต้องกำหนดเส้นทางเพิ่ม โดยการเพิ่มเส้นทางเข้าไปใน Windows Routing Table


Syntax:
route ADD xxx.xxx.xxx.xxx MASK xxx.xxx.xxx.xxx  xxx.xxx.xxx.xxx
Means:
route ADD “network” MASK “subnet mask”  “gateway ip”


เช่น , ถ้าเครื่อง อยู่บนเน็ตเวิร์ค 192.168.1.0 และ gateway คือ 192.168.1.10
ต้องการจะกำหนดเส้นทางไปยังเน็ตเวิร์ค 10.10.10.0/24  สามารถกำหนด คำสั่ง เพิ่ม route ดังนี้ :
route ADD 10.10.10.0 MASK 255.255.255.0 192.168.1.10
Routing table จะมีผลทันที และ แพคเกจทั้งหมดที่จะไปยังเน็ตเวิร์ค 10.10.10.x  จะถูกส่งผ่าน ไอพี 192.168.1.10.
Routing Table จะเปลี่ยนให้ และทำงานให้จนกว่าจะมีการ Reboot ถ้าต้องการให้มีผลถาวรให้เพิ่ม -p :
route -p ADD 10.10.10.0 MASK 255.255.255.0 192.168.1.10



C:\>route /?

Manipulates network routing tables.

ROUTE [-f] [-p] [-4|-6] command [destination]
                  [MASK netmask]  [gateway] [METRIC metric]  [IF interface]

  -f           Clears the routing tables of all gateway entries.  If this is
               used in conjunction with one of the commands, the tables are
               cleared prior to running the command.

  -p           When used with the ADD command, makes a route persistent across
               boots of the system. By default, routes are not preserved
               when the system is restarted. Ignored for all other commands,
               which always affect the appropriate persistent routes. This
               option is not supported in Windows 95.

  -4           Force using IPv4.

  -6           Force using IPv6.

  command      One of these:
                 PRINT     Prints  a route
                 ADD       Adds    a route
                 DELETE    Deletes a route
                 CHANGE    Modifies an existing route
  destination  Specifies the host.
  MASK         Specifies that the next parameter is the 'netmask' value.
  netmask      Specifies a subnet mask value for this route entry.
               If not specified, it defaults to 255.255.255.255.
  gateway      Specifies gateway.
  interface    the interface number for the specified route.
  METRIC       specifies the metric, ie. cost for the destination.

All symbolic names used for destination are looked up in the network database
file NETWORKS. The symbolic names for gateway are looked up in the host name
database file HOSTS.

If the command is PRINT or DELETE. Destination or gateway can be a wildcard,
(wildcard is specified as a star '*'), or the gateway argument may be omitted.

If Dest contains a * or ?, it is treated as a shell pattern, and only
matching destination routes are printed. The '*' matches any string,
and '?' matches any one char. Examples: 157.*.1, 157.*, 127.*, *224*.

Pattern match is only allowed in PRINT command.
Diagnostic Notes:
    Invalid MASK generates an error, that is when (DEST & MASK) != DEST.
    Example> route ADD 157.0.0.0 MASK 155.0.0.0 157.55.80.1 IF 1
             The route addition failed: The specified mask parameter is invalid.
 (Destination & Mask) != Destination.

Examples:

    > route PRINT
    > route PRINT -4
    > route PRINT -6
    > route PRINT 157*          .... Only prints those matching 157*

    > route ADD 157.0.0.0 MASK 255.0.0.0  157.55.80.1 METRIC 3 IF 2
             destination^      ^mask      ^gateway     metric^    ^
                                                         Interface^
      If IF is not given, it tries to find the best interface for a given
      gateway.
    > route ADD 3ffe::/32 3ffe::1

    > route CHANGE 157.0.0.0 MASK 255.0.0.0 157.55.80.5 METRIC 2 IF 2

      CHANGE is used to modify gateway and/or metric only.

    > route DELETE 157.0.0.0
    > route DELETE 3ffe::/32

C:\>

วันอาทิตย์ที่ 17 มิถุนายน พ.ศ. 2555

Sangfor : Internet Access Management (IAM)

ความท้าทาย:

           พฤติกรรมการใช้อินเตอร์เน็ตบังคับได้หรือไม่ ?
                ความหลากหลายของพฤติกรรมการใช้งานในระบบเครือข่ายปัจจุบัน 

                ส่งผลอย่างจริงจังต่อประสิทธิผลของบุคลากร ส่งผลให้ค่าใช้จ่ายด้านแรงงาน
                ในองค์กรเพิ่มขึ้น

           ใช้แบนด์วิธอย่างไรจึงจะเป็นผลดีต่อธุรกิจ ?
                อุปกรณ์เครือข่ายแบบดั้งเดิมมีข้อจำกัดต่อการควบคุมการใช้งานแบบ P2P และ 

                การใช้งาน P2P ในอินทราเน็ต สามารถลดแบนด์วิดธ์สำหรับข้อมูลทางธุรกิจ 
                โซลูชั่นการจัดการเครือข่ายแบบเดิมไม่สามารถระบุได้อย่างมีประสิทธิภาพ 
                 การวิเคราะห์การใช้งานเครือข่าย

           การจัดการทรัพยากรอย่างเหมาะสมได้อย่างไร?
                การใช้งานเครือข่ายสามารถได้รับการวิเคราะห์วิธีการอย่างถูกต้อง

           การรักษาความปลอดภัยเครือข่ายสาขา สามารถมั่นใจได้อย่างไร ?
                การเชื่อมโยงระหว่างสาขาและสำนักงานใหญ่ และการเชื่อมต่ออินเทอร์เน็ต

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

ประโยชน์ที่จะได้รับ: 
    
        ประสิทธิภาพการใช้งานเครือข่าย จะดีขึ้นทันที หลังจากที่ใช้ SANGFOR
1) ควบคุม P2P: ลดปริมาณการจราจร P2P, ประหยัดแบนด์วิดธ์และตัดงบประมาณ
2) การกรองเว็บ: กรองเว็บผู้ใหญ่และเว็บไซต์ที่คล้ายกัน ที่ไม่เหมาะสมสำหรับสถาบันการศึกษา
3) การรายงาน: ผู้จัดการเครือข่ายมุมมองที่หลากหลาย แผนภูมิแท่ง แผนภูมิวงกลม และแผนภูมิการเปรียบเทียบผู้ใช้ต่อช่วงเวลา ต่อแอพพลิเคชันและอื่นๆ ซึ่งจะช่วยให้เข้าใจการใช้งานเครือข่ายและพฤติกรรมใช้งานดีขึ้น
4) การรักษาความปลอดภัย: มีระบบบายพาสฮาร์ดแวร์ ในกรณีของระบบเสีย ผู้ใช้ยังสามารถใช้ต่อไปได้




(Bridge Mode)

ติดตั้งง่ายไม่ต้อง แก้ไขเน็ตเวิร์ดเดิม
วางเป็น Transparent Firewall
กรณีไฟดับ หรือเครื่องเสีย traffic วิ่งผ่านFailover port  LAN(ETH0) กับWAN(ETH2)

Policies:

    • web/application block
    • Email Filter


Netup : Add Content

Add Media Content