<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>How to Config &#187; ubuntu</title>
	<atom:link href="http://www.howtoconfig.com/category/os/ubuntu/feed" rel="self" type="application/rss+xml" />
	<link>http://www.howtoconfig.com</link>
	<description>how to config - how to configure</description>
	<lastBuildDate>Fri, 29 Apr 2011 09:52:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>FreeBSD tip: SUDO Email alert</title>
		<link>http://www.howtoconfig.com/os/ubuntu/freebsdscurity_sudo_email_alert.html</link>
		<comments>http://www.howtoconfig.com/os/ubuntu/freebsdscurity_sudo_email_alert.html#comments</comments>
		<pubDate>Sun, 09 May 2010 10:56:51 +0000</pubDate>
		<dc:creator>อัทศักดิ์ วงศ์กิตตะ</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=98</guid>
		<description><![CDATA[แนวคิดคือ Server ที่เราดูแลมี System Admin หลายคนที่สามารถ Access เป็น Root ได้ แล้วเราจะรู้ได้ไงว่า ใคร Login เข้าไปยัง Server ทางออกของผมคือ Allow User ที่ sshd ให้มีแค่ admin เท่านั้นที่เข้าได้ และให้ sudo เป็น root และจะมีอีเมล์แจ้งเตือนมายัง ผู้ดูแล เพื่อทราบว่าเข้าไปทำอะไร 1. sshd ให้แก้ไขไฟล์ /etc/ssh/sshd_config เพิ่ม AllowUsers เช่น AllowUsers auttasak 2. แก้ไข /usr/local/etc/sudoers ดั่งนี้ Defaults mailto=admin@domain.com,mail_always root ALL=(ALL) ALL auttasak ALL=(ALL) NOPASSWD: ALL หลังจากนั้นให้ทำการ Restart SSH [...]]]></description>
			<content:encoded><![CDATA[<p>แนวคิดคือ Server ที่เราดูแลมี System Admin หลายคนที่สามารถ Access เป็น Root ได้  แล้วเราจะรู้ได้ไงว่า ใคร Login เข้าไปยัง Server    ทางออกของผมคือ Allow User ที่ sshd  ให้มีแค่ admin เท่านั้นที่เข้าได้ และให้ sudo เป็น root   และจะมีอีเมล์แจ้งเตือนมายัง ผู้ดูแล เพื่อทราบว่าเข้าไปทำอะไร</p>
<p>1. sshd   ให้แก้ไขไฟล์ /etc/ssh/sshd_config  เพิ่ม          AllowUsers     เช่น<br />
AllowUsers auttasak</p>
<p>2. แก้ไข  /usr/local/etc/sudoers ดั่งนี้</p>
<p>Defaults mailto=admin@domain.com,mail_always<br />
root            ALL=(ALL) ALL<br />
auttasak      ALL=(ALL) NOPASSWD: ALL</p>
<p>หลังจากนั้นให้ทำการ Restart SSH ครับ     เมื่อใดที่มีคน sudo จะมีอีเมล์แจ้งไปยัง  admin@domain.com    แบบนี้ทำให้เราทราบได้ว่ามีคน sudo เป็น root เมื่อใดบ้าง</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fubuntu%2Ffreebsdscurity_sudo_email_alert.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/ubuntu/freebsdscurity_sudo_email_alert.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPTables statefull firewall for Linux</title>
		<link>http://www.howtoconfig.com/os/ubuntu/iptables_statefull_firewall_linux_debian_centos.html</link>
		<comments>http://www.howtoconfig.com/os/ubuntu/iptables_statefull_firewall_linux_debian_centos.html#comments</comments>
		<pubDate>Tue, 23 Mar 2010 11:04:18 +0000</pubDate>
		<dc:creator>อัทศักดิ์ วงศ์กิตตะ</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[Shell script]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[INPUT]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=87</guid>
		<description><![CDATA[หายไปนานครับ วันี้เอาเรื่องเก่าๆมาหากินใหม่ IPTables ที่ทำๆอยู่ทุกวันนี้แหละครับ พอดีทำ Shell Script ทิ้งไว้เลยเอามาแจกจ่ายให้เพื่อนๆเอาไปใช้งาน หลายๆคนถามว่าทำไมต้องเขียนเอง ก็เหตุผลง่ายๆครับ เราเขียนเองเรารู้ทุกๆ rules ที่มันทำงานอย่างไร เวลาเกิดปัญหา เราสามารถแก้ไขปัญหาได้ รวดเร็ว มาดูความสามารถของ script firewall ตัวนี้ครับ ความสามารถ: &#8211; State full firewall &#8211; สามารถกำหนด Interface ที่ทำงานได้ &#8211; สามารถกำหนด VIP IP ได้ &#8211; สามารถกำหนด Band IP ได้ &#8211; มีการเก็บ Log ลง syslog &#8211; ป้องกันการ Scan port ได้ &#8211; ป้องกัน IP Spoofig &#8211; ป้องกัน [...]]]></description>
			<content:encoded><![CDATA[<p>     หายไปนานครับ วันี้เอาเรื่องเก่าๆมาหากินใหม่ IPTables ที่ทำๆอยู่ทุกวันนี้แหละครับ พอดีทำ Shell Script ทิ้งไว้เลยเอามาแจกจ่ายให้เพื่อนๆเอาไปใช้งาน   หลายๆคนถามว่าทำไมต้องเขียนเอง   ก็เหตุผลง่ายๆครับ   เราเขียนเองเรารู้ทุกๆ rules ที่มันทำงานอย่างไร เวลาเกิดปัญหา เราสามารถแก้ไขปัญหาได้ รวดเร็ว  มาดูความสามารถของ script firewall ตัวนี้ครับ</p>
<p>ความสามารถ:<br />
  &#8211; State full  firewall<br />
  &#8211; สามารถกำหนด Interface ที่ทำงานได้<br />
  &#8211; สามารถกำหนด VIP IP ได้<br />
  &#8211; สามารถกำหนด Band IP ได้<br />
  &#8211; มีการเก็บ Log ลง syslog<br />
  &#8211; ป้องกันการ Scan port ได้<br />
  &#8211; ป้องกัน IP Spoofig<br />
  &#8211; ป้องกัน SSH Attatch<br />
<span id="more-87"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># rc.firewall - Initial IP Firewall</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #007800;">INET_IFACE</span>=<span style="color: #ff0000;">&quot;eth0&quot;</span>
<span style="color: #007800;">IPTABLES</span>=<span style="color: #ff0000;">&quot;/sbin/iptables&quot;</span>
&nbsp;
<span style="color: #007800;">IP_ALLOW</span>=<span style="color: #ff0000;">&quot;61.19.249.66&quot;</span>
<span style="color: #007800;">IP_BAND</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #007800;">ICMP_ALLOW</span>=<span style="color: #ff0000;">&quot;0 3 5 11&quot;</span>
<span style="color: #007800;">TCP_ALLOW</span>=<span style="color: #ff0000;">&quot;22 25 53 80 8000 90 3128 20001&quot;</span> 
<span style="color: #007800;">UDP_ALLOW</span>=<span style="color: #ff0000;">&quot;53&quot;</span>
&nbsp;
<span style="color: #007800;">FTP_PORT</span>=<span style="color: #ff0000;">&quot;1024:65335&quot;</span>
<span style="color: #007800;">FTP_ENABLE</span>=<span style="color: #000000;">1</span>
&nbsp;
&nbsp;
<span style="color: #007800;">SSH_ATTACH</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">SSH_HITCOUNT</span>=<span style="color: #000000;">5</span>
<span style="color: #007800;">SSH_PORT</span>=<span style="color: #000000;">22</span>
&nbsp;
<span style="color: #007800;">PORTSCAN_CHECK</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">SPOOFINGIP_CHECK</span>=<span style="color: #000000;">1</span>
&nbsp;
<span style="color: #007800;">LOGLEVEL</span>=<span style="color: #ff0000;">&quot;DEBUG&quot;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Load IPTables Modules</span>
<span style="color: #666666; font-style: italic;">#</span>
modprobe ip_conntrack
modprobe ip_conntrack_ftp
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Reset IPTables</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-F</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-F</span> <span style="color: #660033;">-t</span> nat
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-X</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-X</span> <span style="color: #660033;">-t</span> nat
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Create separate chains for ICMP, TCP and UDP to traverse</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> vip_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> band_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> icmp_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> tcp_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> udp_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> log_attach
&nbsp;
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> DROP_TRAFFIC
&nbsp;
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Drop packet</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> DROP_TRAFFIC <span style="color: #660033;">-p</span> TCP <span style="color: #660033;">-j</span> REJECT <span style="color: #660033;">--reject-with</span> tcp-reset 
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> DROP_TRAFFIC <span style="color: #660033;">-p</span> UDP <span style="color: #660033;">-j</span> REJECT <span style="color: #660033;">--reject-with</span> icmp-port-unreachable
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Log Attack</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> log_attach <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;Attack:&quot;</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> log_attach <span style="color: #660033;">-j</span> DROP_TRAFFIC
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># VIP IPaddress</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">for</span> ip <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$IP_ALLOW</span>
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> vip_packets <span style="color: #660033;">-s</span> <span style="color: #007800;">$ip</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Band IPaddress</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">for</span> ip <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$IP_BAND</span>
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> band_packets <span style="color: #660033;">-s</span> <span style="color: #007800;">$ip</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># ICMP rules</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">for</span> icmp <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$ICMP_ALLOW</span>
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> icmp_packets <span style="color: #660033;">-p</span> ICMP <span style="color: #660033;">-s</span> <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span> <span style="color: #660033;">--icmp-type</span> <span style="color: #007800;">$icmp</span> <span style="color: #660033;">-j</span> ACCEPT
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># TCP rules</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">for</span> port <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$TCP_ALLOW</span>
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> tcp_packets <span style="color: #660033;">-p</span> TCP <span style="color: #660033;">-s</span> <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span> <span style="color: #660033;">--dport</span> <span style="color: #007800;">$port</span> <span style="color: #660033;">-j</span> ACCEPT
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># UDP rules</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">for</span> port <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$UDP_ALLOW</span>
<span style="color: #000000; font-weight: bold;">do</span>
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> udp_packets <span style="color: #660033;">-p</span> UDP <span style="color: #660033;">-s</span> <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span> <span style="color: #660033;">--dport</span> <span style="color: #007800;">$port</span> <span style="color: #660033;">-j</span> ACCEPT
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># INPUT chain</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> ALL <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-m</span> state <span style="color: #660033;">--state</span> ESTABLISHED,RELATED <span style="color: #660033;">-j</span> ACCEPT
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">--syn</span> <span style="color: #660033;">-m</span> state <span style="color: #660033;">--state</span> NEW <span style="color: #660033;">-j</span> log_attach
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Rules for incoming packets from the internet</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$SPOOFINGIP_CHECK</span>&quot;</span> == <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> spoofing_check
&nbsp;
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 10.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 169.254.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">16</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 172.16.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">12</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 127.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
&nbsp;
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 224.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-d</span> 224.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 240.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-d</span> 240.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-s</span> 0.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-d</span> 0.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-d</span> 239.255.255.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> spoofing_check <span style="color: #660033;">-d</span> 255.255.255.255 <span style="color: #660033;">-j</span> DROP_TRAFFIC
&nbsp;
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> spoofing_check
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$SSH_ATTACH</span>&quot;</span> == <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> sshattach_check
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> sshattach_check <span style="color: #660033;">-m</span> recent <span style="color: #660033;">--set</span> <span style="color: #660033;">--name</span> SSH
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> sshattach_check <span style="color: #660033;">-m</span> recent <span style="color: #660033;">--update</span> <span style="color: #660033;">--seconds</span> <span style="color: #000000;">60</span> <span style="color: #660033;">--hitcount</span> <span style="color: #007800;">$SSH_HITCOUNT</span> <span style="color: #660033;">--name</span> SSH <span style="color: #660033;">-j</span> log_attach
&nbsp;
        <span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #007800;">$SSH_PORT</span> <span style="color: #660033;">-m</span> state <span style="color: #660033;">--state</span> NEW <span style="color: #660033;">-j</span> sshattach_check
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Port scan</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PORTSCAN_CHECK</span>&quot;</span> == <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-N</span> check-flags
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL FIN,URG,PSH <span style="color: #660033;">-m</span> limit <span style="color: #660033;">--limit</span> <span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>minute <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;NMAP:&quot;</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL FIN,URG,PSH <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL ALL <span style="color: #660033;">-m</span> limit <span style="color: #660033;">--limit</span> <span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>minute <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;XMAS:&quot;</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL ALL <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL SYN,RST,ACK,FIN,URG <span style="color: #660033;">-m</span> limit <span style="color: #660033;">--limit</span> <span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>minute <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;XMAS-PSH:&quot;</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL SYN,RST,ACK,FIN,URG <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL NONE <span style="color: #660033;">-m</span> limit <span style="color: #660033;">--limit</span> <span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>minute <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;NULL_SCAN:&quot;</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> ALL NONE <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> SYN,RST SYN,RST <span style="color: #660033;">-m</span> limit <span style="color: #660033;">--limit</span> <span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>minute <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;SYN/RST:&quot;</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> SYN,RST SYN,RST <span style="color: #660033;">-j</span> DROP_TRAFFIC
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> SYN,FIN SYN,FIN <span style="color: #660033;">-m</span> limit <span style="color: #660033;">--limit</span> <span style="color: #000000;">5</span><span style="color: #000000; font-weight: bold;">/</span>minute <span style="color: #660033;">-j</span> LOG <span style="color: #660033;">--log-level</span> <span style="color: #007800;">$LOGLEVEL</span> <span style="color: #660033;">--log-prefix</span> <span style="color: #ff0000;">&quot;SYN/FIN:&quot;</span>
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> check-flags <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--tcp-flags</span> SYN,FIN SYN,FIN <span style="color: #660033;">-j</span> DROP_TRAFFIC
&nbsp;
	<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> TCP <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> check-flags
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$FTP_ENABLE</span>&quot;</span> == <span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #666666; font-style: italic;">#Allow FTP traffic (Control)</span>
        iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--sport</span> <span style="color: #007800;">$FTP_PORT</span> <span style="color: #660033;">--dport</span> <span style="color: #000000;">21</span> <span style="color: #660033;">-j</span> ACCEPT
        iptables <span style="color: #660033;">-A</span> OUTPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--sport</span> <span style="color: #000000;">21</span> <span style="color: #660033;">--dport</span> <span style="color: #007800;">$FTP_PORT</span> <span style="color: #660033;">-j</span> ACCEPT
&nbsp;
        <span style="color: #666666; font-style: italic;">#Allow FTP traffic (Data)</span>
        iptables <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--sport</span> <span style="color: #007800;">$FTP_PORT</span> <span style="color: #660033;">--dport</span> <span style="color: #000000;">20</span> <span style="color: #660033;">-j</span> ACCEPT
        iptables <span style="color: #660033;">-A</span> OUTPUT <span style="color: #660033;">-p</span> tcp <span style="color: #660033;">--sport</span> <span style="color: #000000;">20</span> <span style="color: #660033;">--dport</span> <span style="color: #007800;">$FTP_PORT</span> <span style="color: #660033;">-j</span> ACCEPT
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
&nbsp;
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> vip_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> band_packets
&nbsp;
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> ICMP <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> icmp_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> TCP <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> tcp_packets
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-p</span> UDP <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> udp_packets
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;"># Default policy</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">-A</span> INPUT <span style="color: #660033;">-i</span> <span style="color: #007800;">$INET_IFACE</span> <span style="color: #660033;">-j</span> DROP_TRAFFIC</pre></div></div>

<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fubuntu%2Fiptables_statefull_firewall_linux_debian_centos.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/ubuntu/iptables_statefull_firewall_linux_debian_centos.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SSH โดยไม่ต้องใส่รหัสผ่าน</title>
		<link>http://www.howtoconfig.com/os/ubuntu/ssh-login-without-password.html</link>
		<comments>http://www.howtoconfig.com/os/ubuntu/ssh-login-without-password.html#comments</comments>
		<pubDate>Fri, 16 Jan 2009 12:30:01 +0000</pubDate>
		<dc:creator>กวิน ชัยเลิศ</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[*BSD]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[OpenSSH]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[รหัสผ่าน]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=57</guid>
		<description><![CDATA[สำหรับผู้ดูแลระบบที่มีความจำเป็นต้องใช้งาน Remote Login ผ่าน OpenSSH Client อยู่เป็นประจำไม่ว่าจะใช้งานบน Linux, *BSD, Mac OS X คงจะเกิดอาการเบื่อไม่น้อยที่ต้องพิมพ์ Password ทุกๆ ครั้งที่ต้องการจะ Login (ไม่นับ Password จำพวก 123456 นะครับ) ทางออกสำหรับผู้ที่ต้องการ Login โดยไม่ต้องพิมพ์ Password แถมยังคงความปลอดภัยตามแบบฉบับของ OpenSSH สามารถทำได้ตามวิธีดังต่อไปนี้ครับ ระบบที่ทำการทดสอบ - OpenSSH Client บน Mac OS X 10.5.6 - OpenSSH Server บน Ubuntu 8.04 ขั้นตอนแรก ทำการสร้าง keys สำหรับยืนยันตัวตนระหว่าง Client และ Server (ทำบนเครื่อง Client ในที่นี้คือ Mac [...]]]></description>
			<content:encoded><![CDATA[<p>สำหรับผู้ดูแลระบบที่มีความจำเป็นต้องใช้งาน Remote Login ผ่าน OpenSSH Client อยู่เป็นประจำไม่ว่าจะใช้งานบน Linux, *BSD, Mac OS X คงจะเกิดอาการเบื่อไม่น้อยที่ต้องพิมพ์ Password ทุกๆ ครั้งที่ต้องการจะ Login (ไม่นับ Password จำพวก 123456 นะครับ) ทางออกสำหรับผู้ที่ต้องการ Login โดยไม่ต้องพิมพ์ Password แถมยังคงความปลอดภัยตามแบบฉบับของ OpenSSH สามารถทำได้ตามวิธีดังต่อไปนี้ครับ</p>
<p>ระบบที่ทำการทดสอบ<br />
- OpenSSH Client บน Mac OS X 10.5.6<br />
- OpenSSH Server บน Ubuntu 8.04</p>
<p>ขั้นตอนแรก ทำการสร้าง keys สำหรับยืนยันตัวตนระหว่าง Client และ Server (ทำบนเครื่อง Client ในที่นี้คือ Mac OS X)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">MacClient:~ UserA$ <span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-t</span> rsa</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">MacClient:~ UserA$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/UserA/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/UserA/.ssh/id_rsa.
Your public key has been saved in /Users/UserA/.ssh/id_rsa.pub.
The key fingerprint is:
a4:74:0b:bc:2f:d1:f5:c7:4e:90:51:7f:f4:45:84:a0 UserA@MacClient</pre></div></div>

<p><span id="more-57"></span></p>
<p>ขั้นตอนต่อไป ใช้ ssh สร้าง directory ~/.ssh บน Server ปลายทาง (ทำบน Client ได้เลย โดยผ่าน ssh)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">MacClient:~ UserA$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> UserA<span style="color: #000000; font-weight: bold;">@</span>UbuntuServer <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> .ssh</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">MacClient:~ UserA$ ssh UserA@UbuntuServer mkdir -p .ssh
UserA@vmtuserver's password:</pre></div></div>

<p>ขั้นตอนสุดท้าย ทำการเพิ่ม Public keys ที่สร้างขึ้นในขั้นตอนแรกไปยังไฟล์ ~/.ssh/authorized_keys บน Server ปลายทาง (ทำบน Client โดยผ่าน ssh เช่นเคย)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">MacClient:~ UserA$ <span style="color: #c20cb9; font-weight: bold;">cat</span> .ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">ssh</span> UserA<span style="color: #000000; font-weight: bold;">@</span>UbuntuServer <span style="color: #ff0000;">'cat &amp;gt;&amp;gt; .ssh/authorized_keys'</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">MacClient:~ UserA$ cat .ssh/id_rsa | ssh UserA@UbuntuServer 'cat &amp;gt;&amp;gt; .ssh/authorized_keys'
UserA@vmtuserver's password:</pre></div></div>

<p>ทำการทดสอบ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">MacClient:~ UserA$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> UserA<span style="color: #000000; font-weight: bold;">@</span>UbuntuServer</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="txt" style="font-family:monospace;">MacClient:~ UserA$ ssh UserA@UbuntuServer
Linux UbuntuServer 2.6.24-19-server #1 SMP Wed Jun 18 15:18:00 UTC 2008 i686
&nbsp;
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
&nbsp;
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
&nbsp;
To access official Ubuntu documentation, please visit:
http://help.ubuntu.com/
You have mail.
Last login: Tue Jan 13 00:14:19 2009 from MacClient
UserA@UbuntuServer:~$</pre></div></div>

<p>*สามารถเพิ่ม Public keys ที่สร้างขึ้นไปยัง User ใดๆ ก็ได้ ไม่จำเป็นต้องมีชื่อเหมือนกับ User ที่มีอยู่บน Client</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fubuntu%2Fssh-login-without-password.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/ubuntu/ssh-login-without-password.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>วิธีตรวจสอบ Linux / Unix distribution version</title>
		<link>http://www.howtoconfig.com/os/ubuntu/how-to-check-linux-unix-distribution-version.html</link>
		<comments>http://www.howtoconfig.com/os/ubuntu/how-to-check-linux-unix-distribution-version.html#comments</comments>
		<pubDate>Fri, 16 Jan 2009 12:10:15 +0000</pubDate>
		<dc:creator>กวิน ชัยเลิศ</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[*BSD]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[Distribution]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=53</guid>
		<description><![CDATA[กรณีที่ผู้ดูแลระบบได้รับมอบหมายให้ดูแล server ที่ตนเองไม่ได้ติดตั้ง คงจะอยากรู้ว่า Linux / Unix server ที่ใช้อยู่เป็น version อะไร &#8230; สามารถตรวจสอบได้จากคำสั่งต่อไปนี้ครับ cat /proc/version ได้ Output ประมาณนี้ครับ Linux version 2.6.27-9-generic &#40;buildd@rothera&#41; &#40;gcc version 4.3.2 &#40;Ubuntu 4.3.2-1ubuntu11&#41; &#41; #1 SMP Thu Nov 20 21:57:00 UTC 200 หรือดู version ในไฟล์ /etc/issue (issue &#8211; pre-login message and identification file) cat /etc/issue ได้ Output ประมาณนี้ครับ Ubuntu 8.10 \n [...]]]></description>
			<content:encoded><![CDATA[<p>กรณีที่ผู้ดูแลระบบได้รับมอบหมายให้ดูแล server ที่ตนเองไม่ได้ติดตั้ง คงจะอยากรู้ว่า Linux / Unix server ที่ใช้อยู่เป็น version อะไร &#8230;<br />
สามารถตรวจสอบได้จากคำสั่งต่อไปนี้ครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>version</pre></div></div>

<p>ได้ Output ประมาณนี้ครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Linux version 2.6.27-<span style="color: #000000;">9</span>-generic <span style="color: #7a0874; font-weight: bold;">&#40;</span>buildd<span style="color: #000000; font-weight: bold;">@</span>rothera<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">gcc</span> version 4.3.2 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Ubuntu 4.3.2-1ubuntu11<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #666666; font-style: italic;">#1 SMP Thu Nov 20 21:57:00 UTC 200</span></pre></div></div>

<p>หรือดู version ในไฟล์ /etc/issue<br />
(issue &#8211; pre-login message and identification file)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>issue</pre></div></div>

<p>ได้ Output ประมาณนี้ครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Ubuntu <span style="color: #000000;">8.10</span> \n \l</pre></div></div>

<p>* ทดสอบบน Ubuntu 8.10</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fubuntu%2Fhow-to-check-linux-unix-distribution-version.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/ubuntu/how-to-check-linux-unix-distribution-version.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>วิธีติดตั้ง Reverse Proxy ด้วย Squid</title>
		<link>http://www.howtoconfig.com/os/ubuntu/how-to-implement-squid-reverse-proxy.html</link>
		<comments>http://www.howtoconfig.com/os/ubuntu/how-to-implement-squid-reverse-proxy.html#comments</comments>
		<pubDate>Fri, 11 Jul 2008 12:25:40 +0000</pubDate>
		<dc:creator>กวิน ชัยเลิศ</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[HTTP traffic]]></category>
		<category><![CDATA[httpd-accelerator]]></category>
		<category><![CDATA[Implement]]></category>
		<category><![CDATA[Proxy]]></category>
		<category><![CDATA[Reverse Proxy]]></category>
		<category><![CDATA[Squid]]></category>
		<category><![CDATA[transparent cache]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=32</guid>
		<description><![CDATA[ในเบื่องต้นผมขอแนะนำให้รู้จัก Squid กันก่อนครับ Squid เป็น Open Source Software ที่ให้บริการ Proxy caches ซึ่ง Squid สามารถติดตั้งให้ทำงานใน 3 รูปแบบหลักดังนี้ 1. Standard Proxy Cache ใช้สำหรับเก็บ cache ของ static web pages จำพวก html และรูปภาพ โดยทั่วไปมักจะถูกใช้งานใน network ภายในองค์กร โดยที่ web pages ต่างๆ ที่ถูกเรียกผ่าน local network เป็นครั้งที่สอง web browser จะแสดงผล web pages นั้นผ่าน proxy cache แทนที่ไปดึงข้อมูลจาก web server มาแสดงผล (ประหยัด bandwidth และเพิ่มความเร็วในการแสดงผล) [...]]]></description>
			<content:encoded><![CDATA[<p>ในเบื่องต้นผมขอแนะนำให้รู้จัก Squid กันก่อนครับ</p>
<p>Squid เป็น Open Source Software ที่ให้บริการ Proxy caches ซึ่ง Squid สามารถติดตั้งให้ทำงานใน 3 รูปแบบหลักดังนี้</p>
<p><strong>1. Standard Proxy Cache</strong><br />
ใช้สำหรับเก็บ cache ของ static web pages จำพวก html และรูปภาพ โดยทั่วไปมักจะถูกใช้งานใน network ภายในองค์กร โดยที่ web pages ต่างๆ ที่ถูกเรียกผ่าน local network เป็นครั้งที่สอง web browser จะแสดงผล web pages นั้นผ่าน proxy cache แทนที่ไปดึงข้อมูลจาก web server มาแสดงผล (ประหยัด bandwidth และเพิ่มความเร็วในการแสดงผล)</p>
<p><strong>2. Transparent Cache</strong><br />
ความสามารถหลักๆ เหมือนกับการติดตั้งแบบ standard proxy cache จะแตกต่างกันที่การติดตั้งแบบ transparent cache ไม่จำเป็นต้องปรับแต่ง web browser ให้สามารถใช้งาน proxy cache โดยที่ transparent cache จะทำหน้าที่คอยกรอง HTTP traffic (on port 80) แล้วตรวจสอบว่า request นั้นมีอยู่ใน cahce หรือไม่ ถ้าไม่มีก็จะทำการส่งต่อไปยัง web server ของ web pages นั้น (สำหรับ Linux การใช้งาน transparent cache จะใช้ควบคู่ไปกับ iptables ในการกรอง HTTP traffic)</p>
<p><strong>3. Reverse Proxy Cache</strong><br />
สำหรับ reverse proxy cache จะทำหน้าที่แตกต่างกับ standard และ transparent caches โดยที่ reverse proxy cache จะทำหน้าที่ลดภาระของ web server แทนที่การลด network bandwidth ของฝั่ง client กล่าวคือ reverse proxy cache ถูกติดตั้งอยู่หน้า web server (ระหว่าง internet และ web server) คอยจัดการ traffic ที่เกิดขึ้นทั้งหมดก่อนจะถึง web server ป้องกัน traffic ที่เพิ่มขึ้นโดยไม่พีงประสงค์ (ซึ่งอาจจะโดนโจมตีจาก hacker เป็นต้น) อีกทั้งยังลดภาระของ web server อีกทางนึง<br />
<img class="alignnone size-full image-33" title="reverse-proxy" src="http://www.howtoconfig.com/content/uploads/2008/07/reverse-proxy.gif" alt="" width="436" height="451" /><br />
<span id="more-32"></span><br />
สำหรับวิธีการติดตั้ง Reverse Proxy ด้วย Squid สามารถทำตามขั้นตอนต่อไปนี้ได้เลยครับ<br />
(ทำการติดตั้งบน CentOS 4.6)</p>
<p>ตรวจสอบว่าได้ติดตั้ง squid แล้วหรือยัง</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rpm <span style="color: #660033;">-qa</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> squid</pre></div></div>

<p>ถ้าได้ทำการติดตั้ง squid ไว้แล้วจะแสดงผลของคำสั้งตามตัวอย่างครับ</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[root@reverse ~]# rpm -qa|grep squid
squid-2.5.STABLE14-1.4E.el4_6.2
[root@reverse ~]#</pre></div></div>

<p>กรณียังไม่ได้ติดตั้งให้ใช้คำสั่ง yum install squid ได้เลยครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> squid</pre></div></div>

<p>หลังจากทำการติดตั้ง squid เรียบร้อยแล้วให้ทำการปรับแต่งไฟล์ /etc/squid/squid.conf โดยแก้ไขเพิ่มเติม options เหล่านี้</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">http_port 80 #Port ของ Squid
httpd_accel_host 192.168.0.2 #IP address ของ Web Server (แทนที่ public ip 203.101.102.1 ด้วย private ip 192.168.0.2)
httpd_accel_port 80 #Port ของ Web Server
httpd_accel_single_host on #Option on ใช้ในกรณีที่ต้องการติดตั้ง Reverse Proxy ไว้หน้า Web Server เดี่ยวๆ
httpd_accel_with_proxy on
httpd_accel_uses_host_header off</pre></div></div>

<p>เพียงเท่านี้ก็สามารถใช้งาน Reverse Proxy ได้แล้ว รับรองว่าสามารถลดภาระการทำงานของ Web Server แน่นอน<br />
หากเพื่อนๆ มีข้อสงสัยหรือข้อเสนอแนะ &#8230; ก็ comment ไว้ด้วยนะครับ</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fubuntu%2Fhow-to-implement-squid-reverse-proxy.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/ubuntu/how-to-implement-squid-reverse-proxy.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ยกเลิก Blank Screen บน Linux Console</title>
		<link>http://www.howtoconfig.com/os/ubuntu/disable-screen-blanking-screen-going-blank-on-linux.html</link>
		<comments>http://www.howtoconfig.com/os/ubuntu/disable-screen-blanking-screen-going-blank-on-linux.html#comments</comments>
		<pubDate>Thu, 03 Jul 2008 05:39:18 +0000</pubDate>
		<dc:creator>กวิน ชัยเลิศ</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[blank screen]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[concole]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[linux console]]></category>
		<category><![CDATA[setterm]]></category>
		<category><![CDATA[X window]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=30</guid>
		<description><![CDATA[ไม่ยากใช่ไหมครับหากต้องการยกเลิก screen saver บน X window แต่สำหรับ text mode (linux console) ผมคิดว่าหลายๆ คนยังไม่เคยยกเลิก blank screen หรือกำลังหาทางยกเลิกมันอยู่ สำหรับผมแล้วการยกเลิก blank screen บน linux console นั้นมีประโยชน์มากครับ ยกตัวอย่างเช่น เราสามารถทำงานไปพร้อมๆ กันกับการ monitor ดู error หรือ log จากอีกจอนึง (กรณีมีจอ monitor มากกว่าหนึ่งจอ) โดยที่ไม่ต้องคอยกดคีย์บอร์ดหรือเลื่อนเมาส์เพื่อให้ linux console แสดงผลอยู่ตลอดเวลา สำหรับวิธีการนั้นก็ไม่ได้ยุ่งยากเลยครับ แค่ใช้คำสั่ง setterm เท่านั้น setterm -blank 0 -powersave off -powerdown 0 &#60; /dev/console &#62; /dev/console 2&#62;&#38;1 [...]]]></description>
			<content:encoded><![CDATA[<p>ไม่ยากใช่ไหมครับหากต้องการยกเลิก screen saver บน X window แต่สำหรับ text mode (linux console) ผมคิดว่าหลายๆ คนยังไม่เคยยกเลิก blank screen หรือกำลังหาทางยกเลิกมันอยู่ สำหรับผมแล้วการยกเลิก blank screen บน linux console นั้นมีประโยชน์มากครับ ยกตัวอย่างเช่น เราสามารถทำงานไปพร้อมๆ กันกับการ monitor ดู error หรือ log จากอีกจอนึง (กรณีมีจอ monitor มากกว่าหนึ่งจอ) โดยที่ไม่ต้องคอยกดคีย์บอร์ดหรือเลื่อนเมาส์เพื่อให้ linux console แสดงผลอยู่ตลอดเวลา</p>
<p>สำหรับวิธีการนั้นก็ไม่ได้ยุ่งยากเลยครับ แค่ใช้คำสั่ง setterm เท่านั้น</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">setterm</span> <span style="color: #660033;">-blank</span> <span style="color: #000000;">0</span> <span style="color: #660033;">-powersave</span> off <span style="color: #660033;">-powerdown</span> <span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>console <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>console <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span></pre></div></div>

<p>หากต้องการยกเลิก blank screen ทุกครั้งหลังจาก start linux ให้ทำการเพิ่มคำสั่งดังกล่าวในไฟล์ /etc/rc.local เพียงเท่านี้ก็ไม่ต้องคอยกดคีย์บอร์ดหรือเลื่อนเมาส์ทุกๆ 5 นาทีแล้วครับ</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fubuntu%2Fdisable-screen-blanking-screen-going-blank-on-linux.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/ubuntu/disable-screen-blanking-screen-going-blank-on-linux.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>inittab หายไปไหนใน ubuntu 8.04</title>
		<link>http://www.howtoconfig.com/os/ubuntu/whereis-inittab-on-ubuntu-804.html</link>
		<comments>http://www.howtoconfig.com/os/ubuntu/whereis-inittab-on-ubuntu-804.html#comments</comments>
		<pubDate>Wed, 02 Jul 2008 09:25:19 +0000</pubDate>
		<dc:creator>กวิน ชัยเลิศ</dc:creator>
				<category><![CDATA[Operating System]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[inittab]]></category>
		<category><![CDATA[ubuntu 8.04]]></category>
		<category><![CDATA[upstart]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=29</guid>
		<description><![CDATA[หลายๆ คนอาจจะสงสัยว่าทำไมไม่มีไฟล์ /etc/inittab อยู่บน ubuntu 8.04 (ที่จริงมันหายไปตั้งแต่ ubuntu 6.10 แล้วละครับ) บางคนอาจจะคิดว่าติดตั้งผิดหรือเผลอลบไปตอนไหน อันที่จริงแล้ว /etc/inittab ไม่ได้หายไปหรอกครับเพียงแต่ ubuntu เปลี่ยนการใช้งาน /sbin/init daemon (System-V init) ไปเป็น Upstart แทน สำหรับผมแล้วรู่สึกว่าการใช้งาน System-V init มันง่ายกว่ากันเยอะเลย &#8230; ผมใช้งาน Upstart คล่องเมื่อไหร่จะมาเขียนให้เพื่อนๆ ได้อ่านกันอีกครั้ง]]></description>
			<content:encoded><![CDATA[<p>หลายๆ คนอาจจะสงสัยว่าทำไมไม่มีไฟล์ /etc/inittab อยู่บน ubuntu 8.04 (ที่จริงมันหายไปตั้งแต่ ubuntu 6.10 แล้วละครับ) บางคนอาจจะคิดว่าติดตั้งผิดหรือเผลอลบไปตอนไหน อันที่จริงแล้ว /etc/inittab ไม่ได้หายไปหรอกครับเพียงแต่ ubuntu เปลี่ยนการใช้งาน /sbin/init daemon (System-V init) ไปเป็น <a href="http://upstart.ubuntu.com/">Upstart </a>แทน สำหรับผมแล้วรู่สึกว่าการใช้งาน System-V init มันง่ายกว่ากันเยอะเลย &#8230; ผมใช้งาน Upstart คล่องเมื่อไหร่จะมาเขียนให้เพื่อนๆ ได้อ่านกันอีกครั้ง</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fubuntu%2Fwhereis-inittab-on-ubuntu-804.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/ubuntu/whereis-inittab-on-ubuntu-804.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>เปลี่ยน default editor บน ubuntu</title>
		<link>http://www.howtoconfig.com/os/ubuntu/change-default-editor-on-ubuntu.html</link>
		<comments>http://www.howtoconfig.com/os/ubuntu/change-default-editor-on-ubuntu.html#comments</comments>
		<pubDate>Tue, 24 Jun 2008 10:32:48 +0000</pubDate>
		<dc:creator>กวิน ชัยเลิศ</dc:creator>
				<category><![CDATA[Operating System]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[default editor]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[hardy]]></category>
		<category><![CDATA[nano]]></category>
		<category><![CDATA[pine]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[system administrator]]></category>
		<category><![CDATA[ubuntu 8.04 hardy]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=25</guid>
		<description><![CDATA[จากประสบการณ์ที่ผ่านมา default editor บน linux และ *bsd มักจะเป็น vi ซึ่งตามปกติแล้ว system administrator (sysadmin) จำเป็นต้องใช้ default editor ของ os ในหลายๆ เหตุการณ์ เช่น ใช้ในคำสั่ง crontab เป็นต้น หลังจากที่ติดตั้ง Ubuntu 8.04 hardy ก็พบว่า default editor ไม่ใช่ vi ที่ผมคุ้นเคย กลับกลายเป็น nano editor หน้าตาเหมือนกับ pineapple สมัยที่ linux ยังไม่เฟื่องฟู (pine e-mail client) ไม่รู้ว่าคนแก่แถวๆ นี้มีใครนิยมกิน pine บ้างครับ &#8230; เพื่อไม่ให้ยืดเยื้อไปกว่านี้ เรามาเปลี่ยน default editor บน [...]]]></description>
			<content:encoded><![CDATA[<p>จากประสบการณ์ที่ผ่านมา default editor บน linux และ *bsd มักจะเป็น vi ซึ่งตามปกติแล้ว system administrator (sysadmin) จำเป็นต้องใช้ default editor ของ os ในหลายๆ เหตุการณ์ เช่น ใช้ในคำสั่ง crontab เป็นต้น</p>
<p>หลังจากที่ติดตั้ง Ubuntu 8.04 hardy ก็พบว่า default editor ไม่ใช่ vi ที่ผมคุ้นเคย กลับกลายเป็น nano editor หน้าตาเหมือนกับ pineapple สมัยที่ linux ยังไม่เฟื่องฟู (pine e-mail client) ไม่รู้ว่าคนแก่แถวๆ นี้มีใครนิยมกิน pine บ้างครับ &#8230; เพื่อไม่ให้ยืดเยื้อไปกว่านี้ เรามาเปลี่ยน default editor บน ubuntu กันดีกว่าครับ</p>
<p><span id="more-25"></span><br />
แปลงร่างเป็น root หรือใครถนัดใช้ sudo ก็ข้ามไปใช้ sudo ตามสะดวกครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">su</span> -</pre></div></div>

<p>ทีนี้ก็เปลี่ยน default editor ตามนี้ครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">update-alternatives <span style="color: #660033;">--config</span> editor</pre></div></div>

<blockquote><p>
There are 4 alternatives which provide `editor&#8217;.</p>
<p>  Selection    Alternative<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
          1    /usr/bin/vim.tiny<br />
          2    /bin/ed<br />
 +        3    /bin/nano<br />
*         4    /usr/bin/vim.basic</p>
<p>Press enter to keep the default[*], or type selection number:
</p></blockquote>
<p>แฟนพันธุ์ vi ก็ต้องเลือกหมายเลข 4 อยู่แล้ว &#8230; เพื่อนๆ เลือกหมายเลขอะไรกันครับ</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fubuntu%2Fchange-default-editor-on-ubuntu.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/ubuntu/change-default-editor-on-ubuntu.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ติดตั้ง Linux ผ่าน Network ด้วย PXE Server</title>
		<link>http://www.howtoconfig.com/os/ubuntu/network-install-via-pxe-server.html</link>
		<comments>http://www.howtoconfig.com/os/ubuntu/network-install-via-pxe-server.html#comments</comments>
		<pubDate>Fri, 20 Jun 2008 17:41:01 +0000</pubDate>
		<dc:creator>กวิน ชัยเลิศ</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[Operating System]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[dhcp]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[network booting]]></category>
		<category><![CDATA[network install]]></category>
		<category><![CDATA[open standard]]></category>
		<category><![CDATA[PXE]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[syslinux]]></category>
		<category><![CDATA[tftp-server]]></category>

		<guid isPermaLink="false">http://www.howtoconfig.com/?p=24</guid>
		<description><![CDATA[มาทำความรู้รักกับ PXE กันก่อนครับ PXE หรือ Preboot eXecution Environment เป็น Open Standard ที่พัฒนาขึ้นโดย Intel ซึ่ง PXE นี้จะยอมให้ Computer ต่างๆ (Server, PC, Laptop, Notebook ที่ BIOS ลองรับ PXE Booting) สามารถ boot ผ่าน network ได้ไม่ต้องง้อ floppy, cd หรือ dvd กันเลยทีเดียว (มันสุดยอดจริงๆ ครับ) มาลุยกันเลยครับ Server : CentOS 5.1 + dhcp + tftp-server + httpd + syslinux Client : Ubuntu [...]]]></description>
			<content:encoded><![CDATA[<p><strong>มาทำความรู้รักกับ PXE กันก่อนครับ</strong><br />
<span style="color: #0000ff;">PXE</span> หรือ <span style="color: #0000ff;">P</span>reboot e<span style="color: #0000ff;">X</span>ecution <span style="color: #0000ff;">E</span>nvironment เป็น Open Standard ที่พัฒนาขึ้นโดย Intel ซึ่ง PXE นี้จะยอมให้ Computer ต่างๆ (Server, PC, Laptop, Notebook ที่ BIOS ลองรับ PXE Booting) สามารถ boot ผ่าน network ได้ไม่ต้องง้อ floppy, cd หรือ dvd กันเลยทีเดียว (มันสุดยอดจริงๆ ครับ)</p>
<p>มาลุยกันเลยครับ<br />
Server : CentOS 5.1 + dhcp + tftp-server + httpd + syslinux<br />
Client : Ubuntu 8.04</p>
<p>เอาเป็นว่าทุกๆ ท่านติดตั้ง CentOS ไว้เป็นที่เรียบร้อย ทีนี้ก็เป็นขั้นตอนการติดตั้ง PXE Server ละครับ</p>
<p>แปลงร่างเป็น root</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">su</span> -</pre></div></div>

<p>ติดตั้ง dhcp, tftp-server, httpd และ syslinux</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> dhcp tftp-server httpd syslinux</pre></div></div>

<p>เตรียม install files (ผมเลือกติดตั้ง Ubuntu 8.04)<br />
<a href="http://www.howtoconfig.com/linux/how-to-mount-iso-image-under-linux.html">>>วิธี mount iso image บน linux</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>ftp.science.nus.edu.sg<span style="color: #000000; font-weight: bold;">/</span>linux<span style="color: #000000; font-weight: bold;">/</span>ubuntu-ISO<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8.04</span><span style="color: #000000; font-weight: bold;">/</span>ubuntu-<span style="color: #000000;">8.04</span>-server-i386.iso
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html<span style="color: #000000; font-weight: bold;">/</span>mirror<span style="color: #000000; font-weight: bold;">/</span>ubuntu<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8.04</span>
<span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-o</span> loop ubuntu-<span style="color: #000000;">8.04</span>-server-i386.iso <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html<span style="color: #000000; font-weight: bold;">/</span>mirror<span style="color: #000000; font-weight: bold;">/</span>ubuntu<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8.04</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-fr</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>html<span style="color: #000000; font-weight: bold;">/</span>mirror<span style="color: #000000; font-weight: bold;">/</span>ubuntu<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8.04</span><span style="color: #000000; font-weight: bold;">/</span>install<span style="color: #000000; font-weight: bold;">/</span>netboot<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">/</span>tftpboot</pre></div></div>

<p><span id="more-24"></span><br />
Config tftp-server<br />
โดย default CentOS จะ disable tftp ที่ start ผ่าน xinetd ให้ทำการ configuration file &#8220;/etc/xinetd.d/tftp&#8221; ใหม่ด้วยการเปลี่ยน &#8220;disable = yes&#8221; ให้เป็น &#8220;disable = no&#8221; หรือใช้ sed ทำการแก้ไขก็ได้ครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'/disable/ s/yes/no/'</span> <span style="color: #660033;">-i</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>xinetd.d<span style="color: #000000; font-weight: bold;">/</span>tftp
<span style="color: #666666; font-style: italic;">#restart xinetd</span>
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>xinetd restart</pre></div></div>

<p>Config dhcpd<br />
โดย default CentOS จะให้ copy configuration file มาจาก &#8220;/usr/share/doc/dhcp*/dhcpd.conf.sample&#8221; ส่วนตัวแล้วผมใช้เพียง configuration และ parameters บางตัวเท่านั้น ตามตัวอย่างนี้ครับ</p>

<div class="wp_syntax"><div class="code"><pre class="scheme" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">;</span>
<span style="color: #808080; font-style: italic;">;</span>
<span style="color: #808080; font-style: italic;">;</span>
<span style="color: #808080; font-style: italic;">;</span>
<span style="color: #808080; font-style: italic;">;</span>
<span style="color: #ff0000;">&quot;pxelinux.0&quot;</span><span style="color: #808080; font-style: italic;">;</span>
&nbsp;</pre></div></div>

<p>หลังจากทำการแก้ไข configuration file &#8220;/etc/dhcpd.conf&#8221; ก็ Start dhcpd ได้เลยครับ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>dhcpd start</pre></div></div>

<p><span style="color: #ff0000;">Note : สามารถกำหนดได้ว่าจะให้ dhcpd ใช้ Interface ใดๆ โดย config ที่ file &#8220;/etc/sysconfig/dhcpd&#8221; ทำการเปลี่ยนค่าของ Interface DHCPDARGS=<em>ethX</em></span></p>
<p>เท่านี้ก็สามารถ Install Ubuntu ผ่าน Network โดย PXE Server บน CentOS ได้แล้วครับ<br />
หากเพื่อนๆ มีข้อสงสัยก็ถามมาได้เลยนะครับ webmaster@howtoconfig.com</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.howtoconfig.com%2Fos%2Fubuntu%2Fnetwork-install-via-pxe-server.html&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.howtoconfig.com/os/ubuntu/network-install-via-pxe-server.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

