<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>keithyau</title>
	<atom:link href="http://keithyau.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://keithyau.wordpress.com</link>
	<description>IT solution 's blog</description>
	<lastBuildDate>Mon, 18 May 2009 05:43:04 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='keithyau.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/40fdf0e2b425e8a9a8f664d4ebc910b9?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>keithyau</title>
		<link>http://keithyau.wordpress.com</link>
	</image>
			<item>
		<title>淺談叢集式電腦 ( Clustering )</title>
		<link>http://keithyau.wordpress.com/2009/05/18/172/</link>
		<comments>http://keithyau.wordpress.com/2009/05/18/172/#comments</comments>
		<pubDate>Mon, 18 May 2009 05:38:00 +0000</pubDate>
		<dc:creator>keithyau</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[server management]]></category>
		<category><![CDATA[Availability]]></category>
		<category><![CDATA[business IT solution]]></category>
		<category><![CDATA[clustering]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[redundancy]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[可靠性]]></category>

		<guid isPermaLink="false">http://keithyau.wordpress.com/?p=172</guid>
		<description><![CDATA[
當你開始接觸 clustering 時就會發覺, 原來沒學 clustering 根本等於沒有學 Unix / Linux.
我們一般情況用到的 SERVER / Client 只是皮毛. Clustering 一個字, 內裹包含了多種技術,
以下例子是常用的


HPC – High performance computing


Server Load balancing 負載平衡


DNS round robin


LVS – ipvsadm




HA – High availability


XEN cluster


Heartbeat


DRBD - http://www.drbd.org/




Parallel computing


http://en.wikipedia.org/wiki/MPICH




今天所談的是入門級的 clustering, LVS
LVS – Linux virtual server主要是用作負載平衡 與 HA,
What is the Linux Virtual Server?
The Linux Virtual Server is a highly scalable and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=172&subd=keithyau&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><!-- 		@page { size: 8.27in 11.69in; margin: 0.79in } 		P { margin-bottom: 0.08in } 		H1 { margin-bottom: 0.08in } 		H1.western { font-family: "AR PL UMing HK", sans-serif; font-size: 16pt } 		H1.cjk { font-family: "AR PL UMing HK"; font-size: 16pt } 		H1.ctl { font-family: "Tahoma"; font-size: 16pt } 		H2 { margin-bottom: 0.08in } 		H3 { margin-bottom: 0.08in } 		H3.western { font-family: "AR PL UMing HK", sans-serif } 		H3.cjk { font-family: "AR PL UMing HK" } 		TD P { margin-bottom: 0in } --></p>
<pre>當你開始接觸 clustering 時就會發覺, 原來沒學 clustering 根本等於沒有學 Unix / Linux.
我們一般情況用到的 SERVER / Client 只是皮毛. Clustering 一個字, 內裹包含了多種技術,
以下例子是常用的</pre>
<ol>
<li>
<pre>HPC – High performance computing</pre>
</li>
<li>
<pre>Server Load balancing 負載平衡</pre>
<ol>
<li>
<pre>DNS round robin</pre>
</li>
<li>
<pre>LVS – ipvsadm</pre>
</li>
</ol>
</li>
<li>
<pre>HA – High availability</pre>
<ol>
<li>
<pre>XEN cluster</pre>
</li>
<li>
<pre>Heartbeat</pre>
</li>
<li>
<pre>DRBD - <a href="http://www.drbd.org/">http://www.drbd.org/</a></pre>
</li>
</ol>
</li>
<li>
<pre>Parallel computing</pre>
<ol>
<li>
<pre><a href="http://en.wikipedia.org/wiki/MPICH">http://en.wikipedia.org/wiki/MPICH</a></pre>
</li>
</ol>
</li>
</ol>
<h2>今天所談的是入門級的 <span style="font-family:AR PL UMing HK,serif;">clustering, LVS</span></h2>
<pre>LVS – Linux virtual server主要是用作負載平衡 與 HA,</pre>
<p><span style="font-family:AR PL UMing HK,serif;"><a href="http://www.linuxvirtualserver.org/whatis.html"><span style="font-size:small;">What is the Linux Virtual Server?</span></a></span></p>
<p><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:small;">The Linux Virtual Server is a highly scalable and highly available server built on a cluster of real servers, with the <a href="http://kb.linuxvirtualserver.org/wiki/Load_balancer">load balancer</a> running on the Linux operating system. The architecture of the server cluster is fully transparent to end users, and the users interact as if it were a single high-performance virtual server.</span></span></p>
<pre>SOURCE: <a href="http://www.linuxvirtualserver.org/">http://www.linuxvirtualserver.org/</a> 

負載平衡的意思是把一部服務器的工作分到多部服務器之上. 由一個服務器為主人 ( Master ), 其他為幫手 ( node ). 如下圖

<img class="alignnone size-full wp-image-171" title="more_on_clustering" src="http://keithyau.files.wordpress.com/2009/05/more_on_clustering.jpg?w=600&#038;h=522" alt="more_on_clustering" width="600" height="522" /></pre>
<p>更可以制定負載平衡的策略</p>
<p>詳程參考<span style="font-family:AR PL UMing HK,serif;">, <a href="http://linux.die.net/man/8/ipvsadm">http://linux.die.net/man/8/ipvsadm</a> </span></p>
<ol>
<li>
<ol>
<li><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:small;">rr 		- Robin Robin: distributes jobs equally amongst the available real 		servers. </span></span></li>
<li><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:small;">wrr 		- Weighted Round Robin: assigns jobs to real servers proportionally 		to there real  servers&#8217;  weight. Servers  with  higher weights  		receive  new  jobs first and get more jobs than servers with lower 		weights. Servers with equal weights get an equal distribution of 		new jobs. </span></span></li>
<li><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:small;">lc 		 &#8211;  Least-Connection:  assigns more jobs to real servers with fewer 		active jobs. </span></span></li>
<li><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:small;">wlc 		- Weighted Least-Connection: assigns more  jobs  to  servers with  		fewer  jobs  and  relative  to  the real  servers&#8217; weight (Ci/Wi). 		This is the default. </span></span></li>
<li><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:small;">lblc 		- Locality-Based Least-Connection:  assigns  jobs  destined for  		the same IP address to the same server if the server is not 		overloaded and available; otherwise assign jobs to servers  with 		fewer jobs, and keep it for future assignment. </span></span></li>
<li><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:small;">lblcr 		  &#8211;   Locality-Based  Least-Connection  with  Replication: assigns 		jobs destined for the same IP address to the  least-connection  		node  in  the server set for the IP address. If all the node in the 		server set are over loaded, it picks up a node with fewer  jobs  in 		the cluster and adds it in the sever set for the target. If the 		server set has not been modified for  the  specified  time, the 		most loaded node is removed from the server set, in order to avoid 		high degree of replication. </span></span></li>
<li><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:small;">dh 		- Destination Hashing: assigns jobs to servers through  looking  up 		a statically assigned hash table by their destination IP addresses. </span></span></li>
<li><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:xx-small;">sh 		- Source Hashing: assigns jobs to servers through looking  up a 		statically assigned hash table by their source IP addresses. </span></span></li>
<li><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:small;">sed 		 &#8211;  Shortest  Expected Delay: assigns an incoming job to the server 		with the shortest expected delay. The expected delay that the  job  		will experience  is (Ci + 1) / Ui if  sent to the ith server, in 		which Ci is the number of jobs on the the ith server and Ui is the 		fixed service rate (weight) of the ith server. </span></span></li>
<li><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:small;">nq 		 &#8211;  Never Queue: assigns an incoming job to an idle server if there 		is, instead of waiting for a fast one; if all the servers are busy, 		it adopts the Shortest Expected Delay policy to assign the job. </span></span></li>
</ol>
</li>
</ol>
<p><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:small;">source: Man page of ipvsadm</span></span></p>
<h2>負載平衡方法大致上有</h2>
<ol>
<li><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:medium;">NAT 	(Network address translation)</span></span></li>
<li><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:medium;">DR 	– direct routing</span></span></li>
<li><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:medium;">Tunneling</span></span></li>
</ol>
<h2>以下是 <span style="font-family:AR PL UMing HK,serif;">LVS – NAT LOAD BALANCING </span>的參考</h2>
<p><span style="font-size:small;">原意圖</span></p>
<p><img class="alignnone size-medium wp-image-173" title="VS-NAT" src="http://keithyau.files.wordpress.com/2009/05/vs-nat.gif?w=300&#038;h=279" alt="VS-NAT" width="300" height="279" /></p>
<p><span style="font-family:AR PL UMing HK,serif;"><span style="font-size:medium;">VS via NAT, <span style="font-size:xx-small;">source: </span><span style="color:#000080;"><span style="text-decoration:underline;"><a href="http://www.linuxvirtualserver.org/VS-NAT.html"><span style="font-size:xx-small;">http://www.linuxvirtualserver.org/VS-NAT.html</span></a></span></span></span></span></p>
<h2>指令</h2>
<h3 class="cjk">在 <span style="font-family:AR PL UMing HK,sans-serif;">Master (NAT) </span></h3>
<p><span style="font-family:AR PL UMing HK,serif;"> echo 1 &gt; /proc/sys/net/ipv4/ip_forward </span></p>
<p><span style="font-family:AR PL UMing HK,serif;"> </span></p>
<p><span style="font-family:AR PL UMing HK,serif;">ipvsadm -A -t 192.168.7.200:80 -s rr </span></p>
<p><span style="font-family:AR PL UMing HK,serif;">ipvsadm -a -t 192.168.7.200:80 -r 192.168.7.201:80 -m </span></p>
<p><span style="font-family:AR PL UMing HK,serif;">ipvsadm -a -t 192.168.7.200:80 -r 192.168.7.202:80 -m </span></p>
<p><span style="font-family:AR PL UMing HK,serif;">ipvsadm -a -t 192.168.7.200:80 -r 192.168.7.203:80 -m </span></p>
<p><span style="font-family:AR PL UMing HK,serif;"> </span></p>
<p><span style="font-family:AR PL UMing HK,serif;">ipvsadm -L –stats  (</span>現時的連接情況<span style="font-family:AR PL UMing HK,serif;">)</span></p>
<p><span style="font-family:AR PL UMing HK,serif;"> </span></p>
<h3 class="cjk">在 <span style="font-family:AR PL UMing HK,sans-serif;">Nodes: </span></h3>
<p><span style="font-family:AR PL UMing HK,serif;"><strong>Set default route to 192.168.7.200</strong></span></p>
<p><span style="font-family:AR PL UMing HK,serif;">route add default gw 192.168.7.000</span></p>
<h3 class="cjk"><span style="font-family:AR PL UMing HK,sans-serif;">ip </span>地址</h3>
<table border="1" cellspacing="0" cellpadding="4" width="100%">
<col width="128"></col>
<col width="128"></col>
<tbody>
<tr valign="top">
<td width="50%"><strong>名稱</strong></td>
<td width="50%"><strong>意思</strong></td>
</tr>
<tr valign="top">
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">192.168.7.200</span></td>
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">Master</span></td>
</tr>
<tr valign="top">
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">192.168.7.201</span></td>
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">Node</span></td>
</tr>
<tr valign="top">
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">192.168.7.202</span></td>
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">Node</span></td>
</tr>
<tr valign="top">
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">192.168.7.203</span></td>
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">Node</span></td>
</tr>
<tr valign="top">
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">192.168.7.1</span></td>
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">Default GW</span></td>
</tr>
<tr valign="top">
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">80</span></td>
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">Www – web </span>服務器的 			<span style="font-family:AR PL UMing HK,serif;">port number</span></td>
</tr>
<tr valign="top">
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">rr</span></td>
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">Round robin </span>策略</td>
</tr>
<tr valign="top">
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">-m</span></td>
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">LVS NAT </span></td>
</tr>
<tr valign="top">
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">-a</span></td>
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">ADD SERVER</span></td>
</tr>
<tr valign="top">
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">-A</span></td>
<td width="50%"><span style="font-family:AR PL UMing HK,serif;">ADD SERVICE</span></td>
</tr>
<tr valign="top">
<td width="50%"></td>
<td width="50%"></td>
</tr>
</tbody>
</table>
<p>Thanks, 有興趣多討論請跟我連絡 keithyau@yubis.net !!</p>
Posted in Information Technology, server management Tagged: Availability, business IT solution, clustering, performance, redundancy, server, technical, 可靠性 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/keithyau.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/keithyau.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/keithyau.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/keithyau.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/keithyau.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/keithyau.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/keithyau.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/keithyau.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/keithyau.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/keithyau.wordpress.com/172/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=172&subd=keithyau&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://keithyau.wordpress.com/2009/05/18/172/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e0c38730792fb4e3595a3fd00e0b141f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">keithyau</media:title>
		</media:content>

		<media:content url="http://keithyau.files.wordpress.com/2009/05/more_on_clustering.jpg" medium="image">
			<media:title type="html">more_on_clustering</media:title>
		</media:content>

		<media:content url="http://keithyau.files.wordpress.com/2009/05/vs-nat.gif?w=300" medium="image">
			<media:title type="html">VS-NAT</media:title>
		</media:content>
	</item>
		<item>
		<title>淺談網頁服務器群的設計 (A group of web server)</title>
		<link>http://keithyau.wordpress.com/2009/04/03/%e6%b7%ba%e8%ab%87%e7%b6%b2%e9%a0%81%e6%9c%8d%e5%8b%99%e5%99%a8%e7%be%a4%e7%9a%84%e8%a8%ad%e8%a8%88-a-group-of-web-server/</link>
		<comments>http://keithyau.wordpress.com/2009/04/03/%e6%b7%ba%e8%ab%87%e7%b6%b2%e9%a0%81%e6%9c%8d%e5%8b%99%e5%99%a8%e7%be%a4%e7%9a%84%e8%a8%ad%e8%a8%88-a-group-of-web-server/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 03:56:21 +0000</pubDate>
		<dc:creator>keithyau</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[server management]]></category>
		<category><![CDATA[sme]]></category>
		<category><![CDATA[virtualization]]></category>
		<category><![CDATA[cost reduction]]></category>
		<category><![CDATA[網絡]]></category>
		<category><![CDATA[虛擬化]]></category>
		<category><![CDATA[IT risk]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[virtual networking]]></category>
		<category><![CDATA[vmware howto]]></category>
		<category><![CDATA[xen]]></category>
		<category><![CDATA[xen howto]]></category>
		<category><![CDATA[可靠性]]></category>
		<category><![CDATA[中小企]]></category>

		<guid isPermaLink="false">http://keithyau.wordpress.com/?p=164</guid>
		<description><![CDATA[
前陣子, 在師兄那邊聽了一個他的經驗, 一間寄存公司其中一個網頁服務器壞了的經驗.
話說一個裝有 800 客戶的網頁服務器只用 raid 5 作備份, 沒有備份服務器 (HA / heartbeat)的低成本制作,
某天一下子死掉兩個硬碟. 之後的 18 小時, 客戶服務部就 ...

在 HSBC 中學得的服務器管理知識, 告訴我任何作實戰 production 的服務器必需有備份,
而且是能夠在 15 分鐘內回復的備份. 不過, 現實情況是一些中小型機構, 沒有兩倍的成本去做備份.
所以回復時間在 18-24小時內都可以接受.

現時中小企的 IT 成本, 軟件比硬件高得多. 所以如果選用開源軟件,
再買一個 HKD $3000 的小服務器就安全得多了.

本文是以一個案例作介紹以虛擬技術把服務器模組化, 令備份 / 資源調動時方便得多.
那我師兄的故事, 如果是我的話怎樣處理 ? 先發現問題所在

問題 1: 裝有 800 客戶的服務器沒有虛擬化, 在救援 / 備份時造成不便
問題 2: 沒有備用服務器, 服務器停止的 18 小時中客戶服務部的開支比買一個小型服務器更高
問題 3: 除 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=164&subd=keithyau&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><!-- 	 	 --></p>
<h2>前陣子, 在師兄那邊聽了一個他的經驗, 一間寄存公司其中一個網頁服務器壞了的經驗.</h2>
<pre>話說一個裝有 800 客戶的網頁服務器只用 raid 5 作備份, 沒有備份服務器 (HA / heartbeat)的低成本制作,
某天一下子死掉兩個硬碟. 之後的 18 小時, 客戶服務部就 ...

在 HSBC 中學得的服務器管理知識, 告訴我任何作實戰 production 的服務器必需有備份,
而且是能夠在 15 分鐘內回復的備份. 不過, 現實情況是一些中小型機構, 沒有兩倍的成本去做備份.
所以回復時間在 18-24小時內都可以接受.

現時中小企的 IT 成本, 軟件比硬件高得多. 所以如果選用開源軟件,
再買一個 HKD $3000 的小服務器就安全得多了.

<strong>本文是以一個案例作介紹以虛擬技術把服務器模組化</strong><strong>, </strong><strong>令備份 </strong><strong>/ </strong><strong>資源調動時方便得多</strong>.
那我師兄的故事, 如果是我的話怎樣處理 ? 先發現問題所在

問題 1: 裝有 800 客戶的服務器沒有虛擬化, 在救援 / 備份時造成不便
問題 2: 沒有備用服務器, 服務器停止的 18 小時中客戶服務部的開支比買一個小型服務器更高
問題 3: 除 raid 5 以外, 沒有資料備份. 原因可能是沒有虛擬化令備份程序複雜

所以根本問題是服務器的設計, 與技術人員的能耐無關 !

解決方法: 沒有人說備份服務器的比例一定是 1:1 的, 以一部備份多部 production 亦可.
因成本與客戶要求而定, 備份服務器不一定要有 raid, 不一定要有足夠的計算能力 (cpu power / cpw).
因此, 一部 HKD $3000 的服務器, 只要能夠作備份就足夠有餘了. 

但出現的問題是, 

1) 如果我把所有客戶的資料都備份, 資源需求很大. 這時可考慮 rsync, rsync 是增加式資料備份,
只備份已更改 / 新增檔案

以下是 rysnc 的示範, 在linux備份服務器輸入:
<strong>sudo rsync -avl --delete --exclude=/</strong><strong>不包括的資料夾</strong><strong>1 --exclude=/</strong><strong>不包括的資料夾</strong><strong>2 </strong><strong>
來源地址</strong><strong>:/</strong><strong>要備份的資料夾 </strong><strong>/</strong><strong>本地儲存資料的位置</strong>

2) CPU 已經用來服務客人了, 怎樣做備份
這時需要 at 指令 / crontab, 可以設定只在特定時間作備份. 以前在 HSBC 時, 備份會在股市收市後進行.
以 at command 作示範

at 1900     ← 意思是當天下午 7:00
&gt; 備份指令 (如以上的 rsync)
&gt; 完成後 CTRL + D

除此之外, 把服務器虛擬化, 有些選擇是把服務器放到一個 img 檔案中.
這樣, 備份時把整個 img 檔案備份就能佔用較小資源.

3) 出事了, 怎樣啟動備用服務器 ?

你可以選用 HA (high availability) 設計, 並以 heartbeat 啟動, 這樣就可以作即時回復. 但成本較高.
在這文中不作詳談. 一般來說, 可以手動. 但先要為服務器作一個好的設計.</pre>
<h2>以下是一個網頁服務器群的設計</h2>
<p>所謂服務器模組化就是一個服務器只作一種服務. 以前的日子, 成本會很高. 但在虛擬化之下就不算問題. 參考虛擬化制作:  <a href="http://www.yubis.net/blog/keith/summary-virtualbox-vmware-xen-351?page=2">http://www.yubis.net/blog/keith/summary-virtualbox-vmware-xen-351?page=2</a></p>
<p>在服務器模組化出名的有 MICROSOFT VIRTUAL SERVER, 但使用 xen 的話更好. 在使用服務器群時會出現一個重大問題. 就是同一種服務不能有兩個服務器, 因為同一個 ip 地址 不能用同一個 port. 例如 port 80, 路由器只能指向一個服務器. 這時, 模組化就會不攻自破.</p>
<p>以下是一個解決方法</p>
<p><img class="alignnone size-full wp-image-166" title="web_server_group1" src="http://keithyau.files.wordpress.com/2009/04/web_server_group1.jpg?w=500&#038;h=387" alt="web_server_group1" width="500" height="387" /></p>
<p>上圖中有兩個網頁服務器. External 是給客人用的. <strong>但如果想把公司的網頁都用同一個 </strong><strong>ip </strong><strong>地址放出去</strong><strong>, </strong><strong>那就要 </strong><strong>proxy </strong><strong>服務器的幫助</strong><strong>.</strong> 先在 External 中開動 apache 的 proxy modules</p>
<p># a2enmod proxy*</p>
<p>#/etc/init.d/apache2 restart</p>
<p>例如公司的網頁是 abc.xyz.org, 那分別在 dns 服務器, External &amp; Internal 中加上圖中的設定, abc.xyz.org 就可以提供服務了.</p>
<h1>以上說的與師兄的案例有什麼關連 ?</h1>
<p>試把圖中 internal web server 當成師兄故事中所死掉的服務器, 那不就把 External 中的設定改一下, 由 死掉的服務器指向備份中的服務器就成了嗎 ? 同樣方法可以加上更多的網頁服務器  !</p>
Posted in Information Technology, server management, sme, virtualization Tagged: cost reduction, 網絡, 虛擬化, IT risk, server, virtual networking, virtualization, vmware howto, xen, xen howto, 可靠性, 中小企 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/keithyau.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/keithyau.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/keithyau.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/keithyau.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/keithyau.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/keithyau.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/keithyau.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/keithyau.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/keithyau.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/keithyau.wordpress.com/164/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=164&subd=keithyau&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://keithyau.wordpress.com/2009/04/03/%e6%b7%ba%e8%ab%87%e7%b6%b2%e9%a0%81%e6%9c%8d%e5%8b%99%e5%99%a8%e7%be%a4%e7%9a%84%e8%a8%ad%e8%a8%88-a-group-of-web-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e0c38730792fb4e3595a3fd00e0b141f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">keithyau</media:title>
		</media:content>

		<media:content url="http://keithyau.files.wordpress.com/2009/04/web_server_group1.jpg" medium="image">
			<media:title type="html">web_server_group1</media:title>
		</media:content>
	</item>
		<item>
		<title>如何設計一個技術性的演講 (Technical presentation)</title>
		<link>http://keithyau.wordpress.com/2009/03/27/%e5%a6%82%e4%bd%95%e8%a8%ad%e8%a8%88%e4%b8%80%e5%80%8b%e6%8a%80%e8%a1%93%e6%80%a7%e7%9a%84%e6%bc%94%e8%ac%9b-technical-presentation/</link>
		<comments>http://keithyau.wordpress.com/2009/03/27/%e5%a6%82%e4%bd%95%e8%a8%ad%e8%a8%88%e4%b8%80%e5%80%8b%e6%8a%80%e8%a1%93%e6%80%a7%e7%9a%84%e6%bc%94%e8%ac%9b-technical-presentation/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 03:44:54 +0000</pubDate>
		<dc:creator>keithyau</dc:creator>
				<category><![CDATA[Presentation]]></category>
		<category><![CDATA[Technical writing]]></category>
		<category><![CDATA[sme]]></category>
		<category><![CDATA[startup business]]></category>
		<category><![CDATA[business IT solution]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[writing]]></category>
		<category><![CDATA[創業]]></category>
		<category><![CDATA[中小企]]></category>
		<category><![CDATA[演講]]></category>

		<guid isPermaLink="false">http://keithyau.wordpress.com/?p=162</guid>
		<description><![CDATA[

在上一次寫好計劃書之後, 今次就來準備演講. 很多時候, 當你的計劃書被接納之後, 都需要去演講. 因為大老闆的時間很寶貴的, 沒有時間去細看你的計劃書.
其實, 這次我準備演講的目的, 不是真正需要一次演講. 而是我希望跟老闆傾談自己概念的時候, 可以更加流暢. 準備演講的過程, 可以幫人整理問題, 找尋可能受批評的地方.
作為創業者 / 高層 / 年輕的你, 常都需要去表現自己, 相信了解如何演講可以幫助你.
這篇文章就來淺談演講,為我們這些新手做個解決方案
演講 四大法則 Presentation 4P

Product / Background (你的產品 	/ 計劃背景)
Problem (現存問題)
Possibilities (可行的方案)
Possible solution / 	Recommendation (你所建議的方案)

這四個法則大概是整個演講的流程, 當然還需要一些頭尾配合, 在最後, 我會介紹我自己篇排的流程.
如果你是在介紹產品, 那你的第一個 p 就是說 product. 你需要說明這個產品的相關背景, 例如為什麼會想制造這個產品.如你你介紹的不是產品, 那就說明你的計劃背景.
第二個 p (problem) 就是說明現存問題, 很多時都是出現問題, 人才會找解決方案. 但成功了的人 (老闆) 很少會自己發現問題的.所以就由我們這些進取的下一代來告知他們.
第三個 p (Possibilities) 是希望你介紹現存的一些可行方案去解決 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=162&subd=keithyau&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><!-- 	 	 --></p>
<h1></h1>
<p>在上一次寫好計劃書之後, 今次就來準備演講. 很多時候, 當你的計劃書被接納之後, 都需要去演講. 因為大老闆的時間很寶貴的, 沒有時間去細看你的計劃書.</p>
<p>其實, 這次我準備演講的目的, 不是真正需要一次演講. 而是我希望跟老闆傾談自己概念的時候, 可以更加流暢. 準備演講的過程, 可以幫人整理問題, 找尋可能受批評的地方.</p>
<p>作為創業者 / 高層 / 年輕的你, 常都需要去表現自己, 相信了解如何演講可以幫助你.</p>
<p>這篇文章就來淺談演講,為我們這些新手做個解決方案</p>
<h2>演講 四大法則 Presentation 4P</h2>
<ol>
<li>Product / Background (你的產品 	/ 計劃背景)</li>
<li>Problem (現存問題)</li>
<li>Possibilities (可行的方案)</li>
<li>Possible solution / 	Recommendation (你所建議的方案)</li>
</ol>
<p>這四個法則大概是整個演講的流程, 當然還需要一些頭尾配合, 在最後, 我會介紹我自己篇排的流程.</p>
<p>如果你是在介紹產品, 那你的第一個 p 就是說 product. 你需要說明這個產品的相關背景, 例如為什麼會想制造這個產品.如你你介紹的不是產品, 那就說明你的計劃背景.</p>
<p>第二個 p (problem) 就是說明現存問題, 很多時都是出現問題, 人才會找解決方案. 但成功了的人 (老闆) 很少會自己發現問題的.所以就由我們這些進取的下一代來告知他們.</p>
<p>第三個 p (Possibilities) 是希望你介紹現存的一些可行方案去解決 第二個 p 說明的問題. 為什麼方案一比方案二好 ? 為什麼你的方案可取 ? 就在這裡開始發揮了.</p>
<p>如果你是介紹產品的話, 第四個 p (possible solution)就是你整個演講的中心. 你就是在這裡推銷自己的產品, 說明為什麼你的產品可以解決第二個 p 的問題, 而第三個 p 中介紹的方案不可行. 個人來說, 我會把最多時間花在這裡.</p>
<h2>演講注意事項</h2>
<ol>
<li>Presentation 4 P 之前, 	必需弄清演講對象 (Target 	audience). 在對象未明之前, 	不要準備演講</li>
<li>Presentation 4 P 之前, 	必需弄清楚演講目的. 	你是在找尋伙伴 / 	投資者 / 買家 	?</li>
<li>說明事例時, 事不過三.<br />
記住人的記憶力有限, 	舉出事例時, 四個太多, 	二個太少. 三個就適中了.</li>
<li>進入正提前要先說明演講內容與次序 (scope), 	並建議聽眾有需要的話可更改次序.</li>
<li>多用圖解, 避免一個 	ppt 板面多於 3 	+ 1 ( 3 論點 + 1 題目)</li>
<li>最後需要作個總結 (conclusion)</li>
<li>記住 ppt 不是你的講稿, 	ppt 的目的只是用作表示圖解, 	動畫, 數據等</li>
<li>需要預備一些敏感題目答案, 	這些往往會是別人發問的東西</li>
<li>一個正式演講約十五分鐘 + 	五分鐘發問 (Q &amp; 	A)</li>
</ol>
<h2>我的演講流程示範</h2>
<ol>
<li>Purpose 演講目的</li>
<li>Scope　流程</li>
<li>Background　背景</li>
<li>Problem　問題</li>
<li>Problem Examples (User 	experience scene)　案例</li>
<li>Existing solutions　現行解決方案</li>
<li>My product &#8211; How it can 	solve the problem ?　產品介紹</li>
<li>Brief on my product 	architecture　產品設計</li>
<li>Cost　成本</li>
<li>Conclusion　總結</li>
</ol>
Posted in Presentation, sme, startup business, Technical writing Tagged: business IT solution, howto, Presentation, technical, Technical writing, writing, 創業, 中小企, 演講 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/keithyau.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/keithyau.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/keithyau.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/keithyau.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/keithyau.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/keithyau.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/keithyau.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/keithyau.wordpress.com/162/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/keithyau.wordpress.com/162/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/keithyau.wordpress.com/162/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=162&subd=keithyau&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://keithyau.wordpress.com/2009/03/27/%e5%a6%82%e4%bd%95%e8%a8%ad%e8%a8%88%e4%b8%80%e5%80%8b%e6%8a%80%e8%a1%93%e6%80%a7%e7%9a%84%e6%bc%94%e8%ac%9b-technical-presentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e0c38730792fb4e3595a3fd00e0b141f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">keithyau</media:title>
		</media:content>
	</item>
		<item>
		<title>淺談設計技術性文章 – Technical writing for engineers and scientists</title>
		<link>http://keithyau.wordpress.com/2009/03/21/%e6%b7%ba%e8%ab%87%e8%a8%ad%e8%a8%88%e6%8a%80%e8%a1%93%e6%80%a7%e6%96%87%e7%ab%a0-%e2%80%93-technical-writing-for-engineers-and-scientists/</link>
		<comments>http://keithyau.wordpress.com/2009/03/21/%e6%b7%ba%e8%ab%87%e8%a8%ad%e8%a8%88%e6%8a%80%e8%a1%93%e6%80%a7%e6%96%87%e7%ab%a0-%e2%80%93-technical-writing-for-engineers-and-scientists/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 03:49:13 +0000</pubDate>
		<dc:creator>keithyau</dc:creator>
				<category><![CDATA[Proposal]]></category>
		<category><![CDATA[Technical writing]]></category>
		<category><![CDATA[startup business]]></category>
		<category><![CDATA[engineer]]></category>
		<category><![CDATA[engineers]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[scientists]]></category>
		<category><![CDATA[technical]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[writing]]></category>
		<category><![CDATA[創業]]></category>
		<category><![CDATA[中小企]]></category>

		<guid isPermaLink="false">http://keithyau.wordpress.com/?p=158</guid>
		<description><![CDATA[
最近, 在寫技術性文章 / 計劃書 / 產品介紹 / 報告 時發覺,
GOOGLE 竟然找不到一個好方法.
之後就去請教一位英文教授, 在他那裹借來了一本書
&#60;&#60;Pocket Book of Technical Writing - for Engineers and Scientists 2nd&#62;&#62;.
清楚易明簡潔地令你明白如何開筆, 一份技術性文章應該如何設計和應用什麼表達方式.
相信作為工程師 / 科學人員, 每天醉心於研究的你們,
在表達自己成果的時侯都會跟我有同樣的煩惱.
從這本書了解到, 寫技術性文章約有四大部份


文章的目的和針對讀者


針對技術性文章的特點


技術性話題


多用圖形 / 圖畫表達


數字資料以表達數量與方向


由淺至深, 準確的表達方式




決定文章性質


計劃書


報告


研究報告


說明書


建議書




選擇不同部份的表達方式


說明名詞的含意 (classify terms)


結構性陳述 (Description of mechanism)


流程性陳述 (Description of Process)


圖表 (Visual)




本文以計劃書作為例子
一般的計劃書格式有時過於複雜,
&#60;&#60;Pocket Book of Technical Writing - for Engineers and Scientists 2nd&#62;&#62;
中建議了另一種計劃書格式 (Informal Proposals)
Informal Proposals
Introduction


Purpose - Describe the reason [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=158&subd=keithyau&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><!-- 	 	 --></p>
<pre>最近, 在寫技術性文章 / 計劃書 / 產品介紹 / 報告 時發覺,
GOOGLE 竟然找不到一個好方法.
之後就去請教一位英文教授, 在他那裹借來了一本書
&lt;&lt;Pocket Book of Technical Writing - for Engineers and Scientists 2nd&gt;&gt;.
清楚易明簡潔地令你明白如何開筆, 一份技術性文章應該如何設計和應用什麼表達方式.
相信作為工程師 / 科學人員, 每天醉心於研究的你們,
在表達自己成果的時侯都會跟我有同樣的煩惱.</pre>
<h2>從這本書了解到, 寫技術性文章約有四大部份</h2>
<ol>
<li>
<pre>文章的目的和針對讀者</pre>
</li>
<li>
<pre>針對技術性文章的特點</pre>
<ol>
<li>
<pre>技術性話題</pre>
</li>
<li>
<pre>多用圖形 / 圖畫表達</pre>
</li>
<li>
<pre>數字資料以表達數量與方向</pre>
</li>
<li>
<pre>由淺至深, 準確的表達方式</pre>
</li>
</ol>
</li>
<li>
<pre>決定文章性質</pre>
<ol>
<li>
<pre>計劃書</pre>
</li>
<li>
<pre>報告</pre>
</li>
<li>
<pre>研究報告</pre>
</li>
<li>
<pre>說明書</pre>
</li>
<li>
<pre>建議書</pre>
</li>
</ol>
</li>
<li>
<pre>選擇不同部份的表達方式</pre>
<ol>
<li>
<pre>說明名詞的含意 (classify terms)</pre>
</li>
<li>
<pre>結構性陳述 (Description of mechanism)</pre>
</li>
<li>
<pre>流程性陳述 (Description of Process)</pre>
</li>
<li>
<pre>圖表 (Visual)</pre>
</li>
</ol>
</li>
</ol>
<h2>本文以計劃書作為例子</h2>
<pre>一般的計劃書格式有時過於複雜,
&lt;&lt;Pocket Book of Technical Writing - for Engineers and Scientists 2nd&gt;&gt;
中建議了另一種計劃書格式 (Informal Proposals)</pre>
<h3>Informal Proposals</h3>
<pre>Introduction</pre>
<ul>
<li>
<pre>Purpose - Describe the reason for writing this proposal (文章目的)</pre>
</li>
<li>
<pre>Background - Describe the problem that needs to be solved (問題背境)</pre>
</li>
<li>
<pre>Scope - Review what this proposal will and will not cover (文章範圍)</pre>
</li>
</ul>
<pre>Discussion</pre>
<ul>
<li>
<pre>Approach - Describe the proposed solution to the problem (解決方案)</pre>
</li>
<li>
<pre>Result - Show how the solution will solve the problem(成效)</pre>
</li>
<li>
<pre>Statement of work - List the tasks that will be performed (步驟)</pre>
</li>
</ul>
<pre>Resources</pre>
<ul>
<li>
<pre>Personnel - List those who will be doing the work and their qualifications (人才)</pre>
</li>
<li>
<pre>Facilities/equipment - List the physical resources required to do the work (資源)</pre>
</li>
</ul>
<pre>Costs</pre>
<ul>
<li>
<pre>Fiscal - List the financial costs of implementing the proposed solution (成本)</pre>
</li>
<li>
<pre>Time - List the time required to implement the proposed solution (時間)</pre>
</li>
</ul>
<pre>Conclusion</pre>
<ul>
<li>
<pre>Summary - Highlight the benefits and risks of adopting the proposal (總結)</pre>
</li>
<li>
<pre>Contract - Provide a contact for more information (聯絡)</pre>
</li>
</ul>
<h2>以下是一些個人經驗</h2>
<h3>在落筆的時侯, 我們需要記住 &#8211; 文章是用來服侍讀者的 ! We are serving readers.</h3>
<pre>Introduction
在表達方式方面, 第一部份introduction 需要針對目標讀者, 使用較有吸引力的字句. 並在 scope 中說明這份計劃書只包括他們有興趣的話題.

Discussion
Approach 這部份是文章的中心, 建議在這裹運用一些技巧 (Description of mechanism / Process, part by part description). 而且需要加上圖表, 因為讀者都是懶惰的, 技術文章最大可能給讀者留意到的就是圖表.
在這裹可以用些圖片, 例如系統結構, 方便讀者明白.
到 statement of work 這部份時, 因為在顯示步驟, 請用 point form 表達.

Resource / Costs
在這些部份都是說明一些跟時間金錢有關的東西, 所以必要用圖表 / 計算表等東西來表達. 切記在金額上加上貸幣名 (HK$ / NT$)

Conclusion
這部份就是文章的概括, 有時一些比較忙的老闆可能就只看這一部份. 所以在這裹說話可以修飾得漂亮一點.
最後, 當然是在 contract 部份留下你的大名.

Visuals
多用圖表如 計算表 / 流程表 / 設計圖 / 結構圖 在什麼時候都有利 !</pre>
Posted in Proposal, startup business, Technical writing Tagged: engineer, engineers, howto, scientists, technical, Technical writing, tutorial, writing, 創業, 中小企 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/keithyau.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/keithyau.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/keithyau.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/keithyau.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/keithyau.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/keithyau.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/keithyau.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/keithyau.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/keithyau.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/keithyau.wordpress.com/158/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=158&subd=keithyau&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://keithyau.wordpress.com/2009/03/21/%e6%b7%ba%e8%ab%87%e8%a8%ad%e8%a8%88%e6%8a%80%e8%a1%93%e6%80%a7%e6%96%87%e7%ab%a0-%e2%80%93-technical-writing-for-engineers-and-scientists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e0c38730792fb4e3595a3fd00e0b141f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">keithyau</media:title>
		</media:content>
	</item>
		<item>
		<title>如何設定 ldap 登入服務 &#8211; OpenLDAP Linux authentication howto</title>
		<link>http://keithyau.wordpress.com/2009/03/13/%e5%a6%82%e4%bd%95%e8%a8%ad%e5%ae%9a-ldap-%e7%99%bb%e5%85%a5%e6%9c%8d%e5%8b%99-openldap-linux-authentication-howto/</link>
		<comments>http://keithyau.wordpress.com/2009/03/13/%e5%a6%82%e4%bd%95%e8%a8%ad%e5%ae%9a-ldap-%e7%99%bb%e5%85%a5%e6%9c%8d%e5%8b%99-openldap-linux-authentication-howto/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 10:11:44 +0000</pubDate>
		<dc:creator>keithyau</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[server management]]></category>
		<category><![CDATA[sme]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[Availability]]></category>
		<category><![CDATA[business IT solution]]></category>
		<category><![CDATA[cost reduction]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[openldap]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[service tutor security]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[可靠性]]></category>
		<category><![CDATA[中小企]]></category>

		<guid isPermaLink="false">http://keithyau.wordpress.com/?p=155</guid>
		<description><![CDATA[
OpenLDAP 登入服務器
上文提到如何安裝 OpenLDAP 服務器, 今次將會提到如何在 ubuntu上把 OpenLDAP 服務器設定成一個登入服務器. 這樣你就可以使用同一組資料登入多個不同的服務器.
先作服務器端設定
安裝轉換工具 migration tools 
sudo apt-get install migrationtools
更改 migration_common.ph 設定檔, 位置在 /usr/share/perl5
sudo vi /usr/share/perl5/migration_common.ph
根據服務器端的設計更改以下兩行
# Default DNS domain
$DEFAULT_MAIL_DOMAIN = &#8220;example.com&#8221;;
# Default base
$DEFAULT_BASE = &#8220;dc=example,dc=com&#8221;;
開始轉移登入資料 (把 /tmp 改成你的理想位置)
export ETC_SHADOW=/etc/shadow #把shadow 跟passwd 一同載入
./migrate_base.pl &#62; /tmp/base.ldif
./migrate_group.pl /etc/group /tmp/group.ldif
./migrate_hosts.pl /etc/hosts /tmp/hosts.ldif
./migrate_passwd.pl /etc/passwd /tmp/passwd.ldif
用以下命令分別載入到 ldap 服務器
ldapadd -D &#8220;cn=admin,dc=domain,dc=com&#8221; -W -f /tmp/base.ldif
ldapadd -D &#8220;cn=admin,dc=domain,dc=com&#8221; -W [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=155&subd=keithyau&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><!-- 	 	 --></p>
<h1>OpenLDAP 登入服務器</h1>
<p>上文提到如何安裝 OpenLDAP 服務器, 今次將會提到如何在 ubuntu上把 OpenLDAP 服務器設定成一個登入服務器. 這樣你就可以使用同一組資料登入多個不同的服務器.</p>
<h2>先作服務器端設定</h2>
<p><strong>安裝轉換工具 </strong><strong>migration tools </strong></p>
<p>sudo apt-get install migrationtools</p>
<p>更改 migration_common.ph 設定檔, 位置在 /usr/share/perl5</p>
<p>sudo vi /usr/share/perl5/migration_common.ph</p>
<p><strong>根據服務器端的設計更改以下兩行</strong></p>
<p># Default DNS domain</p>
<p>$DEFAULT_MAIL_DOMAIN = &#8220;example.com&#8221;;</p>
<p># Default base</p>
<p>$DEFAULT_BASE = &#8220;dc=example,dc=com&#8221;;</p>
<p><strong>開始轉移登入資料 </strong><strong>(</strong><strong>把 </strong><strong>/tmp </strong><strong>改成你的理想位置</strong><strong>)</strong></p>
<p>export ETC_SHADOW=/etc/shadow #把shadow 跟passwd 一同載入<br />
./migrate_base.pl &gt; /tmp/base.ldif<br />
./migrate_group.pl /etc/group /tmp/group.ldif<br />
./migrate_hosts.pl /etc/hosts /tmp/hosts.ldif<br />
./migrate_passwd.pl /etc/passwd /tmp/passwd.ldif</p>
<p><strong>用以下命令分別載入到 </strong><strong>ldap </strong><strong>服務器</strong></p>
<p>ldapadd -D &#8220;cn=admin,dc=domain,dc=com&#8221; -W -f /tmp/base.ldif</p>
<p>ldapadd -D &#8220;cn=admin,dc=domain,dc=com&#8221; -W -f /tmp/group.ldif</p>
<p>ldapadd -D &#8220;cn=admin,dc=domain,dc=com&#8221; -W -f /tmp/passwd.ldif</p>
<p>ldapadd -D &#8220;cn=admin,dc=domain,dc=com&#8221; -W -f /tmp/hosts.ldif</p>
<p><strong>以 </strong><strong>apt-get install </strong><strong>安裝認證需要的元件</strong></p>
<p>Modules require for authentication<br />
libnss-ldap &#8211; NSS module for using LDAP as a naming service<br />
libpam-ldap &#8211; Pluggable Authentication Module allowing LDAP interfaces<br />
libnss-ldapd &#8211; NSS module for using LDAP as a naming service<br />
perdition-ldap &#8211; Library to allow perdition to access LDAP based popmaps<br />
libpam-cracklib</p>
<p><strong>在 </strong><strong>pam library</strong><strong>做小許 </strong><strong>bug fix</strong></p>
<p>ln -s  pam_unix.so pam_pwdb.so</p>
<p>這樣, 服務器端的設定就完成了</p>
<h2>再做客戶端的設定</h2>
<p>Vi /etc/ldap.conf</p>
<p>host ldap.example.com</p>
<p>uri ldap://&lt;服務器ip位置&gt;:389/</p>
<p>base ou=People,dc=example,dc=com</p>
<p>nss_initgroups_ignoreusers backup,bin,daemon,dhcp,games,gnats,irc,klog,libuuid,list,lp,mail,man,munin,mysql,news,openldap,proxy,root,sshd,sync,sys,syslog,uucp,www-data</p>
<p>vi /etc/nsswitch.conf # 登入方法設定</p>
<p>passwd: ldap compat</p>
<p>shadow: ldap compat</p>
<p>group:  ldap compat</p>
<p>vi /etc/pam.d/common-account #設定 account 認證方法</p>
<p>account sufficient      pam_ldap.so</p>
<p>account required        pam_unix.so try_first_pass</p>
<p>vi /etc/pam.d/common-auth # 設定登入認證方法</p>
<p>auth    sufficient      pam_ldap.so</p>
<p>auth    requisite       pam_unix.so nullok_secure try_first_pass</p>
<p>auth    optional        pam_smbpass.so migrate missingok</p>
<p>vi /etc/pam.d/common-password #設定密碼管理</p>
<p>password sufficient     pam_ldap.so</p>
<p>password required       pam_unix.so nullok obscure min=4 max=8 md5 try_first_pass</p>
<p>password   optional   pam_smbpass.so nullok use_authtok use_first_pass missingok</p>
<h2>測試設定</h2>
<p>getent passwd | grep &lt;your user name&gt;</p>
<p>會發現參數出現兩次</p>
<p><strong>這樣客戶端就能使用中央使用者管理</strong></p>
Posted in Information Technology, server management, sme Tagged: Access, Availability, business IT solution, cost reduction, howto, ldap, login, openldap, server, service tutor security, tutorial, 可靠性, 中小企 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/keithyau.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/keithyau.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/keithyau.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/keithyau.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/keithyau.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/keithyau.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/keithyau.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/keithyau.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/keithyau.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/keithyau.wordpress.com/155/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=155&subd=keithyau&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://keithyau.wordpress.com/2009/03/13/%e5%a6%82%e4%bd%95%e8%a8%ad%e5%ae%9a-ldap-%e7%99%bb%e5%85%a5%e6%9c%8d%e5%8b%99-openldap-linux-authentication-howto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e0c38730792fb4e3595a3fd00e0b141f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">keithyau</media:title>
		</media:content>
	</item>
		<item>
		<title>如何建立 OpenLDAP server</title>
		<link>http://keithyau.wordpress.com/2009/03/06/%e5%a6%82%e4%bd%95%e5%bb%ba%e7%ab%8b-openldap-server/</link>
		<comments>http://keithyau.wordpress.com/2009/03/06/%e5%a6%82%e4%bd%95%e5%bb%ba%e7%ab%8b-openldap-server/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 08:58:19 +0000</pubDate>
		<dc:creator>keithyau</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Availability]]></category>
		<category><![CDATA[cost reduction]]></category>
		<category><![CDATA[監察系統]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[openldap]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[system management]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[可靠性]]></category>
		<category><![CDATA[中小企]]></category>

		<guid isPermaLink="false">http://keithyau.wordpress.com/?p=153</guid>
		<description><![CDATA[
如何建立 OpenLDAP server
LDAP 全名是 Lightweight Directory Access Protocol, 是一種目錄訪問協議, 在TCP/IP之上定義了一個相對簡單的升級和搜索目錄的協議。. 常見的用途有電話薄, 登入服務, 域名服務等. LDAP
今次所介紹的是 OpenLDAP 服務器的安裝方法
先安裝服務器所需軟件
sudo apt-get install slapd ldap-utils
重新設定 openldap 軟件
Dpkg-reconfigure slapd

omit openldap server 	configuration? no
dns domain name? example.com
organization name? yourCompany
database backend to use? bdb
do you want the database to be 	removed when slapd is purged? yes
may be the question: move old 	database? yes
administrator [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=153&subd=keithyau&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><!-- 	 	 --></p>
<h1>如何建立 OpenLDAP server</h1>
<p>LDAP 全名是 Lightweight Directory Access Protocol, 是一種目錄訪問協議, 在<span style="text-decoration:underline;"><a href="http://zh.wikipedia.org/w/index.php?title=TCP/IP&amp;variant=zh-tw">TCP/IP</a></span>之上定義了一個相對簡單的升級和搜索目錄的協議。. 常見的用途有電話薄, 登入服務, 域名服務等. <span style="text-decoration:underline;"><a href="http://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol">LDAP</a></span></p>
<p>今次所介紹的是 OpenLDAP 服務器的安裝方法</p>
<h2>先安裝服務器所需軟件</h2>
<p>sudo apt-get install slapd ldap-utils</p>
<h2>重新設定 openldap 軟件</h2>
<p>Dpkg-reconfigure slapd</p>
<ol>
<li>omit openldap server 	configuration? no</li>
<li>dns domain name? example.com</li>
<li>organization name? yourCompany</li>
<li>database backend to use? bdb</li>
<li>do you want the database to be 	removed when slapd is purged? yes</li>
<li>may be the question: move old 	database? yes</li>
<li>administrator password? &lt;your 	password&gt;</li>
<li>confirm password? &lt;your 	password&gt;</li>
<li>allow LDAPv2 protocol? no</li>
</ol>
<h2>如果需要手動修改 slapd.conf, 可到 /etc/ldap/slapd.conf</h2>
<p># This is the main slapd configuration file. See slapd.conf(5) for more</p>
<p># info on the configuration options.</p>
<p>#######################################################################</p>
<p># Global Directives:</p>
<p>#</p>
<p># Features to permit</p>
<p>allow bind_v2</p>
<p># Schema and objectClass definitions</p>
<p>include         /etc/ldap/schema/core.schema</p>
<p>include         /etc/ldap/schema/cosine.schema</p>
<p>include         /etc/ldap/schema/nis.schema</p>
<p>include         /etc/ldap/schema/inetorgperson.schema</p>
<p># Where the pid file is put. The init.d script</p>
<p># will not stop the server if you change this.</p>
<p>pidfile         /var/run/slapd/slapd.pid</p>
<p># List of arguments that were passed to the server</p>
<p>argsfile        /var/run/slapd/slapd.args</p>
<p># Read slapd.conf(5) for possible values</p>
<p>&#8220;/etc/ldap/slapd.conf&#8221; 139 lines, 4760 characters</p>
<p># This is the main slapd configuration file. See slapd.conf(5) for more</p>
<p># info on the configuration options.</p>
<p>#######################################################################</p>
<p># Global Directives:</p>
<p># Features to permit</p>
<p>allow bind_v2</p>
<p># Schema and objectClass definitions</p>
<p>include         /etc/ldap/schema/core.schema</p>
<p>include         /etc/ldap/schema/cosine.schema</p>
<p>include         /etc/ldap/schema/nis.schema</p>
<p>include         /etc/ldap/schema/inetorgperson.schema</p>
<p># Where the pid file is put. The init.d script</p>
<p># will not stop the server if you change this.</p>
<p>pidfile         /var/run/slapd/slapd.pid</p>
<p># List of arguments that were passed to the server</p>
<p>argsfile        /var/run/slapd/slapd.args</p>
<p># Read slapd.conf(5) for possible values</p>
<p>loglevel        none</p>
<p># Where the dynamically loaded modules are stored</p>
<p>modulepath      /usr/lib/ldap</p>
<p>moduleload      back_bdb</p>
<p># The maximum number of entries that is returned for a search operation</p>
<p>sizelimit 500</p>
<p># The tool-threads parameter sets the actual amount of cpu&#8217;s that is used</p>
<p># for indexing.</p>
<p>tool-threads 1</p>
<p>#######################################################################</p>
<p># Specific Backend Directives for bdb:</p>
<p># Backend specific directives apply to this backend until another</p>
<p># &#8216;backend&#8217; directive occurs</p>
<p>backend         bdb</p>
<p>#######################################################################</p>
<p># Specific Backend Directives for &#8216;other&#8217;:</p>
<p># Backend specific directives apply to this backend until another</p>
<p># &#8216;backend&#8217; directive occurs</p>
<p>#backend                &lt;other&gt;</p>
<p>#######################################################################</p>
<p># Specific Directives for database #1, of type bdb:</p>
<p># Database specific directives apply to this databasse until another</p>
<p># &#8216;database&#8217; directive occurs</p>
<p>database        bdb</p>
<p># The base of your directory in database #1</p>
<p>suffix          &#8220;dc=example,dc=com&#8221;</p>
<h2>修改 /etc/ldap/ldap.conf  (示範如下)</h2>
<p>#</p>
<p># LDAP Defaults</p>
<p>#</p>
<p># See ldap.conf(5) for details</p>
<p># This file should be world readable but not world writable.</p>
<p>BASE    dc=example,dc=com</p>
<p>URI     ldap://localhost:389</p>
<p>SIZELIMIT       12</p>
<p>TIMELIMIT       15</p>
<p>DEREF           never</p>
<h2>開始 slapd 服務器</h2>
<p>/etc/init.d/slapd restart</p>
<p>測試</p>
<p>netstat -lvt | grep ldap</p>
<p>tcp        0      0 *:ldap                  *:*                     LISTEN</p>
<p>tcp6       0      0 [::]:ldap               [::]:*                  LISTEN</p>
<p>其實 OpenLDAP 服務器的安裝方法並不複雜. 困難反而在於 client 客戶端的設定之上. 下篇文章, 將會介紹如何用 LDAP 設置 Linux 上的使用者登入系統.</p>
Posted in Uncategorized Tagged: Availability, cost reduction, 監察系統, ldap, login, openldap, server, system management, tutorial, 可靠性, 中小企 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/keithyau.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/keithyau.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/keithyau.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/keithyau.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/keithyau.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/keithyau.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/keithyau.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/keithyau.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/keithyau.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/keithyau.wordpress.com/153/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=153&subd=keithyau&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://keithyau.wordpress.com/2009/03/06/%e5%a6%82%e4%bd%95%e5%bb%ba%e7%ab%8b-openldap-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e0c38730792fb4e3595a3fd00e0b141f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">keithyau</media:title>
		</media:content>
	</item>
		<item>
		<title>如何解決MySQL 開動不到的問題 MySQL start fail</title>
		<link>http://keithyau.wordpress.com/2009/02/27/%e5%a6%82%e4%bd%95%e8%a7%a3%e6%b1%bamysql-%e9%96%8b%e5%8b%95%e4%b8%8d%e5%88%b0%e7%9a%84%e5%95%8f%e9%a1%8c-mysql-start-fail/</link>
		<comments>http://keithyau.wordpress.com/2009/02/27/%e5%a6%82%e4%bd%95%e8%a7%a3%e6%b1%bamysql-%e9%96%8b%e5%8b%95%e4%b8%8d%e5%88%b0%e7%9a%84%e5%95%8f%e9%a1%8c-mysql-start-fail/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 08:29:06 +0000</pubDate>
		<dc:creator>keithyau</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://keithyau.wordpress.com/?p=148</guid>
		<description><![CDATA[
昨天在服務器搬遷時遇到問題, 就是搬遷後, Mysql Start Fail &#8211; MySQL 資料庫不能開始. 找了很久都沒有答案, 檢查程序如下
以下的例子都是在 Ubuntu 下執行, 最後就是我的解決方法
檢查MySQL 的設定檔
Sudo vi /etc/mysql/my.cnf
[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock
[client]
port            = 3306
socket   [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=148&subd=keithyau&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><!-- 	 	 --></p>
<h1>昨天在服務器搬遷時遇到問題, 就是搬遷後, Mysql Start Fail &#8211; MySQL 資料庫不能開始. 找了很久都沒有答案, 檢查程序如下</h1>
<p>以下的例子都是在 Ubuntu 下執行, 最後就是我的解決方法</p>
<h2>檢查MySQL 的設定檔</h2>
<p>Sudo vi /etc/mysql/my.cnf</p>
<p>[client]</p>
<p>port            = 3306</p>
<p>socket          = /var/run/mysqld/mysqld.sock</p>
<p>[client]</p>
<p>port            = 3306</p>
<p>socket          = /var/run/mysqld/mysqld.sock</p>
<p># This was formally known as [safe_mysqld]. Both versions are currently parsed.</p>
<p>[mysqld_safe]</p>
<p>socket          = /var/run/mysqld/mysqld.sock</p>
<p>nice            = 0</p>
<p>[mysqld]</p>
<p>user            = mysql</p>
<p>pid-file        = /var/run/mysqld/mysqld.pid</p>
<p>socket          = /var/run/mysqld/mysqld.sock</p>
<p>port            = 3306</p>
<p>basedir         = /usr</p>
<p><span style="color:#ff0000;">datadir         = /var/lib/mysql # 確定 folder 是否存在</span></p>
<p>tmpdir          = /tmp</p>
<p>language        = /usr/share/mysql/english</p>
<p>skip-external-locking</p>
<p><span style="color:#ff0000;">bind-address            = 127.0.0.1# 如果這裡是其他 ip 地址, 有可能造成 MySQL start fail</span></p>
<p>key_buffer              = 16M</p>
<p>max_allowed_packet      = 16M</p>
<p>thread_stack            = 128K</p>
<p>thread_cache_size       = 8</p>
<p>query_cache_limit       = 1M</p>
<p>query_cache_size        = 16M</p>
<p>log_bin                 = /var/log/mysql/mysql-bin.log</p>
<p># WARNING: Using expire_logs_days without bin_log crashes the server! See README.Debian!</p>
<p>expire_logs_days        = 10</p>
<p>max_binlog_size         = 100M</p>
<p>skip-bdb</p>
<p>[mysqldump]</p>
<p>quick</p>
<p>quote-names</p>
<p>max_allowed_packet      = 16M</p>
<p>[mysql]</p>
<p>#no-auto-rehash # faster start of mysql but no tab completition</p>
<p>[isamchk]</p>
<p>key_buffer              = 16M</p>
<p>!includedir /etc/mysql/conf.d/</p>
<h2>檢查MySQL 資料夾的權限</h2>
<p>權限分別為</p>
<p>keithyau@Yubis-production:/var/lib$ sudo ls -l /var/lib/mysql</p>
<p>total 20612</p>
<p>-rw-r&#8211;r&#8211; 1 root  root         0 2008-03-16 22:01 debian-5.0.flag</p>
<p>drwx&#8212;&#8212; 2 mysql mysql    12288 2008-08-16 02:29 drupal</p>
<p>-rw-rw&#8212;- 1 mysql mysql 10485760 2009-02-26 21:00 ibdata1</p>
<p>-rw-rw&#8212;- 1 mysql mysql  5242880 2009-02-26 21:08 ib_logfile0</p>
<p>-rw-rw&#8212;- 1 mysql mysql  5242880 2008-03-16 22:01 ib_logfile1</p>
<p>d<span style="color:#ff0000;">rwxr-xr-x 2 mysql root      4096 2002-01-13 17:16 mysql</span></p>
<p>-rw&#8212;&#8212;- 1 root  root         6 2008-03-16 22:01 mysql_upgrade_info</p>
<p>keithyau@Yubis-production:/var/lib$ sudo ls -l /var/lib</p>
<p>total 176</p>
<p>drwxr-xr-x  4 root  root  4096 2008-03-14 20:39 apt</p>
<p>drwxr-xr-x  2 root  root  4096 2008-03-14 20:41 aptitude</p>
<p>drwxr-xr-x  2 root  root  4096 2002-01-26 19:48 dhcp3</p>
<p>drwxr-xr-x  4 root  root  4096 2008-03-14 20:52 dictionaries-common</p>
<p>drwxr-xr-x  2 root  root  4096 2006-10-24 03:27 discover</p>
<p>drwxr-xr-x  7 root  root  4096 2009-02-26 20:45 dpkg</p>
<p>drwxr-xr-x  3 root  root  4096 2008-03-14 20:53 gstreamer</p>
<p>drwxr-xr-x  2 root  root  4096 2008-03-14 20:39 initramfs-tools</p>
<p>drwxr-xr-x  2 root  root  4096 2007-01-31 06:27 initscripts</p>
<p>drwxr-xr-x  2 root  root  4096 2009-02-26 19:17 lib_mysql</p>
<p>drwxr-xr-x  2 root  root  4096 2008-03-14 22:32 logrotate</p>
<p>drwxr-xr-x  6 root  root  4096 2009-01-03 14:12 menu-xdg</p>
<p>drwxr-xr-x  2 root  root  4096 2006-10-28 22:06 misc</p>
<p><span style="color:#ff0000;">drwxr-xr-x 10 mysql mysql 4096 2009-02-26 21:08 mysql</span></p>
<p><span style="color:#ff0000;">drwxr-xr-x  2 root  root  4096 2008-01-27 19:46 mysql-cluster</span></p>
<h2>檢查後依然不能開始MySQL 服務器 &#8230;&#8230;</h2>
<p>打開 /var/log/syslog 看看有沒有以下一行</p>
<p>Feb 26 20:45:59 Yubis-production /etc/init.d/mysql[6254]: ^G/usr/bin/mysqladmin: connect to server at &#8216;localhost&#8217; failed</p>
<p>Feb 26 20:45:59 Yubis-production /etc/init.d/mysql[6254]: error: &#8216;Can&#8217;t connect to local MySQL server through socket &#8216;/var/run/mysqld/mysqld.sock&#8217; (2)&#8217;</p>
<p>Feb 26 20:45:59 Yubis-production /etc/init.d/mysql[6254]: Check that mysqld is running and that the socket: &#8216;/var/run/mysqld/mysqld.sock&#8217; exists!</p>
<p>Feb 26 20:45:59 Yubis-production /etc/init.d/mysql[6254]:</p>
<p>Feb 26 20:46:04 Yubis-production mysqld_safe[6319]: started</p>
<p>Feb 26 20:46:04 Yubis-production mysqld[6328]: 090226 20:46:04  InnoDB: Started; log sequence number 0 43665</p>
<p>Feb 26 20:46:04 Yubis-production mysqld[6328]: 090226 20:46:04 <span style="color:#ff0000;">[ERROR] Binlog has bad magic number;  It&#8217;s not a binary log file that can be used by this version of MySQL</span></p>
<h2>如果存在的話, 應該是你的 MySQL 服務器沒有正常關上, 那就 &#8230;</h2>
<p>打開 /var/log/mysql</p>
<p>keithyau@Yubis-production:/var/lib$ sudo ls -l /var/log/mysql/<br />
total 295696<br />
-rw-rw&#8212;- 1 mysql adm 104885450 2009-02-18 12:36 mysql-bin.000077<br />
-rw-rw&#8212;- 1 mysql adm 105175310 2009-02-24 11:27 mysql-bin.000078<br />
-rw-rw&#8212;- 1 mysql adm  83164522 2009-02-26 19:24 mysql-bin.000079<br />
-rw-rw&#8212;- 1 mysql adm        98 2009-02-26 19:56 mysql-bin.000080<br />
-rw-rw&#8212;- 1 mysql adm   9233377 2009-02-27 16:10 <span style="color:#ff0000;">mysql-bin.000081</span><br />
-rw-rw&#8212;- 1 mysql adm       160 2009-02-26 21:08 mysql-bin.index</p>
<p>把最後一個 bin 檔案刪除</p>
<p>sudo rm /var/log/mysql/<span style="color:#ff0000;">mysql-bin.00081</span></p>
<p>再打開 mysql-bin.index 把最後一行刪除</p>
<p>sudo vi /var/log/mysql/mysql-bin.index</p>
<p>/var/log/mysql/mysql-bin.000077</p>
<p>/var/log/mysql/mysql-bin.000078</p>
<p>/var/log/mysql/mysql-bin.000079</p>
<p>/var/log/mysql/mysql-bin.000080</p>
<p><span style="color:#ff0000;">/var/log/mysql/mysql-bin.000081</span></p>
<h2>重新打開 MySQL 資料庫就完成了</h2>
<p>Sudo /etc/init.d/mysql restart</p>
Posted in Uncategorized  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/keithyau.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/keithyau.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/keithyau.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/keithyau.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/keithyau.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/keithyau.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/keithyau.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/keithyau.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/keithyau.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/keithyau.wordpress.com/148/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=148&subd=keithyau&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://keithyau.wordpress.com/2009/02/27/%e5%a6%82%e4%bd%95%e8%a7%a3%e6%b1%bamysql-%e9%96%8b%e5%8b%95%e4%b8%8d%e5%88%b0%e7%9a%84%e5%95%8f%e9%a1%8c-mysql-start-fail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e0c38730792fb4e3595a3fd00e0b141f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">keithyau</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux OpenVpn Client 免費vpn linux 客戶端</title>
		<link>http://keithyau.wordpress.com/2009/02/19/138/</link>
		<comments>http://keithyau.wordpress.com/2009/02/19/138/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 07:11:31 +0000</pubDate>
		<dc:creator>keithyau</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[網絡]]></category>
		<category><![CDATA[IT risk]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[openvpn]]></category>
		<category><![CDATA[virtual networking]]></category>
		<category><![CDATA[vpn]]></category>
		<category><![CDATA[可靠性]]></category>
		<category><![CDATA[中小企]]></category>

		<guid isPermaLink="false">http://keithyau.wordpress.com/?p=138</guid>
		<description><![CDATA[
教學: Linux 下的 OpenVPN client
上回說到如何在 Windows 下安裝 OpenVPN client, 這回會介紹如何在 Linux 下使用 OpenVpn Client.有些時侯, 中小企需要使用一些自動化程序 Script 作安全連線. 在windows 下生成這樣的連線會比較難設定和不穩定. 這個時侯就需要 linux 的幫助. 在 Linux 下安裝openvpn 軟件就可以輕易創作自動連線的 Script

安裝 OpenVPN 軟件

在linux 下, OpenVPN 沒有server 和client 的分別, 都是用同一軟件進行. 所以只需要安裝 OpenVPN 便可

sudo apt-get install openvpn

創建鑰匙
首先,要創建鑰匙, 以下是在服務器端上鑰匙的制法 (把keithyau 換成你的使用者名字, 詳情參考 http://keithyau.wordpress.com/2009/02/07/vpn-solution-2-openvpn/)

sudo su
cd /etc/openvpn/examples/easy-rsa/2.0/
source ./vars
./clean-all
./build-ca
./build-key-server server
./build-key keithyau
./build-dh
cd keys
openssl dhparam -out dh1024.pem [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=138&subd=keithyau&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><!-- @page { size: 8.27in 11.69in; margin: 0.79in } P { margin-bottom: 0.08in } H1 { margin-bottom: 0.08in } H1.western { font-family: "Nimbus Sans L", sans-serif; font-size: 16pt } H1.cjk { font-family: "DejaVu Sans"; font-size: 16pt } H1.ctl { font-family: "DejaVu Sans"; font-size: 16pt } H2 { margin-bottom: 0.08in } H2.western { font-family: "Nimbus Sans L", sans-serif; font-size: 14pt; font-style: italic } H2.cjk { font-size: 14pt; font-style: italic } H2.ctl { font-size: 14pt; font-style: italic } --></p>
<h4 class="western">教學: Linux 下的 OpenVPN client</h4>
<h5 class="western"><span style="font-family:DejaVu Sans;"><span lang="zh-TW">上回說到如何在 </span></span>Windows <span style="font-family:DejaVu Sans;"><span lang="zh-TW">下安裝 </span></span>OpenVPN client, <span style="font-family:DejaVu Sans;"><span lang="zh-TW">這回會介紹如何在 </span></span>Linux <span style="font-family:DejaVu Sans;"><span lang="zh-TW">下使用 </span></span>OpenVpn Client.<span style="font-family:DejaVu Sans;"><span lang="zh-TW">有些時侯</span></span>, <span style="font-family:DejaVu Sans;"><span lang="zh-TW">中小企需要使用一些自動化程序 </span></span>Script <span style="font-family:DejaVu Sans;"><span lang="zh-TW">作安全連線</span></span>. <span style="font-family:DejaVu Sans;"><span lang="zh-TW">在</span></span>windows <span style="font-family:DejaVu Sans;"><span lang="zh-TW">下生成這樣的連線會比較難設定和不穩定</span></span>. <span style="font-family:DejaVu Sans;"><span lang="zh-TW">這個時侯就需要 </span></span>linux <span style="font-family:DejaVu Sans;"><span lang="zh-TW">的幫助</span></span>. <span style="font-family:DejaVu Sans;"><span lang="zh-TW">在 </span></span>Linux <span style="font-family:DejaVu Sans;"><span lang="zh-TW">下安裝</span></span>openvpn <span style="font-family:DejaVu Sans;"><span lang="zh-TW">軟件就可以輕易創作自動連線的 </span></span>Script</h5>
<p style="margin-bottom:0;">
<h2 class="western"><span style="font-family:DejaVu Sans;">安裝 </span>OpenVPN <span style="font-family:DejaVu Sans;">軟件</span></h2>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:DejaVu Sans;"><span lang="zh-TW">在</span></span>linux <span style="font-family:DejaVu Sans;"><span lang="zh-TW">下</span></span>, OpenVPN <span style="font-family:DejaVu Sans;"><span lang="zh-TW">沒有</span></span>server <span style="font-family:DejaVu Sans;"><span lang="zh-TW">和</span></span>client <span style="font-family:DejaVu Sans;"><span lang="zh-TW">的分別</span></span>, <span style="font-family:DejaVu Sans;"><span lang="zh-TW">都是用同一軟件進行</span></span>. <span style="font-family:DejaVu Sans;"><span lang="zh-TW">所以只需要安裝 </span></span>OpenVPN <span style="font-family:DejaVu Sans;"><span lang="zh-TW">便可</span></span></p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;">sudo apt-get install openvpn</p>
<p style="margin-bottom:0;">
<h2 class="western"><span style="font-family:DejaVu Sans;">創建鑰匙</span></h2>
<p style="margin-bottom:0;"><span style="font-family:DejaVu Sans;"><span lang="zh-TW">首先</span></span>,<span style="font-family:DejaVu Sans;"><span lang="zh-TW">要創建鑰匙</span></span>, <span style="font-family:DejaVu Sans;"><span lang="zh-TW">以下是在<span style="text-decoration:underline;">服務器端</span>上鑰匙的制法 </span></span>(<span style="font-family:DejaVu Sans;"><span lang="zh-TW">把</span></span>keithyau <span style="font-family:DejaVu Sans;"><span lang="zh-TW">換成你的使用者名字</span></span>, <span style="font-family:DejaVu Sans;"><span lang="zh-TW">詳情參考 </span></span><span style="font-size:xx-small;">http://keithyau.wordpress.com/2009/02/07/vpn-solution-2-openvpn/</span>)</p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;">sudo su<br />
cd /etc/openvpn/examples/easy-rsa/2.0/<br />
source ./vars<br />
./clean-all<br />
./build-ca</p>
<p>./build-key-server server<br />
./build-key keithyau</p>
<p>./build-dh<br />
cd keys<br />
openssl dhparam -out dh1024.pem 1024<br />
cd ..<br />
openvpn &#8211;genkey &#8211;secret ta.key #optional</p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;">
<h2 class="western"><span style="font-family:DejaVu Sans;">拷貝鑰匙</span></h2>
<p style="margin-bottom:0;"><span style="font-family:DejaVu Sans;"><span lang="zh-TW">鑰匙拷貝到客戶端內</span></span>, <span style="font-family:DejaVu Sans;"><span lang="zh-TW">例如 </span></span>&lt;/home/example/config/keys&gt;</p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:DejaVu Sans;"><span lang="zh-TW">在服務器端輸入</span></span></p>
<p style="margin-bottom:0;">scp -pr /etc/openvpn/examples/easy-rsa/2.0/keys/&lt;all your keys&gt;  &lt;client host&gt;:/home/exampel/config/keys</p>
<p style="margin-bottom:0;">
<h2 class="western"><span style="font-family:DejaVu Sans;">創建 </span>ovpn Client <span style="font-family:DejaVu Sans;">設定檔案 </span>(<span style="font-family:DejaVu Sans;">把</span>123.123.123 <span style="font-family:DejaVu Sans;">換成服務器的地址</span>)</h2>
<ol>
<li>
<p style="margin-bottom:0;">.opvn<span style="font-family:DejaVu Sans;"><span lang="zh-TW">示範檔案如下</span></span></p>
<ol>
<li>
<p style="margin-bottom:0;">client</p>
</li>
<li>
<p style="margin-bottom:0;">dev tap</p>
</li>
<li>
<p style="margin-bottom:0;">proto udp</p>
</li>
<li>
<p style="margin-bottom:0;">
</li>
<li>
<p style="margin-bottom:0;"># change this to your server&#8217;s 		address</p>
</li>
<li>
<p style="margin-bottom:0;">remote 123.123..123..123 1194</p>
</li>
<li>
<p style="margin-bottom:0;">resolv-retry infinite</p>
</li>
<li>
<p style="margin-bottom:0;">nobind</p>
</li>
<li>
<p style="margin-bottom:0;">persist-key</p>
</li>
<li>
<p style="margin-bottom:0;">persist-tun</p>
</li>
<li>
<p style="margin-bottom:0;">
</li>
<li>
<p style="margin-bottom:0;">#tls-client</p>
</li>
<li>
<p style="margin-bottom:0;">ca keys/ca.crt</p>
</li>
<li>
<p style="margin-bottom:0;">cert keys/keithyau.crt</p>
</li>
<li>
<p style="margin-bottom:0;">key keys/keithyau.key</p>
</li>
<li>
<p style="margin-bottom:0;">
</li>
<li>
<p style="margin-bottom:0;">#ensure that we are talking to a 		server</p>
</li>
<li>
<p style="margin-bottom:0;">ns-cert-type server</p>
</li>
<li>
<p style="margin-bottom:0;">
</li>
<li>
<p style="margin-bottom:0;">#confirm we are talking to the 		correct server</p>
</li>
<li>
<p style="margin-bottom:0;">#tls-auth ta.key 1</p>
</li>
<li>
<p style="margin-bottom:0;"># Select a cryptographic cipher.</p>
</li>
<li>
<p style="margin-bottom:0;"># If the cipher option is used on 		the server</p>
</li>
<li>
<p style="margin-bottom:0;"># then you must also specify it 		her  e.</p>
</li>
<li>
<p style="margin-bottom:0;">cipher AES-128-CBC</p>
</li>
<li>
<p style="margin-bottom:0;">
</li>
<li>
<p style="margin-bottom:0;"># Enable compression on the VPN 		link.</p>
</li>
<li>
<p style="margin-bottom:0;">comp-lzo</p>
</li>
<li>
<p style="margin-bottom:0;">
</li>
<li>
<p style="margin-bottom:0;">#fragment 1400</p>
</li>
<li>
<p style="margin-bottom:0;"># enable user/pass authentication</p>
</li>
<li>
<p style="margin-bottom:0;"># auth-user-pass</p>
</li>
</ol>
</li>
</ol>
<p style="margin-bottom:0;">
<h2 class="western"><span style="font-family:DejaVu Sans;">相應的服務器設定參考</span></h2>
<ol>
<p style="margin-bottom:0;"># Which local IP 	address should OpenVPN<br />
# listen on? (optional)<br />
local 	192.168.1.102 #<span style="font-family:DejaVu Sans;"><span lang="zh-TW">服務器的本地地址 </span></span>(LOCAL IP)<br />
port 1194</p>
<p>proto udp</p>
<p>dev 	tap0<br />
#direct these to your generated files<br />
ca 	/etc/openvpn/examples/easy-rsa/2.0/keys/ca.crt<br />
cert 	/etc/openvpn/examples/easy-rsa/2.0/keys/server.crt<br />
key 	/etc/openvpn/examples/easy-rsa/2.0/keys/server.key<br />
dh 	/etc/openvpn/examples/easy-rsa/2.0/keys/dh1024.pem<br />
ifconfig-pool-persist 	ipp.txt<br />
#<span style="font-family:DejaVu Sans;"><span lang="zh-TW">需要 </span></span>dhcp 	<span style="font-family:DejaVu Sans;"><span lang="zh-TW">服務器 的配合</span></span><br />
server 	10.3.0.0 255.255.255.0<br />
# <span style="font-family:DejaVu Sans;"><span lang="zh-TW">服務器上沒有 </span></span>dhcp <span style="font-family:DejaVu Sans;"><span lang="zh-TW">服務器的請選這行</span></span><br />
# 	server-bridge 192.168.1.102 255.255.255.0 192.168.1.230 	192.168.1.231</p>
<p>keepalive 10 120<br />
#encryption<br />
cipher 	AES-128-CBC<br />
#Push routing configuration<br />
#push &#8220;route 	192.168.2.0 255.255.255.0&#8243;</p>
<p>#tls-auth ta.key 	0</p>
<p>comp-lzo<br />
#fragment 1400<br />
#limit the number of 	connections<br />
max-clients 5<br />
#some secuurity settings<br />
# do not 	use if running server on Windows<br />
user nobody<br />
group 	nogroup<br />
persist-key<br />
persist-tun<br />
#log file settings<br />
status 	openvpn-status.log<br />
verb 3</ol>
<h3 style="margin-bottom:0;"><span style="font-family:DejaVu Sans;"><span lang="zh-TW"><span>詳程參考 </span></span><a href="../2009/01/23/%E5%A6%82%E4%BD%95%E8%A8%AD%E7%AB%8B%E8%99%9B%E6%93%AC%E7%B6%B2%E7%B5%A1-how-to-setup-vpn/">如何設立虛擬網絡</a></span></h3>
<p style="margin-bottom:0;">
<h2 class="western"><span style="font-family:DejaVu Sans;">打開 </span>VPN <span style="font-family:DejaVu Sans;">連線</span></h2>
<p>sudo openvpn &lt;<span style="font-family:DejaVu Sans;">你的設定檔案</span>&gt;.ovpn</p>
<p><span style="font-family:DejaVu Sans;">完成後</span>, Client <span style="font-family:DejaVu Sans;">會有以下情況</span></p>
<p><img class="alignnone size-medium wp-image-137" title="openvpn-linux-client" src="http://keithyau.files.wordpress.com/2009/02/openvpn-linux-client.jpg?w=300&#038;h=198" alt="openvpn-linux-client" width="300" height="198" /></p>
<p><span style="font-family:DejaVu Sans;">輸入 </span>ifconfig <span style="font-family:DejaVu Sans;">會看到新的虛擬網卡</span></p>
<p><img class="alignnone size-medium wp-image-139" title="opevpn-vpn-client-tap0" src="http://keithyau.files.wordpress.com/2009/02/opevpn-vpn-client-tap0.jpg?w=300&#038;h=198" alt="opevpn-vpn-client-tap0" width="300" height="198" /></p>
<p><span style="font-family:DejaVu Sans;">服務器那邊都會出現成功訊息</span></p>
<p><img class="alignnone size-medium wp-image-140" title="openvpn-linux-server" src="http://keithyau.files.wordpress.com/2009/02/openvpn-linux-server.jpg?w=300&#038;h=198" alt="openvpn-linux-server" width="300" height="198" /></p>
<p><img src="///home/keithyau/Desktop/Blog/how%2520to%2520build%2520a%2520VPN%2520solution/Image/linux%2520client/openvpn%2520linux%2520server.jpg" alt="" /></p>
<h2 class="western"><span style="font-family:DejaVu Sans;">自動化程序示範</span></h2>
<p>#! /bin/bash</p>
<p>check=`ls /var/log/remote`</p>
<p>if [ -z check ] ;# no log file</p>
<p>then</p>
<p>exit 0</p>
<p>else # <span style="font-family:DejaVu Sans;">打開 </span>openvpn <span style="font-family:DejaVu Sans;">連線</span>,<span style="font-family:DejaVu Sans;">開始 </span>backup</p>
<p>sudo openvpn &lt;<span style="font-family:DejaVu Sans;">你的設定檔案</span>&gt;.ovpn</p>
<p>sudo backup.sh</p>
<p>fi</p>
<p>exit 0</p>
<p>如有任何問題, 歡迎與我連絡/ 留言, 大家交流一下</p>
Posted in Information Technology, security Tagged: Access, 網絡, IT risk, linux, openvpn, virtual networking, vpn, 可靠性, 中小企 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/keithyau.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/keithyau.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/keithyau.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/keithyau.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/keithyau.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/keithyau.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/keithyau.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/keithyau.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/keithyau.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/keithyau.wordpress.com/138/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=138&subd=keithyau&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://keithyau.wordpress.com/2009/02/19/138/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e0c38730792fb4e3595a3fd00e0b141f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">keithyau</media:title>
		</media:content>

		<media:content url="http://keithyau.files.wordpress.com/2009/02/openvpn-linux-client.jpg?w=300" medium="image">
			<media:title type="html">openvpn-linux-client</media:title>
		</media:content>

		<media:content url="http://keithyau.files.wordpress.com/2009/02/opevpn-vpn-client-tap0.jpg?w=300" medium="image">
			<media:title type="html">opevpn-vpn-client-tap0</media:title>
		</media:content>

		<media:content url="http://keithyau.files.wordpress.com/2009/02/openvpn-linux-server.jpg?w=300" medium="image">
			<media:title type="html">openvpn-linux-server</media:title>
		</media:content>

		<media:content url="///home/keithyau/Desktop/Blog/how%2520to%2520build%2520a%2520VPN%2520solution/Image/linux%2520client/openvpn%2520linux%2520server.jpg" medium="image" />
	</item>
		<item>
		<title>vpn solution2 &#8211; windows openvpn client 免費的vpn 客戶端</title>
		<link>http://keithyau.wordpress.com/2009/02/12/vpn-solution2-windows-openvpn-client-%e5%85%8d%e8%b2%bb%e7%9a%84vpn-%e5%ae%a2%e6%88%b6%e7%ab%af/</link>
		<comments>http://keithyau.wordpress.com/2009/02/12/vpn-solution2-windows-openvpn-client-%e5%85%8d%e8%b2%bb%e7%9a%84vpn-%e5%ae%a2%e6%88%b6%e7%ab%af/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 09:44:28 +0000</pubDate>
		<dc:creator>keithyau</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[4A]]></category>
		<category><![CDATA[business IT solution]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[IT risk]]></category>
		<category><![CDATA[openvpn]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[virtual networking]]></category>
		<category><![CDATA[vpn]]></category>
		<category><![CDATA[xen howto]]></category>
		<category><![CDATA[創業]]></category>
		<category><![CDATA[中小企]]></category>

		<guid isPermaLink="false">http://keithyau.wordpress.com/?p=134</guid>
		<description><![CDATA[&#60;!&#8211; 		@page { size: 8.5in 11in; margin: 0.79in } 		P { margin-bottom: 0.08in } 	&#8211;&#62;
上文提及過 openvpn server的制作方法, 這篇文章會介紹服務器端與客戶端配合的一個例子.

在客戶端方面, 用家大部份都會用 Windows + openvpn. 在 Windows 下安裝 openvpn 十分簡單, 只需要以下步驟



到這裡下載 openvpn 圖形介面客戶端 
http://openvpn.se/files/install_packages/openvpn-2.0.9-gui-1.0.3-install.exe

雙click 	 install.exe 安裝


到 C:\Program Files\OpenVPN\config 創建 / 編輯 ovpn 檔案 (yourservername.ovpn)


.opvn示範檔案如下


client


dev tap


proto udp





# change this to your server&#8217;s 		address


remote 123.123..123..123 1194


resolv-retry infinite


nobind


persist-key


persist-tun





#tls-client


ca keys/ca.crt


cert keys/keithyau.crt


key [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=134&subd=keithyau&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&lt;!&#8211; 		@page { size: 8.5in 11in; margin: 0.79in } 		P { margin-bottom: 0.08in } 	&#8211;&gt;</p>
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">上文提及過 </span></span>openvpn server<span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">的制作方法</span></span>, <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">這篇文章會介紹服務器端與客戶端配合的一個例子</span></span>.</p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">在客戶端方面</span></span>, <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">用家大部份都會用 </span></span>Windows + openvpn. <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">在 </span></span>Windows <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">下安裝 </span></span>openvpn <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">十分簡單</span></span>, <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">只需要以下步驟</span></span></p>
<p style="margin-bottom:0;">
<ol>
<li>
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">到這裡下載 </span></span>openvpn <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">圖形介面客戶端 </span></span><br />
<a href="http://openvpn.se/files/install_packages/openvpn-2.0.9-gui-1.0.3-install.exe">http://openvpn.se/files/install_packages/openvpn-2.0.9-gui-1.0.3-install.exe</a></li>
<li>
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">雙</span></span>click 	 install.exe <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">安裝</span></span></p>
</li>
<li>
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">到 </span></span>C:\Program Files\OpenVPN\config <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">創建 </span></span>/ <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">編輯 </span></span>ovpn <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">檔案 </span></span>(yourservername.ovpn)</p>
</li>
<li>
<p style="margin-bottom:0;">.opvn<span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">示範檔案如下</span></span></p>
<ol>
<li>
<p style="margin-bottom:0;">client</p>
</li>
<li>
<p style="margin-bottom:0;">dev tap</p>
</li>
<li>
<p style="margin-bottom:0;">proto udp</p>
</li>
<li>
<p style="margin-bottom:0;">
</li>
<li>
<p style="margin-bottom:0;"># change this to your server&#8217;s 		address</p>
</li>
<li>
<p style="margin-bottom:0;">remote 123.123..123..123 1194</p>
</li>
<li>
<p style="margin-bottom:0;">resolv-retry infinite</p>
</li>
<li>
<p style="margin-bottom:0;">nobind</p>
</li>
<li>
<p style="margin-bottom:0;">persist-key</p>
</li>
<li>
<p style="margin-bottom:0;">persist-tun</p>
</li>
<li>
<p style="margin-bottom:0;">
</li>
<li>
<p style="margin-bottom:0;">#tls-client</p>
</li>
<li>
<p style="margin-bottom:0;">ca keys/ca.crt</p>
</li>
<li>
<p style="margin-bottom:0;">cert keys/keithyau.crt</p>
</li>
<li>
<p style="margin-bottom:0;">key keys/keithyau.key</p>
</li>
<li>
<p style="margin-bottom:0;">
</li>
<li>
<p style="margin-bottom:0;">#ensure that we are talking to a 		server</p>
</li>
<li>
<p style="margin-bottom:0;">ns-cert-type server</p>
</li>
<li>
<p style="margin-bottom:0;">
</li>
<li>
<p style="margin-bottom:0;">#confirm we are talking to the 		correct server</p>
</li>
<li>
<p style="margin-bottom:0;">#tls-auth ta.key 1</p>
</li>
<li>
<p style="margin-bottom:0;"># Select a cryptographic cipher.</p>
</li>
<li>
<p style="margin-bottom:0;"># If the cipher option is used on 		the server</p>
</li>
<li>
<p style="margin-bottom:0;"># then you must also specify it 		her  e.</p>
</li>
<li>
<p style="margin-bottom:0;">cipher AES-128-CBC</p>
</li>
<li>
<p style="margin-bottom:0;">
</li>
<li>
<p style="margin-bottom:0;"># Enable compression on the VPN 		link.</p>
</li>
<li>
<p style="margin-bottom:0;">comp-lzo</p>
</li>
<li>
<p style="margin-bottom:0;">
</li>
<li>
<p style="margin-bottom:0;">#fragment 1400</p>
</li>
<li>
<p style="margin-bottom:0;"># enable user/pass authentication</p>
</li>
<li>
<p style="margin-bottom:0;"># auth-user-pass</p>
</li>
<li>
<p style="margin-bottom:0;">
</li>
</ol>
</li>
<li>
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">把鑰匙拷貝到 </span></span>C:\Program Files\OpenVPN\config\keys , <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">以下是在服務器端上鑰匙的制法 </span></span>(<span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">把</span></span>keithyau 	<span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">換成你的使用者名字</span></span>, 	<span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">詳情參考 </span></span><span style="font-size:xx-small;">http://keithyau.wordpress.com/2009/02/07/vpn-solution-2-openvpn/</span>)</p>
<ol>
<li>
<p style="margin-bottom:0;">sudo su<br />
cd 		/etc/openvpn/examples/easy-rsa/2.0/<br />
source 		./vars<br />
./clean-all<br />
./build-ca</p>
<p>./build-key-server 		server<br />
./build-key keithyau</p>
<p>./build-dh<br />
cd keys<br />
openssl 		dhparam -out dh1024.pem 1024<br />
cd ..<br />
openvpn &#8211;genkey &#8211;secret 		ta.key #optional</li>
</ol>
</li>
<li>
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">在右下角 </span></span>openvpn icon<span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">按連接</span></span></p>
<p><img class="alignnone size-medium wp-image-133" title="openvpnclient1" src="http://keithyau.files.wordpress.com/2009/02/openvpnclient1.jpg?w=300&#038;h=240" alt="openvpnclient1" width="300" height="240" /></li>
<li>
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">測試連線</span></span></p>
</li>
</ol>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>令服務器能接受以上設定的請求</strong></span></span><strong>, </strong><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>相應需要以下的設定</strong></span></span></p>
<p style="margin-bottom:0;">
<ol>
<p style="margin-bottom:0;"># Which local IP 	address should OpenVPN<br />
# listen on? (optional)<br />
local 	192.168.1.102<br />
port 1194</p>
<p>proto udp</p>
<p>dev tap0<br />
#direct 	these to your generated files<br />
ca 	/etc/openvpn/examples/easy-rsa/2.0/keys/ca.crt<br />
cert 	/etc/openvpn/examples/easy-rsa/2.0/keys/server.crt<br />
key 	/etc/openvpn/examples/easy-rsa/2.0/keys/server.key<br />
dh 	/etc/openvpn/examples/easy-rsa/2.0/keys/dh1024.pem<br />
ifconfig-pool-persist 	ipp.txt<br />
#<span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">需要 </span></span>dhcp <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">服務器 	的配合</span></span><br />
server 10.3.0.0 255.255.255.0<br />
# <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">服務器上沒有 </span></span>dhcp <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">服務器的請選這行</span></span><br />
# 	server-bridge 192.168.1.102 255.255.255.0 192.168.1.230 	192.168.1.231</p>
<p>keepalive 10 120<br />
#encryption<br />
cipher 	AES-128-CBC<br />
#Push routing configuration<br />
#push &#8220;route 	192.168.2.0 255.255.255.0&#8243;</p>
<p>#tls-auth ta.key 	0</p>
<p>comp-lzo<br />
#fragment 1400<br />
#limit the number of 	connections<br />
max-clients 5<br />
#some secuurity settings<br />
# do not 	use if running server on Windows<br />
user nobody<br />
group 	nogroup<br />
persist-key<br />
persist-tun<br />
#log file settings<br />
status 	openvpn-status.log<br />
verb 3<br />
# authentication plugin<br />
#forces 	client to have a linux acount in order to connect (Not for Windows 	user)<br />
# plugin /usr/lib/openvpn/openvpn-auth-pam.so login</ol>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>這裡有安裝 </strong></span></span><strong>DHCP server </strong><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>的方法</strong></span></span></p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;">sudo apt-get install dhcp3-server</p>
<p style="margin-bottom:0;">sudo vi /etc/default/dhcp3-server</p>
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">更改 為 </span></span>INTERFACES=&#8221;br0&#8243;  # br0 = <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">你的網卡名稱</span></span></p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;">sudo vi /etc/dhcp3/dhcpd.conf</p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">把其中一個示範修改為 </span></span>(10.3.0.0 <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">是你打算指派的網絡</span></span>)</p>
<p style="margin-bottom:0;">subnet 10.3.0.0 netmask 255.255.255.0 {</p>
<p style="margin-bottom:0;">range 10.3.0.100 10.3.0.200;</p>
<p style="margin-bottom:0;">option routers 192.168.1.1;</p>
<p style="margin-bottom:0;">}</p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;">/etc/init.d/dhcpd restart</p>
<p style="margin-bottom:0;">/etc/init.d/openvpn restart</p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">這樣你的 </span></span>Openvpn <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">就能成功在 </span></span>linux <span style="font-family:Times New Roman,serif;">→</span> windows <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">間建立起來了</span></span></p>
Posted in Information Technology, security Tagged: 4A, business IT solution, howto, IT risk, openvpn, tutorial, virtual networking, vpn, xen howto, 創業, 中小企 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/keithyau.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/keithyau.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/keithyau.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/keithyau.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/keithyau.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/keithyau.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/keithyau.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/keithyau.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/keithyau.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/keithyau.wordpress.com/134/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=134&subd=keithyau&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://keithyau.wordpress.com/2009/02/12/vpn-solution2-windows-openvpn-client-%e5%85%8d%e8%b2%bb%e7%9a%84vpn-%e5%ae%a2%e6%88%b6%e7%ab%af/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e0c38730792fb4e3595a3fd00e0b141f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">keithyau</media:title>
		</media:content>

		<media:content url="http://keithyau.files.wordpress.com/2009/02/openvpnclient1.jpg?w=300" medium="image">
			<media:title type="html">openvpnclient1</media:title>
		</media:content>
	</item>
		<item>
		<title>VPN solution 2 &#8211; openvpn</title>
		<link>http://keithyau.wordpress.com/2009/02/07/vpn-solution-2-openvpn/</link>
		<comments>http://keithyau.wordpress.com/2009/02/07/vpn-solution-2-openvpn/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 05:13:55 +0000</pubDate>
		<dc:creator>keithyau</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[business IT solution]]></category>
		<category><![CDATA[IT risk]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[vpn]]></category>
		<category><![CDATA[中小企]]></category>

		<guid isPermaLink="false">http://keithyau.wordpress.com/?p=114</guid>
		<description><![CDATA[
之前提到中小企安裝 vpn 的問題, 這篇文章將會講解如何安裝一種 SSL VPN – OpenVPN

OpenVPN 是一種在 SSL 上建立的 OpenVPN, 在網絡工程學上說, 是最高層級的 ( OSI MODEL) 所以擁有極強的防火趥穿透力, 在大部份地方都可以建立 VPN 連線. 最重要的是它多平台支援 -   Solaris, Linux, OpenBSD, FreeBSD, NetBSD, Mac OS X, and Windows 2000/XP/Vista , 而且是免費的.

以下介紹它的設置方法

網絡示意圖 (切記把 192.168.1.1 / 192.168.1.102 換成閣下的設置)




先安裝 UBUNTU LINUX
這裡有它的安裝方法 http://yubis.net/blog/yubis/ubuntu-ubuntu-install-method-367

在 Ubuntu 上輸入以安裝所需軟件
sudo apt-get install openvpn bridge-utils


把所需要的 OPENSSL 軟件拷貝
cp -R [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=114&subd=keithyau&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">之前提到中小企安裝 </span></span>vpn <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">的問題</span></span>, <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">這篇文章將會講解如何安裝一種 </span></span>SSL VPN – OpenVPN</p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;">OpenVPN <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">是一種在 </span></span>SSL <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">上建立的 </span></span>OpenVPN, <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">在網絡工程學上說</span></span>, <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">是最高層級的 </span></span>( OSI MODEL) <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">所以擁有極強的防火趥穿透力</span></span>, <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">在大部份地方都可以建立 </span></span>VPN <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">連線</span></span>. <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">最重要的是它多平台支援 </span></span>-   <a href="http://en.wikipedia.org/wiki/Solaris_%28operating_system%29">Solaris</a>, <a href="http://en.wikipedia.org/wiki/Linux">Linux</a>, <a href="http://en.wikipedia.org/wiki/OpenBSD">OpenBSD</a>, <a href="http://en.wikipedia.org/wiki/FreeBSD">FreeBSD</a>, <a href="http://en.wikipedia.org/wiki/NetBSD">NetBSD</a>, <a href="http://en.wikipedia.org/wiki/Mac_OS_X">Mac OS X</a>, and <a href="http://en.wikipedia.org/wiki/Windows_2000">Windows 2000</a>/<a href="http://en.wikipedia.org/wiki/Windows_XP">XP</a>/<a href="http://en.wikipedia.org/wiki/Windows_Vista">Vista</a> , <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">而且是免費的</span></span>.</p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>以下介紹它的設置方法</strong></span></span></p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>網絡示意圖 </strong></span></span><strong><span style="color:#ff0000;">(</span></strong><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong><span style="color:#ff0000;">切記把 </span></strong></span></span><strong><span style="color:#ff0000;">192.168.1.1 / 192.168.1.102 </span></strong><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong><span style="color:#ff0000;">換成閣下的設置</span></strong></span></span><strong><span style="color:#ff0000;">)</span></strong></p>
<p style="margin-bottom:0;"><img class="alignnone size-medium wp-image-124" title="openvpn_-1" src="http://keithyau.files.wordpress.com/2009/02/openvpn_-1.jpg?w=410&#038;h=251" alt="openvpn_-1" width="410" height="251" /></p>
<p style="margin-bottom:0;"><strong><span style="color:#ff0000;"><br />
</span></strong></p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>先安裝 </strong></span></span><strong>UBUNTU LINUX</strong></p>
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">這裡有它的安裝方法 </span></span><a href="http://yubis.net/blog/yubis/ubuntu-ubuntu-install-method-367">http://yubis.net/blog/yubis/ubuntu-ubuntu-install-method-367</a></p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>在 </strong></span></span><strong>Ubuntu </strong><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>上輸入以安裝所需軟件</strong></span></span></p>
<p style="margin-bottom:0;"><span style="font-family:Courier New,monospace;"><span style="text-decoration:underline;"><code>sudo apt-get install openvpn bridge-utils</code></span></span></p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>把所需要的 </strong></span></span><strong>OPENSSL </strong><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>軟件拷貝</strong></span></span></p>
<pre><span style="text-decoration:underline;"><code>cp -R /usr/share/doc/openvpn/examples/ /etc/openvpn/</code></span></pre>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>修改 </strong></span></span><strong>SSL </strong><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>加密設定</strong></span></span></p>
<pre><span style="text-decoration:underline;"><code>cd /etc/openvpn/examples/easy-rsa/2.0</code></span>
<span style="text-decoration:underline;">vi vars</span></pre>
<p style="margin-bottom:0;text-decoration:none;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">檔案</span></span>vars <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">裹的都是一些制作 </span></span>ssl <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">鑰匙時用作認證的資料</span></span>, <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">特別留心的是 </span></span></p>
<p style="margin-bottom:0;text-decoration:none;">
<pre style="text-decoration:none;"><code>export KEY_SIZE=2048</code></pre>
<p style="margin-bottom:0;text-decoration:none;">
<p style="margin-bottom:0;text-decoration:none;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">單位愈大</span></span>, <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">加密時間愈長</span></span>, <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">而駭客需要的破解時間都會增加</span></span></p>
<p style="margin-bottom:0;text-decoration:none;">
<p style="margin-bottom:0;text-decoration:none;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>現在轉作 </strong></span></span><strong>root </strong><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>身份</strong></span></span></p>
<p style="margin-bottom:0;text-decoration:none;">
<p style="margin-bottom:0;"><span style="text-decoration:underline;"><code>sudo su</code></span></p>
<p style="margin-bottom:0;text-decoration:none;">
<p style="margin-bottom:0;text-decoration:none;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>輸入以下指令</strong></span></span><strong>, </strong><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>以制作鑰匙</strong></span></span></p>
<p style="margin-bottom:0;text-decoration:none;">
<pre><span style="text-decoration:underline;"><code>./vars</code></span>
<span style="text-decoration:underline;"><code>./clean-all</code></span>
<span style="text-decoration:underline;"><code>./build-ca</code></span> <span style="font-size:xx-small;">#</span><span style="font-size:xx-small;"><span lang="zh-TW">系統會詢問之前在 </span></span><span style="font-size:xx-small;">vars </span><span style="font-size:xx-small;"><span lang="zh-TW">設下的問題並提供在 </span></span><span style="font-size:xx-small;">vars </span><span style="font-size:xx-small;"><span lang="zh-TW">中的答案</span></span><span style="font-size:xx-small;">, </span><span style="font-size:xx-small;"><span lang="zh-TW">按下 </span></span><span style="font-size:xx-small;">ENTER </span><span style="font-size:xx-small;"><span lang="zh-TW">便可</span></span>
<span style="font-size:small;"><span lang="zh-TW"><strong>制作服務器端的鑰匙</strong></span></span>
<span style="text-decoration:underline;"><code>./build-key-server server</code></span>
<span style="font-size:small;"><span lang="zh-TW"><strong>制作使用者和密碼</strong></span></span>

<span style="text-decoration:underline;">#<span lang="zh-TW">制作密碼 </span>(username = <span lang="zh-TW">你自己的使用者名稱</span>)</span>
<span style="text-decoration:underline;"><code>./build-key-pass username</code></span>
<span style="text-decoration:underline;">#<span lang="zh-TW">不使用密碼 </span>(username = <span lang="zh-TW">你自己的使用者名稱</span>)</span>
<span style="text-decoration:underline;"><code>./build-key username</code> </span>
<span style="font-size:small;"><strong><span lang="zh-TW">建立 </span></strong></span><span style="font-size:small;"><strong>Diffie Hellman key</strong></span>
<span style="text-decoration:underline;"><code>./build-dh</code> </span>
#<span lang="zh-TW">建立服務器</span> id key
<span style="text-decoration:underline;"><code>openvpn --genkey --secret ta.key</code></span></pre>
<p style="margin-bottom:0;text-decoration:none;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>建立 </strong></span></span><strong>/etc/openvpn/server.conf </strong><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>用作 </strong></span></span><strong>openvpn </strong><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong>服務器的設定</strong></span></span></p>
<p><code># OpenVPN 服務器地址<br />
local 192.168.1.102<br />
port 1194<br />
# TCP or UDP 服務器<br />
proto udp<br />
#所使用的網橋名稱<br />
dev tap0<br />
#之前制作出來的鑰匙位置<br />
ca /etc/openvpn/examples/easy-rsa/2.0/keys/ca.crt<br />
cert /etc/openvpn/examples/easy-rsa/2.0/keys/server.crt<br />
key /etc/openvpn/examples/easy-rsa/2.0/keys/server.key<br />
dh /etc/openvpn/examples/easy-rsa/2.0/keys/dh1024.pem<br />
ifconfig-pool-persist ipp.txt<br />
#服務器網橋的設定 (切記最後那兩個地址是沒被任何機器 / dhcp使用)<br />
server-bridge 192.168.1.102 255.255.255.0 192.168.1.200 192.168.1.201<br />
#needed to allow communication to internal network<br />
client-to-client<br />
keepalive 10 120<br />
#所選擇的認證方法<br />
#更快的選擇有 blowfish: "BF-CB"<br />
cipher AES-128-CBC<br />
#在這裡提供其他內網的地址 (如果亦想使用 openvpn)<br />
push "route 192.168.2.0 255.255.255.0"<br />
#服務器 id 的鑰匙<br />
tls-auth ta.key 0<br />
#compression for network speed<br />
comp-lzo<br />
# if packets are too large fragment them (only really useful if you have an old router)<br />
#fragment 1400<br />
#最大連接數目<br />
max-clients 5<br />
# do not use if running server on Windows<br />
user nobody<br />
group nogroup<br />
persist-key<br />
persist-tun<br />
#log file settings<br />
status openvpn-status.log<br />
verb 3<br />
# authentication plugin<br />
#forces client to have a linux account in order to connect<br />
plugin /usr/lib/openvpn/openvpn-auth-pam.so login<br />
</code></p>
<p style="margin-bottom:0;text-decoration:none;">
<p style="margin-bottom:0;text-decoration:none;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><strong><span style="text-decoration:none;"><span lang="zh-TW">制作 </span></span></strong></span><strong>/etc/init.d/bridge <span style="text-decoration:none;"> </span></strong><span style="font-family:Lucida Sans Unicode;"><strong><span style="text-decoration:none;"><span lang="zh-TW">用作開機時自動打開網橋服務</span></span></strong></span></p>
<p style="margin-bottom:0;">
<p><code><br />
#!/bin/bash<br />
# Create global variables<br />
# 網橋的名稱 (自訂)<br />
br="br0"<br />
# 虛擬網卡的名稱 (自訂, 但需跟 /etc/openvpn/server.conf 相應)<br />
# for example tap="tap0 tap1 tap2".<br />
tap="tap0"<br />
# Define physical ethernet interface to be bridged<br />
# with TAP interface(s) above.<br />
eth="eth0"<br />
eth_ip="192.168.1.102"<br />
eth_netmask="255.255.255.0"<br />
eth_broadcast="192.168.1.255"<br />
gw="192.168.1.1"<br />
start_bridge () {<br />
#################################<br />
# Set up Ethernet bridge on Linux<br />
# Requires: bridge-utils<br />
#################################<br />
for t in $tap; do<br />
openvpn --mktun --dev $t<br />
done<br />
for t in $tap; do<br />
ifconfig $t 0.0.0.0 promisc up<br />
done<br />
ifconfig $eth 0.0.0.0 promisc up<br />
brctl addbr $br<br />
brctl addif $br $eth<br />
for t in $tap; do<br />
brctl addif $br $t<br />
done<br />
ifconfig $br $eth_ip netmask $eth_netmask broadcast $eth_broadcast up<br />
route add default gw $gw $br<br />
}<br />
stop_bridge () {<br />
####################################<br />
# Tear Down Ethernet bridge on Linux<br />
####################################<br />
ifconfig $br down<br />
brctl delbr $br<br />
for t in $tap; do<br />
openvpn --rmtun --dev $t<br />
done<br />
ifconfig $eth $eth_ip netmask $eth_netmask broadcast $eth_broadcast up<br />
route add default gw $gw $eth<br />
}<br />
case "$1" in<br />
start)<br />
echo -n "Starting Bridge"<br />
start_bridge<br />
;;<br />
stop)<br />
echo -n "Stopping Bridge"<br />
stop_bridge<br />
;;<br />
restart)<br />
stop_bridge<br />
sleep 2<br />
start_bridge<br />
;;<br />
*)<br />
echo "Usage: $0 {start|stop|restart}" &gt;&amp;2<br />
exit 1<br />
;;<br />
esac </code></p>
<p style="margin-bottom:0;">&lt;!&#8211; 		@page { size: 8.5in 11in; margin: 0.79in } 		P { margin-bottom: 0.08in } 	&#8211;&gt;</p>
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong><span style="text-decoration:none;">設定權限</span></strong></span></span></p>
<p style="margin-bottom:0;"><span style="text-decoration:underline;">chmod 755 /etc/init.d/bridge</span></p>
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong><span style="text-decoration:none;">設定開機時自動打開網橋</span></strong></span></span></p>
<p style="margin-bottom:0;">
<pre><span style="text-decoration:underline;"><span><code>update-rc.d bridge defaults 15</code></span></span></pre>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong><span style="text-decoration:none;">打開 </span></strong></span></span><strong><span style="text-decoration:none;">openvpn </span></strong><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><strong><span style="text-decoration:none;">服務</span></strong></span></span></p>
<p style="margin-bottom:0;">
<pre><span style="text-decoration:underline;"><code>sudo /etc/init.d/bridge start</code></span>
<span style="text-decoration:underline;"><code>sudo openvpn /etc/openvpn/server.conf</code></span></pre>
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><span style="text-decoration:none;">這樣</span></span></span><span style="text-decoration:none;">, openvpn <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">的服務器設定就完成了</span></span></span></p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><span style="text-decoration:none;">如果覺得還是太煩的話</span></span></span><span style="text-decoration:none;">, <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">可以參考 </span></span></span><span style="text-decoration:none;"><a href="http://pfsense.org/">http://pfsense.org</a> pfsense <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">是一種基於 </span></span></span><span style="text-decoration:none;">freebsd <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">的系統</span></span></span><span style="text-decoration:none;">, <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">有預載 </span></span></span><span style="text-decoration:none;">openvpn</span></p>
<p style="margin-bottom:0;">
<p style="margin-bottom:0;"><span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW"><span style="text-decoration:none;">下一文章</span></span></span><span style="text-decoration:none;">, <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">將會講解如何設定 </span></span></span><span style="text-decoration:none;">openvpn <span style="font-family:Lucida Sans Unicode;"><span lang="zh-TW">的客戶端</span></span></span></p>
Posted in Information Technology, security Tagged: Access, business IT solution, IT risk, security, server, vpn, 中小企 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/keithyau.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/keithyau.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/keithyau.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/keithyau.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/keithyau.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/keithyau.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/keithyau.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/keithyau.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/keithyau.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/keithyau.wordpress.com/114/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=keithyau.wordpress.com&blog=5494800&post=114&subd=keithyau&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://keithyau.wordpress.com/2009/02/07/vpn-solution-2-openvpn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/e0c38730792fb4e3595a3fd00e0b141f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">keithyau</media:title>
		</media:content>

		<media:content url="http://keithyau.files.wordpress.com/2009/02/openvpn_-1.jpg?w=300" medium="image">
			<media:title type="html">openvpn_-1</media:title>
		</media:content>
	</item>
	</channel>
</rss>