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

<channel>
	<title>Linux爱好者社区 - NIXway.net</title>
	<atom:link href="http://www.nixway.net/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://www.nixway.net/blog</link>
	<description>Linux 技术资源</description>
	<lastBuildDate>Thu, 07 Apr 2011 00:09:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>SSL还是TLS &#8211; Dovecot</title>
		<link>http://www.nixway.net/blog/archives/514</link>
		<comments>http://www.nixway.net/blog/archives/514#comments</comments>
		<pubDate>Thu, 07 Apr 2011 00:06:08 +0000</pubDate>
		<dc:creator>Jane Wang</dc:creator>
				<category><![CDATA[Qmail]]></category>
		<category><![CDATA[SSL TLS Dovecot]]></category>

		<guid isPermaLink="false">http://www.nixway.net/blog/archives/514</guid>
		<description><![CDATA[原文链接: http://wiki1.dovecot.org/SSL - A Certificate Authority is a trusted third-party<a href="http://www.nixway.net/blog/archives/514">&#160;&#160; ...<b>阅读全文</b>...</a>]]></description>
			<content:encoded><![CDATA[<p>原文链接: <a href="http://wiki1.dovecot.org/SSL">http://wiki1.dovecot.org/SSL</a></p>
<p class="line862">- A Certificate Authority is a trusted third-party organization that issues digital certificates such as <a href="http://www.clickssl.com/" class="http">SSL Certificates</a> after verifying the information included in the Certificates. <span id="line-4" class="anchor"/><span id="line-5" class="anchor"/></p>
<p class="line874">SSL and TLS terms are often used in confusing ways: <span id="line-6" class="anchor"/><span id="line-7" class="anchor"/></p>
<ul>
<li>SSL (Secure Sockets Layer) is the original protocol implementation. SSLv3 is still allowed by Dovecot, but it&#8217;s rarely used. Some clients use SSL to mean that they&#8217;re going to connect to the imaps (993), pop3s (995) or smtps (465) port, although they&#8217;re still going to use TLSv1 protocol. <span id="line-8" class="anchor"/></li>
<li>TLS (Transport Layer Security) replaced the SSL protocol. TLSv1 protocol is used practically always nowadays. Some clients use TLS to mean that they&#8217;re going to use STARTTLS command after connecting to the standard imap (143), pop3 (110) or smtp port (25/587). Nothing would prevent using SSLv3 protocol after STARTTLS command. <span id="line-9" class="anchor"/><span id="line-10" class="anchor"/></li>
</ul>
<p class="line874">Using two separate ports for plaintext and SSL connections was thought to be wasteful, so STARTTLS intended to deprecate the SSL ports (imaps, pop3s, smtps, etc). This never really happened, probably because of two reasons: <span id="line-11" class="anchor"/></p>
<ul>
<li>Some admins don&#8217;t even know about STARTTLS. <span id="line-12" class="anchor"/></li>
<li>
<p class="line862">Some admins want to require SSL/TLS, but don&#8217;t realize that this is also possible with STARTTLS (Dovecot has <tt>disable_plaintext_auth=yes</tt> and <tt>ssl=required</tt> settings). <span id="line-13" class="anchor"/></p>
</li>
<li>Some admins understand everything, but still prefer to allow only SSL ports. This could be because it makes it easier to ensure that no information is leaked, because SSL/TLS handshake happens immediately. Some clients unfortunately try to do plaintext authentication without STARTTLS, even when IMAP server has told the client that it won&#8217;t work. <span id="line-14" class="anchor"/><span id="line-15" class="anchor"/></li>
</ul>
<p class="line874">Unfortunately there doesn&#8217;t seem to be any clear and simple way to refer to these different meanings. <span id="line-16" class="anchor"/><span id="line-17" class="anchor"/></p>
<p class="line874">SSL term is much more widely understood than TLS, so Dovecot configuration and this documentation only talks about SSL when in fact it means both SSL/TLS. <span id="line-18" class="anchor"/><span id="line-19" class="anchor"/></p>
<ul>
<li>
<p class="line891"><a href="http://wiki1.dovecot.org/SSL/CertificateCreation">Creating SSL certificates</a> <span id="line-20" class="anchor"/></p>
</li>
<li>
<p class="line891"><a href="http://wiki1.dovecot.org/SSL/DovecotConfiguration">Configuring Dovecot to use SSL certificates</a> <span id="line-21" class="anchor"/></p>
</li>
<li>
<p class="line891"><a href="http://wiki1.dovecot.org/SSL/CertificateClientImporting">Importing CAs and self-signed SSL certificates to clients</a> <span id="line-22" class="anchor"/></p>
</li>
<li>
<p class="line862">SSL works pretty much the same universally, so for more information about SSL you can see for example <a href="http://httpd.apache.org/docs/2.2/ssl/" class="http">Apache&#8217;s documentation</a>. <span id="line-23" class="anchor"/></p>
</li>
<li>Dovecot uses OpenSSL, so whatever information you find about it applies also to Dovecot. <span id="line-24" class="anchor"/></li>
</ul>
<p><span id="bottom" class="anchor"/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nixway.net/blog/archives/514/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VMWARE ESXi &#8211; SNMP vs CIM</title>
		<link>http://www.nixway.net/blog/archives/510</link>
		<comments>http://www.nixway.net/blog/archives/510#comments</comments>
		<pubDate>Sun, 26 Dec 2010 03:13:45 +0000</pubDate>
		<dc:creator>Jane Wang</dc:creator>
				<category><![CDATA[Linux系统管理]]></category>
		<category><![CDATA[VMWARE ESXi SNMP vs CIM]]></category>

		<guid isPermaLink="false">http://www.nixway.net/blog/archives/510</guid>
		<description><![CDATA[摘自: http://forums.dartware.com/viewtopic.php?p=2981&#38;sid=88b4080d6135345ab29dd8a9529d2767 VMWARE ESXi 有很多改进，但是也有一些致命的缺陷。最近因为客户项目要部署上百台Dell R610服务器，但是却发现无法实现硬件级别的监控，确实很致命，如下搜索自网络，也有不少人碰到了同样的问题。 Stewart Wrote: Folks, Before<a href="http://www.nixway.net/blog/archives/510">&#160;&#160; ...<b>阅读全文</b>...</a>]]></description>
			<content:encoded><![CDATA[<p>摘自: <a href="http://forums.dartware.com/viewtopic.php?p=2981&amp;sid=88b4080d6135345ab29dd8a9529d2767">http://forums.dartware.com/viewtopic.php?p=2981&amp;sid=88b4080d6135345ab29dd8a9529d2767</a></p>
<p>VMWARE ESXi 有很多改进，但是也有一些致命的缺陷。最近因为客户项目要部署上百台Dell R610服务器，但是却发现无法实现硬件级别的监控，确实很致命，如下搜索自网络，也有不少人碰到了同样的问题。</p>
<p><span class="postbody"><span>Stewart Wrote:</span></span></p>
<p><span class="postbody"><span>Folks, <br/><br/>Before getting in too deep with this I thought I&#8217;d ask the list to see <br/>if others are experiencing a similar issue or have similar concerns. <br/><br/>Intermapper provides us with a single place to look to check that &#8220;our <br/>world&#8221; is OK. &#8220;Our world&#8221; consists of network components, servers &amp; <br/>where possible, services. Polled maps with status denoted by colours are <br/>a good thing. Alerts via Emails, snmp traps may get lost/be <br/>undeliverable (&amp; we do use them) &#8211; but a polled map tells the viewer <br/>&#8220;how it is&#8221;. If the view of &#8220;our world&#8221; is less than optimal &#8211; then this <br/>prompts our staff to use the best diagnostic tool &#8211; to look at the <br/>problem in detail (often a proprietary tool). <br/><br/>Our VMWARE estate is included in this. Host VMWARE servers are polled &amp; <br/>information retrieved via SNMP eg Interface information, host resources <br/>information, server status (RAID, FANS, Temp, Power Supplies, etc etc). <br/><br/>Our server team are moving from VMWARE ESX 4 to VMWARE ESXi 4.1 (as <br/>VMWARE themselves are moving) &amp; it would appear that in ESXi, VMWARE are <br/>favouring CIM/WBEM rather than SNMP; as a result the information <br/>available via SNMP is now much less. Although we get interface stats &#8211; <br/>we have lost Host Resources &amp; server status info (RAID etc). We use HP <br/>servers &#8211; but the problem of retrieving info from management agents via <br/>SNMP is also true for DELL, I believe. <br/><br/>So, for example, in the event of a RAID/Power supply problem that has <br/>the potential to threaten a live service &#8211; we are now reliant on far <br/>fewer sets of eyes (ie just the primary vmware admins running their <br/>proprietary tool) <br/><br/>Is anyone else wrestling with this loss of visibility of critical <br/>systems information ? <br/><br/>Regards <br/><br/><br/>Stewart <br/>&#8211; <br/><br/></span></span> <span class="postbody">Reply by: <span class="name"><strong><span>jfroot</span></strong></span></span></p>
<p><span class="postbody"><span class="name"><span class="postbody"><span>Hi Stewart, we have a very similar concern/issue to you. <br/><br/>We use numerous Dell R610 servers in our environment. When they have Linux installed on them as the OS, it is quite easy to use Intermapper to monitor the system health by installing the Dell OMSA agent and using SNMP coupled with the Dell Server Probe. All hardware faults including Power Supplies, Disks, fans etc. wil trigger an alarm on the probe. <br/><br/>Recently we have started to roll-out an ESXi environment on Dell r610s. And here&#8217;s where we run into trouble. ESXi has no SNMP agent for hardware health that we can monitor. And, the Guest OS&#8217;s have no visibility into the hardware state. We are left with few options though. However none of them seem to work for us perfectly yet. <br/><br/>1) Use Vmware VCenter server to monitor ESXi hosts and send out SNMP traps to intermapper. This will only work if you are using VCenter server though. Additionally, the traps sent out are not well documented so a complex trap handler will likely have to be written. <br/><br/>2) Use the Dell iDRAC BMC(lom) to monitor hardware health via IPMI. This is what we are currently doing using the in-built IPMI probe. For us though it seems quite peoblematic: <br/><br/>a) It has periodic trouble authenticating that randomly occurs, which makes the box appear as down for a time. <br/>b) It does not alarm on power supply failures; it shows 0 Volts but no alarm is triggered. I cannot test other hardware failures easily so am dubious on its detection abilities. <br/>c) CPU temperatures are reported as -41 degrees. I assume this is just a sign error in the code. <br/>d) The Dell BMC runs on a different IP than the ESXi host. As you cannot group devices of different IP addresses I have to have 2 boxes that infact represnt one host. 1 Box for the BMC and 1 Box for the ESXi OS. <br/><br/>3) Use the Dell BMC to send out traps to Intermapper for hardware events. After loading in a cacophony of MIBS and their dependencies from Dell the traps received are still not useful. The Dell MIB (DcAsfSrv.mib) uses the DESCRIPTION field for teh ASCII representation of what the trap is. Intermapper does not handle the DESCRIPTION field and merely reports SpecificTrap number.. which is useless unless you want to have a large table you would then look that up against. Someone could probably write a custom trap handler that would use the SpecificTrap number to set some ASCII. <br/><br/>These are all the options I&#8217;ve come up with so far. If you or anyone else has any ideas that may be better, please let me know. I still and not comfortable that we are monitoring system health in a reliable manner. <br/><br/>&#8211; <br/>J</span> <br/><br/></span></span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nixway.net/blog/archives/510/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>重置Sun 串口状态</title>
		<link>http://www.nixway.net/blog/archives/509</link>
		<comments>http://www.nixway.net/blog/archives/509#comments</comments>
		<pubDate>Thu, 23 Dec 2010 04:52:11 +0000</pubDate>
		<dc:creator>Jane Wang</dc:creator>
				<category><![CDATA[Linux系统管理]]></category>
		<category><![CDATA[Reset Sun serial port status]]></category>

		<guid isPermaLink="false">http://www.nixway.net/blog/archives/509</guid>
		<description><![CDATA[用户在Sun M4000机器上安装了多个zone, 有一次需要在主机上更改网络设置, 发现console连不上了，并且最初也没有安装过网络管理口，所以无法连接到serial console. 通过搜索发现是因为装系统的时候在flash里的 TTY flag位不正确了，参考链接： http://docs.sun.com/source/820-2853-11/RelNotes.html ，<a href="http://www.nixway.net/blog/archives/509">&#160;&#160; ...<b>阅读全文</b>...</a>]]></description>
			<content:encoded><![CDATA[<p>用户在Sun M4000机器上安装了多个zone, 有一次需要在主机上更改网络设置, 发现console连不上了，并且最初也没有安装过网络管理口，所以无法连接到serial console.</p>
<p>通过搜索发现是因为装系统的时候在flash里的 TTY flag位不正确了，参考链接： <a href="http://docs.sun.com/source/820-2853-11/RelNotes.html">http://docs.sun.com/source/820-2853-11/RelNotes.html</a> ，</p>
<p class="TableText">If you create a Solaris Flash archive on a non-Sun SPARC Enterprise M4000/M5000 sun4u server and install it on a Sun SPARC Enterprise M4000/M5000 sun4u server, the console&#8217;s TTY flags will not be set correctly. This can cause the console to lose characters during stress.</p>
<p>然后通过如下命令重置后就好了。</p>
<p class="TableText">Just after installing Solaris OS from a Solaris Flash archive, telnet into the Sun SPARC Enterprise M4000/M5000 server to reset the console&#8217;s TTY flags as follows:</p>
<p class="TableText">
<pre>
   # sttydefs -r console
   # sttydefs -a console -i "9600 hupcl opost onlcr crtscts" -f "9600"
</pre>
<p class="TableText">
<p class="TableText">This procedure is required only once.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nixway.net/blog/archives/509/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DRBD &#8211; Linux下实现文件系统的镜像</title>
		<link>http://www.nixway.net/blog/archives/507</link>
		<comments>http://www.nixway.net/blog/archives/507#comments</comments>
		<pubDate>Mon, 20 Dec 2010 01:01:35 +0000</pubDate>
		<dc:creator>Jane Wang</dc:creator>
				<category><![CDATA[Linux系统管理]]></category>
		<category><![CDATA[Distributed Replicated Block Device Linux 文件系统镜像]]></category>

		<guid isPermaLink="false">http://www.nixway.net/blog/archives/507</guid>
		<description><![CDATA[DRBD &#8211; Distributed Replicated Block Device, 是包含在Linux内核中的实现Linux环境下块设备镜像的工具， 来自: http://www.drbd.org/docs/about/ 来自:<a href="http://www.nixway.net/blog/archives/507">&#160;&#160; ...<b>阅读全文</b>...</a>]]></description>
			<content:encoded><![CDATA[<p>DRBD &#8211; Distributed Replicated Block Device, 是包含在Linux内核中的实现Linux环境下块设备镜像的工具，</p>
<p>来自: <a href="http://www.drbd.org/docs/about/">http://www.drbd.org/docs/about/</a></p>
<p>来自: <a href="http://www.linbit.com/en/products-services/">http://www.linbit.com/en/products-services/</a></p>
<p>The Distributed Replicated Block Device (DRBD) is a software-based, shared-nothing, replicated storage solution mirroring the content of block devices (hard disks, partitions, logical volumes etc.) between servers.</p>
<p>DRBD mirrors data</p>
<div class="itemizedlist">
<ul type="disc" class="itemizedlist">
<li class="listitem">
<p title="In real time"><strong>In real time.</strong> Replication occurs continuously, while applications modify the data on the device.</p>
</li>
<li class="listitem">
<p title="Transparently"><strong>Transparently.</strong> The applications that store their data on the mirrored device are oblivious of the fact that the data is in fact stored on several computers.</p>
</li>
<li class="listitem">
<p title="Synchronously or asynchronously"><strong>Synchronously or asynchronously.</strong> With synchronous mirroring, a writing application is notified of write completion only after the write has been carried out on both computer systems. Asynchronous mirroring means the writing application is notified of write completion when the write has completed locally, but before the write has propagated to the peer system.</p>
</li>
</ul></div>
<div class="section" title="Kernel module">
<div class="titlepage">
<div>
<div>
<h2 style="CLEAR: both" class="title">Kernel module</h2>
</p></div>
</p></div>
</p></div>
<p>DRBD&#8217;s core functionality is implemented by way of a Linux kernel module. Specifically, DRBD constitutes a driver for a virtual block device, so DRBD is situated <span class="quote">&#8220;<span class="quote">right near the bottom</span>&#8220;</span> of a system&#8217;s I/O stack. Because of this, DRBD is extremely flexible and versatile, which makes it a replication solution suitable for adding high availability to just about any application.</p>
<div style="MARGIN-LEFT: 0.5in; MARGIN-RIGHT: 0.5in" class="important" title="Important">
<table border="0" summary="Important">
<tbody>
<tr>
<td width="25" align="middle" rowspan="2" valign="top"/>
<th align="left">Important</th>
</tr>
<tr>
<td align="left" valign="top">
<p>DRBD is, by definition and as mandated by the Linux kernel architecture, agnostic of the layers above it. Thus, it is impossible for DRBD to miraculously add features to upper layers that these do not possess. For example, DRBD cannot auto-detect file system corruption or add active-active clustering capability to file systems like ext3 or XFS.</p>
</td>
</tr>
</tbody>
</table></div>
</p></div>
<div class="section" title="User space administration tools">
<div class="titlepage">
<div>
<div>
<h2 style="CLEAR: both" class="title">User space administration tools</h2>
</p></div>
</p></div>
</p></div>
<p>DRBD comes with a handful of administration tools capable of communicating with the kernel module, in order to be able to configure and administer DRBD resources.</p>
<div class="itemizedlist">
<ul type="disc" class="itemizedlist">
<li class="listitem">
<p title="drbdadm"><strong>drbdadm.</strong> The high-level administration tool of the DRBD program suite. It obtains all DRBD configuration parameters from the configuration file <code class="filename">/etc/drbd.conf</code>. <span class="command"><strong>drbdadm</strong></span> acts as a front-end application for both <span class="command"><strong>drbdsetup</strong></span> and <span class="command"><strong>drbdmeta</strong></span> and hands off instructions to either of the two for actual command execution. <span class="command"><strong>drbdadm</strong></span> has a <span class="emphasis"><em>dry-run</em></span> mode, invoked with the <code class="option">-d</code> option, which exposes the commands issued by the back-end programs.</p>
</li>
<li class="listitem">
<p title="drbdsetup"><strong>drbdsetup.</strong> The program that allows users to configure the DRBD module that has been loaded into the running kernel. It is the low-level tool within the DRBD program suite. When using this program, all configuration parameters have to be directly handed over on the command line. This allows for maximum flexibility, albeit at the price of reduced ease of use. Most users will use <span class="command"><strong>drbdsetup</strong></span> very rarely.</p>
</li>
<li class="listitem">
<p title="drbdmeta"><strong>drbdmeta.</strong> The program which allows users to create, dump, restore, and modify DRBD&#8217;s meta data structures. This, too, is a command that most users will use only very rarely.</p>
</li>
</ul></div>
<p class="listitem" title="drbdmeta">
<p class="listitem" title="drbdmeta">
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.nixway.net/blog/archives/507/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>转载: Things You Need To Know If You Use DFS Replication</title>
		<link>http://www.nixway.net/blog/archives/503</link>
		<comments>http://www.nixway.net/blog/archives/503#comments</comments>
		<pubDate>Mon, 20 Dec 2010 00:17:32 +0000</pubDate>
		<dc:creator>Jane Wang</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[DFS Replication]]></category>

		<guid isPermaLink="false">http://www.nixway.net/blog/archives/503</guid>
		<description><![CDATA[DFS 提供高效方便的分布式文件系统，但是不正当的使用会造成麻烦，甚至灾难，如下文章为系统管理者在使用DFS需要注意的地方 转载来自: http://www.kendalvandyke.com/2009/07/things-you-need-to-know-if-you-use-dfs.html 作者: Kendal Van Dyke In addition<a href="http://www.nixway.net/blog/archives/503">&#160;&#160; ...<b>阅读全文</b>...</a>]]></description>
			<content:encoded><![CDATA[<div class="post-body entry-content">
<p>DFS 提供高效方便的分布式文件系统，但是不正当的使用会造成麻烦，甚至灾难，如下文章为系统管理者在使用DFS需要注意的地方</p>
<p>转载来自: <a href="http://www.kendalvandyke.com/2009/07/things-you-need-to-know-if-you-use-dfs.html">http://www.kendalvandyke.com/2009/07/things-you-need-to-know-if-you-use-dfs.html</a></p>
<p>作者: Kendal Van Dyke</p>
<p><em>In addition to being a SQL DBA I&#8217;m also a network administrator, or at least I pretend to be. This is a bit off-topic from my usual SQL Server fare, but I figured my pain is your gain. Today, July 31, is <a href="http://www.sysadminday.com/" target="_blank"><span style="COLOR: #336699">System Administrator Appreciation Day</span></a> . If you use DFS Replication in your company, give your sysadmin a gift by forwarding this on to him\her.</em></p>
<p><strong>Background &#8211; What Is DFS Anyways?</strong> <br/>DFS, or <a href="http://en.wikipedia.org/wiki/DFS_(Microsoft)" target="_blank"><span style="COLOR: #336699">Distributed File System</span></a> , is a feature built into Windows Server that allows you to organize multiple SMB shares into a single DFS share. Accessing the DFS share automatically redirects (under the covers) to one of the SMB shares that are part of the group. It&#8217;s a neat bit of technology that provides location transparency and redundancy simultaneously. Another part of DFS is the ability to replicate changes made to a file (or files) in one of the SMB shares to all of the other SMB shares in the group. Prior to Windows Server 2003 R2 this feature was called <a href="http://en.wikipedia.org/wiki/DFS_replication" target="_blank"><span style="COLOR: #336699">File Replication Service</span></a> and, while it worked, it was less than efficient because any change to a file resulted in the entire file being copied (imagine making a 1 line change to a 100 MB file). Beginning with Server 2003 R2 it was renamed to <a href="http://technet.microsoft.com/en-us/library/cc778621(WS.10).aspx" target="_blank"><span style="COLOR: #336699">DFS Replication</span></a> . Along with it came some nice improvements which included scheduling, bandwidth throttling, and most importantly <a href="http://en.wikipedia.org/wiki/Remote_Differential_Compression" target="_blank"><span style="COLOR: #336699">Remote Differential Compression</span></a> which detects and replicates only the part of the file which changed and not the entire file.</p>
<p>DFS (and DFS replication) is really nifty when it works. My company uses it to keep content synchronized on servers across multiple datacenters. However, there are a few caveats that you need to be aware of. I&#8217;ll call them lessons learned, and unfortunately I had to learn them the hard way. I&#8217;m going to share them with you in the hopes that you won&#8217;t have to go through the same pain that I did.</p>
<p><strong>Lesson #1 &#8211; Be <span style="TEXT-DECORATION: underline">Very</span> Careful When Removing And Re-Adding Members To A DFS Replication Group</strong> <br/>Let&#8217;s pretend you&#8217;ve got DFS Replication set up and you want to add a server (referred to as a member) into your group. You start with a blank target directory on the member and a short while after adding it to the group it gets populated with the files &amp; folders from the other members in the group. At some point in the future you need to remove that member temporarily and then re-add it. Thinking you need to start with a blank target directory like the first time you wipe the directory clean and then add the member back to the group. A short time later you start to see the opposite of what you expect &#8211; instead of the member receiving the files &amp; folders from the other members they start <em>disappearing</em> from every member in the group. What the heck happened?!?</p>
<p>It turns out that when you delete a member from a DFS replication group information about the member isn&#8217;t actually deleted from the DFS replication database. Instead, the member is marked with a 30-day tombstone flag. If the member is added back into the DFS replication group the flag is deleted and the original objects for the member are reused. Any changes made to the recently re-added member are then replicated to the other members. So deleting those files from the member before re-adding it? They get picked up and replicated to the other members.</p>
<p>This &#8220;feature&#8221; and 3 workarounds are documented in <a href="http://support.microsoft.com/kb/961655" target="_blank"><span style="COLOR: #336699">Microsoft KB article 961655</span></a> . Do yourself a favor and read it.</p>
<p><strong>Lesson #2 &#8211; Back Up Your DFS Shares</strong> <br/>Lesson #1 leads to lesson #2, which should a no brainer &#8211; Back up your DFS shares. DFS Replication will replicate <strong><span style="TEXT-DECORATION: underline">all</span></strong> changes to files, including deletes. Would you like to explain to management how you just lost all your files permanently because someone mistakenly deleted all of them and you weren&#8217;t taking backups? I wouldn&#8217;t.</p>
<p><strong>Lesson #3 &#8211; Recover Deleted Files In A Pinch</strong> <br/>Suppose you didn&#8217;t learn from lesson #2, files got deleted by mistake, and you don&#8217;t have backups. All hope is not lost. It turns out that DFS Replication keeps a hidden, private folder which contains a copy of the deleted files. It&#8217;s limited in size so it&#8217;s not foolproof but it just might save you in a pinch.</p>
<p><a href="http://blogs.technet.com/filecab/pages/ned-pyle-s-bio.aspx" target="_blank"><span style="COLOR: #336699">Ned Pyle</span></a> , a Technical Lead for the Directory Services team at Microsoft, <a href="http://blogs.technet.com/filecab/archive/2008/01/02/a-script-to-restore-data-from-the-dfsr-conflictanddeleted-or-preexisting-folders-for-disaster-recovery-purposes.aspx" target="_blank"><span style="COLOR: #336699">posted a handy VB Script</span></a> that you can use to restore data if you&#8217;re in disaster recovery mode. I&#8217;ve used it and it saved my butt. By the way, remember lesson #2 about backing up your DFS shares? (hint, hint)</p>
<p><strong>Lesson #4 &#8211; Files With The Temporary Attribute Won&#8217;t Replicate</strong> <br/>Filters can be applied to exclude files from replicating based on their extension (e.g. .BAK), but what about when a non-excluded file just won&#8217;t seem to replicate? It might have the temporary attribute set. DFS Replication won&#8217;t pick up changes to those files. You wouldn&#8217;t know that unless you found the single line mentioning it in <a href="http://technet.microsoft.com/en-us/library/cc772778(WS.10).aspx" target="_blank"><span style="COLOR: #336699">this TechNet article</span></a> (see if you can find the line!) or came across <a href="http://blogs.technet.com/filecab/archive/2006/05/10/427837.aspx" target="_blank"><span style="COLOR: #336699">this post</span></a> on the Microsoft Storage Team&#8217;s blog.</p>
<p>How do you fix that? One way is to use <a href="http://en.wikipedia.org/wiki/Robocopy" target="_blank"><span style="COLOR: #336699">Robocopy</span></a> to strip the temporary attribute off the file(s) when copying into the DFS share. The switch is: <span style="FONT-FAMILY: Courier New"><strong>/A-:T</strong></span></p>
<p><strong>Lesson #5 &#8211; Monitor DFS Replication Performance</strong> <br/>One big downside to DFS Replication is that unlike other Microsoft products there&#8217;s no shiny GUI to monitor DFS replication performance. That doesn&#8217;t mean it can&#8217;t be done &#8211; it just requires a little extra work. There&#8217;s a command line executable included with DFS called <span style="FONT-FAMILY: Courier New">dfsradmin</span> that will create an HTML report showing DFS Replication&#8217;s health status. There&#8217;s a nice writeup <a href="http://blogs.technet.com/filecab/archive/2006/06/19/automating-dfs-replication-health-reports.aspx" target="_blank"><span style="COLOR: #336699">here</span></a> and <a href="http://blogs.technet.com/filecab/pages/437214.aspx" target="_blank"><span style="COLOR: #336699">here</span></a> on how to automate DFS replication health reports. I highly recommend that you take the time to read it and implement your own automated reports.</p>
<p><strong>Conclusion</strong> <br/>I hope that my lessons learned the hard way will save you some of the pain that I had to go through. Despite the hiccups that I&#8217;ve had with DFS I remain a big fan of using it to keep content synchronized across multiple locations. One last bit of advice &#8211; be sure to check out the <a href="http://blogs.technet.com/filecab/default.aspx" target="_blank"><span style="COLOR: #336699">File Cabinet blog from the Storage Team at Microsoft</span></a> . It&#8217;s a fantastic resource for DFS information that&#8217;s helped me out many times and will no doubt help you too.</p>
<div style="CLEAR: both">
<p>DFS提供分布式文件服务，高效并且减轻了系统管理员的负担，但是不正当的使用会有灾难性事件发生，如下文章为使用DFS应该注意到的地方。</p>
<div class="post-body entry-content">
<p><em>In addition to being a SQL DBA I&#8217;m also a network administrator, or at least I pretend to be. This is a bit off-topic from my usual SQL Server fare, but I figured my pain is your gain. Today, July 31, is <a href="http://www.sysadminday.com/" target="_blank"><span style="COLOR: #336699">System Administrator Appreciation Day</span></a> . If you use DFS Replication in your company, give your sysadmin a gift by forwarding this on to him\her.</em></p>
<p><strong>Background &#8211; What Is DFS Anyways?</strong> <br/>DFS, or <a href="http://en.wikipedia.org/wiki/DFS_(Microsoft)" target="_blank"><span style="COLOR: #336699">Distributed File System</span></a> , is a feature built into Windows Server that allows you to organize multiple SMB shares into a single DFS share. Accessing the DFS share automatically redirects (under the covers) to one of the SMB shares that are part of the group. It&#8217;s a neat bit of technology that provides location transparency and redundancy simultaneously. Another part of DFS is the ability to replicate changes made to a file (or files) in one of the SMB shares to all of the other SMB shares in the group. Prior to Windows Server 2003 R2 this feature was called <a href="http://en.wikipedia.org/wiki/DFS_replication" target="_blank"><span style="COLOR: #336699">File Replication Service</span></a> and, while it worked, it was less than efficient because any change to a file resulted in the entire file being copied (imagine making a 1 line change to a 100 MB file). Beginning with Server 2003 R2 it was renamed to <a href="http://technet.microsoft.com/en-us/library/cc778621(WS.10).aspx" target="_blank"><span style="COLOR: #336699">DFS Replication</span></a> . Along with it came some nice improvements which included scheduling, bandwidth throttling, and most importantly <a href="http://en.wikipedia.org/wiki/Remote_Differential_Compression" target="_blank"><span style="COLOR: #336699">Remote Differential Compression</span></a> which detects and replicates only the part of the file which changed and not the entire file.</p>
<p>DFS (and DFS replication) is really nifty when it works. My company uses it to keep content synchronized on servers across multiple datacenters. However, there are a few caveats that you need to be aware of. I&#8217;ll call them lessons learned, and unfortunately I had to learn them the hard way. I&#8217;m going to share them with you in the hopes that you won&#8217;t have to go through the same pain that I did.</p>
<p><strong>Lesson #1 &#8211; Be <span style="TEXT-DECORATION: underline">Very</span> Careful When Removing And Re-Adding Members To A DFS Replication Group</strong> <br/>Let&#8217;s pretend you&#8217;ve got DFS Replication set up and you want to add a server (referred to as a member) into your group. You start with a blank target directory on the member and a short while after adding it to the group it gets populated with the files &amp; folders from the other members in the group. At some point in the future you need to remove that member temporarily and then re-add it. Thinking you need to start with a blank target directory like the first time you wipe the directory clean and then add the member back to the group. A short time later you start to see the opposite of what you expect &#8211; instead of the member receiving the files &amp; folders from the other members they start <em>disappearing</em> from every member in the group. What the heck happened?!?</p>
<p>It turns out that when you delete a member from a DFS replication group information about the member isn&#8217;t actually deleted from the DFS replication database. Instead, the member is marked with a 30-day tombstone flag. If the member is added back into the DFS replication group the flag is deleted and the original objects for the member are reused. Any changes made to the recently re-added member are then replicated to the other members. So deleting those files from the member before re-adding it? They get picked up and replicated to the other members.</p>
<p>This &#8220;feature&#8221; and 3 workarounds are documented in <a href="http://support.microsoft.com/kb/961655" target="_blank"><span style="COLOR: #336699">Microsoft KB article 961655</span></a> . Do yourself a favor and read it.</p>
<p><strong>Lesson #2 &#8211; Back Up Your DFS Shares</strong> <br/>Lesson #1 leads to lesson #2, which should a no brainer &#8211; Back up your DFS shares. DFS Replication will replicate <strong><span style="TEXT-DECORATION: underline">all</span></strong> changes to files, including deletes. Would you like to explain to management how you just lost all your files permanently because someone mistakenly deleted all of them and you weren&#8217;t taking backups? I wouldn&#8217;t.</p>
<p><strong>Lesson #3 &#8211; Recover Deleted Files In A Pinch</strong> <br/>Suppose you didn&#8217;t learn from lesson #2, files got deleted by mistake, and you don&#8217;t have backups. All hope is not lost. It turns out that DFS Replication keeps a hidden, private folder which contains a copy of the deleted files. It&#8217;s limited in size so it&#8217;s not foolproof but it just might save you in a pinch.</p>
<p><a href="http://blogs.technet.com/filecab/pages/ned-pyle-s-bio.aspx" target="_blank"><span style="COLOR: #336699">Ned Pyle</span></a> , a Technical Lead for the Directory Services team at Microsoft, <a href="http://blogs.technet.com/filecab/archive/2008/01/02/a-script-to-restore-data-from-the-dfsr-conflictanddeleted-or-preexisting-folders-for-disaster-recovery-purposes.aspx" target="_blank"><span style="COLOR: #336699">posted a handy VB Script</span></a> that you can use to restore data if you&#8217;re in disaster recovery mode. I&#8217;ve used it and it saved my butt. By the way, remember lesson #2 about backing up your DFS shares? (hint, hint)</p>
<p><strong>Lesson #4 &#8211; Files With The Temporary Attribute Won&#8217;t Replicate</strong> <br/>Filters can be applied to exclude files from replicating based on their extension (e.g. .BAK), but what about when a non-excluded file just won&#8217;t seem to replicate? It might have the temporary attribute set. DFS Replication won&#8217;t pick up changes to those files. You wouldn&#8217;t know that unless you found the single line mentioning it in <a href="http://technet.microsoft.com/en-us/library/cc772778(WS.10).aspx" target="_blank"><span style="COLOR: #336699">this TechNet article</span></a> (see if you can find the line!) or came across <a href="http://blogs.technet.com/filecab/archive/2006/05/10/427837.aspx" target="_blank"><span style="COLOR: #336699">this post</span></a> on the Microsoft Storage Team&#8217;s blog.</p>
<p>How do you fix that? One way is to use <a href="http://en.wikipedia.org/wiki/Robocopy" target="_blank"><span style="COLOR: #336699">Robocopy</span></a> to strip the temporary attribute off the file(s) when copying into the DFS share. The switch is: <span style="FONT-FAMILY: Courier New"><strong>/A-:T</strong></span></p>
<p><strong>Lesson #5 &#8211; Monitor DFS Replication Performance</strong> <br/>One big downside to DFS Replication is that unlike other Microsoft products there&#8217;s no shiny GUI to monitor DFS replication performance. That doesn&#8217;t mean it can&#8217;t be done &#8211; it just requires a little extra work. There&#8217;s a command line executable included with DFS called <span style="FONT-FAMILY: Courier New">dfsradmin</span> that will create an HTML report showing DFS Replication&#8217;s health status. There&#8217;s a nice writeup <a href="http://blogs.technet.com/filecab/archive/2006/06/19/automating-dfs-replication-health-reports.aspx" target="_blank"><span style="COLOR: #336699">here</span></a> and <a href="http://blogs.technet.com/filecab/pages/437214.aspx" target="_blank"><span style="COLOR: #336699">here</span></a> on how to automate DFS replication health reports. I highly recommend that you take the time to read it and implement your own automated reports.</p>
<p><strong>Conclusion</strong> <br/>I hope that my lessons learned the hard way will save you some of the pain that I had to go through. Despite the hiccups that I&#8217;ve had with DFS I remain a big fan of using it to keep content synchronized across multiple locations. One last bit of advice &#8211; be sure to check out the <a href="http://blogs.technet.com/filecab/default.aspx" target="_blank"><span style="COLOR: #336699">File Cabinet blog from the Storage Team at Microsoft</span></a> . It&#8217;s a fantastic resource for DFS information that&#8217;s helped me out many times and will no doubt help you too.</p>
<div style="CLEAR: both">其它链接: <a href="http://technet.microsoft.com/en-us/library/cc738552(WS.10).aspx" target="_blank">Installing the DFS Management Snap-in and DFS Replication Service</a><!----></div>
</p></div>
</p></div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.nixway.net/blog/archives/503/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netdom Replacement in Windows 7</title>
		<link>http://www.nixway.net/blog/archives/499</link>
		<comments>http://www.nixway.net/blog/archives/499#comments</comments>
		<pubDate>Mon, 22 Nov 2010 00:23:10 +0000</pubDate>
		<dc:creator>Jane Wang</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[netdom windows 7 Add-Computer]]></category>

		<guid isPermaLink="false">http://www.nixway.net/blog/archives/499</guid>
		<description><![CDATA[Netdom is used in versions of Windows before Windows 7<a href="http://www.nixway.net/blog/archives/499">&#160;&#160; ...<b>阅读全文</b>...</a>]]></description>
			<content:encoded><![CDATA[<p>Netdom is used in versions of Windows before Windows 7 for command-line domain membership tasks such as joining a computer to a domain. Windows 7 instead provides the PowerShell cmdlet Add-Computer, which allows you to add a computer to a domain or workgroup. The syntax for the command is <br/><br/><strong>Add-Computer &lt;domain name&gt;</strong></p>
<p>The cmdlet allows far more complex execution than Netdom. You can use items such as the organizational unit location of the computer account, credentials, and computer name in the command. Run the command Get-Help Add-Computer for all the syntax options.</p>
<p><strong>NAME <br/></strong> Add-Computer <br/><br/><strong>SYNOPSIS <br/></strong> Add the local computer to a domain or workgroup. <br/><br/><br/><strong>SYNTAX <br/></strong> Add-Computer [-DomainName] &lt;string&gt; [-Credential &lt;PSCredential&gt;] [-OUPath &lt;string&gt;] [-Server &lt;string&gt;] [-Unsecure] [-PassThru] [-Confirm] [-WhatIf] [&lt;CommonParameters&gt;] <br/><br/>Add-Computer [-WorkGroupName] &lt;string&gt; [-Credential &lt;PSCredential&gt;] [-PassThru] [-Confirm] [-WhatIf] [&lt;CommonParameters&gt;] <br/><br/><br/><strong>DESCRIPTION <br/></strong> The Add-Computer cmdlet adds the local computer to a domain or workgroup, or moves it from one domain to another. It also creates a domain account if the computer is added to the domain without an accou <br/>nt. <br/><br/>You can use the parameters of this cmdlet to specify an organizational unit (OU) and domain controller or to perform an unsecure join. <br/><br/>To get the results of the command, use the Verbose and PassThru parameters. <br/></p>
<p><strong>RELATED LINKS <br/></strong> Online version: <a href="http://go.microsoft.com/fwlink/?LinkID=135194">http://go.microsoft.com/fwlink/?LinkID=135194</a> <br/>Checkpoint-Computer <br/>Remove-Computer <br/>Restart-Computer <br/>Restore-Computer <br/>Stop-Computer <br/>Test-Connection</p>
<p><strong>REMARKS <br/></strong> To see the examples, type: &#8220;get-help Add-Computer -examples&#8221;. <br/>For more information, type: &#8220;get-help Add-Computer -detailed&#8221;. <br/>For technical information, type: &#8220;get-help Add-Computer -full&#8221;. <br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nixway.net/blog/archives/499/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在Suse Linux上安装Linux-HA</title>
		<link>http://www.nixway.net/blog/archives/489</link>
		<comments>http://www.nixway.net/blog/archives/489#comments</comments>
		<pubDate>Sun, 21 Nov 2010 01:44:17 +0000</pubDate>
		<dc:creator>Jane Wang</dc:creator>
				<category><![CDATA[Linux系统管理]]></category>
		<category><![CDATA[Linux HA 高可用性]]></category>

		<guid isPermaLink="false">http://www.nixway.net/blog/archives/489</guid>
		<description><![CDATA[因业务需求，需要在Suse Linux安装Linux-HA, 花费了不少时间, 最后，参照了来自 &#8220;Cent OS 5.4 Heartbeat3.0.3 + LVS<a href="http://www.nixway.net/blog/archives/489">&#160;&#160; ...<b>阅读全文</b>...</a>]]></description>
			<content:encoded><![CDATA[<p>因业务需求，需要在Suse Linux安装Linux-HA, 花费了不少时间, 最后，参照了来自 &#8220;Cent OS 5.4 Heartbeat3.0.3 + LVS &#8220;, 来自： <a href="http://www.cnblogs.com/captain_jack/archive/2010/10/13/1850226.html">http://www.cnblogs.com/captain_jack/archive/2010/10/13/1850226.html</a> , 所碰到的错误是一样的, 解决方法也一样，特此致谢。如下为转载：</p>
<p>===============================================================</p>
<p>Heartbeat提供了高可用集群最基本的功能，例如，节点间的内部通信方式、集群合作管理机制、监控工具和失效切换功能等。但是Heartbeat仅仅是个HA软件，它仅能完成心跳监控和资源接管，不会监视它控制的资源或应用程序。要监控资源和应用程序是否运行正常，必须使用第三方的插件，例如ipfail、Mon和Ldirector等。Heartbeat自身包含了几个插件，分别是ipfail、Stonith和Ldirectord。</p>
<p>首先到<a href="http://www.linux-ha.org/wiki/Downloads">http://www.linux-ha.org/wiki/Downloads</a>中下载所需软件，分别是Heartbeat、Cluster Glue、Resource Agents。编译的顺序是：先Cluster Glue, 再Resource Agents，然后Heartbeat。另外需要确认安装了autoconf, automake,pkgconfig,libxslt-devel等包</p>
<p>===============================================================</p>
<p><strong>环境</strong></p>
<pre>
   Linux-master　　10.10.50.217
   Linux-slave　　10.10.50.151
   Linux-web-01　　10.10.50.197
   Linux-web-02　　10.10.50.215
   Virtual_IP:10.10.50.216
</pre>
<p>===============================================================</p>
<p><strong>Heartbeat</strong></p>
<p>编译安装的时候可能遇到一个问题是</p>
<div class="cnblogs_Highlighter">
<pre class="brush:Perl">
./.libs/libplumb.so: undefined reference to `uuid_parse'
./.libs/libplumb.so: undefined reference to `uuid_generate'
./.libs/libplumb.so: undefined reference to `uuid_copy'
./.libs/libplumb.so: undefined reference to `uuid_is_null'
./.libs/libplumb.so: undefined reference to `uuid_unparse'
./.libs/libplumb.so: undefined reference to `uuid_clear'
./.libs/libplumb.so: undefined reference to `uuid_compare'
collect2: ld returned 1 exit status
gmake[2]: *** [ipctest] Error 1
gmake[2]: Leaving directory `/root/Reusable-Cluster-Components-glue-1.0.6/lib/clplumbing'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/root/Reusable-Cluster-Components-glue-1.0.6/lib'
make: *** [all-recursive] Error 1
</pre>
</div>
<p>　　解决方法：在configure时在后面加上LIBS=&#8217;/lib/libuuid.so.1&#8242;。这个问题在对三个包进行make的时候都会出现类似的错误，所以make三个包时都要用到，我在编译中没有遇到这个问题。</p>
<p><strong>安装步骤</strong></p>
<p><span style="COLOR: #ff0000">安装过程中会在INTERNET中校验一些xml文件，会耗费大量时间，要耐心等待。如果报错可能是网络引起，多试几次就行。</span></p>
<p><strong>一、安装 Reusable-Cluster-Components-glue-1.0.6.tar.bz2</strong></p>
<pre>
   #groupadd hacluster
   #groupadd haclient
   #useradd hacluster -g hacluster
   #tar -jxf Reusable-Cluster-Components-glue-1.0.6.tar.bz2
   #cd Reusable-Cluster-Components-glue-1.0.6
   #./autogen.sh
   #./configure
   #make
   #make install
</pre>
<p>这里编译的时候会遇到另外一个问题</p>
<div class="cnblogs_Highlighter">
<pre class="brush:Perl">
cc1: warnings being treated as errors
main.c:64: warning: function declaration isn't a prototype
main.c:78: warning: function declaration isn't a prototype
gmake[2]: *** [main.o] Error 1
gmake[2]: Leaving directory
`/root/Reusable-Cluster-Components-glue-1.0.6/lib/stonith'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/root/Reusable-Cluster-Components-glue-1.0.6/lib'
make: *** [all-recursive] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.55884 (%build)
</pre>
</div>
<p>解决方法：编辑lib/stonith/main.c，将version相关的注释掉</p>
<pre>
   1、找到其64行，用/* ....*/注释掉。
   2、找到其76到81行 用/* ....*/注释掉。
   3、找到其390到 391 行，用/* ....*/注释掉。
</pre>
<p><strong>二、安装 Cluster-Resource-Agents-agents-1.0.3</strong></p>
<pre>
   #tar -jxf Cluster-Resource-Agents-agents-1.0.3.tar.bz2
   #cd Cluster-Resource-Agents-agents-1.0.3
   #./autogen.sh
   #./configure
   #make
   #make install
</pre>
<p><strong>三、安装 Heartbeat-3-0-STABLE-3.0.3.tar.bz2</strong></p>
<pre>
   # tar -jxf Heartbeat-3-0-STABLE-3.0.3.tar.bz2
   #cd Heartbeat-3-0-STABLE-3.0.3
   #./bootstrap
   #./ConfigureMe configure
   #make
   #make install
</pre>
<p><strong>编辑配置文件</strong></p>
<pre>
   # cp /usr/share/doc/ha.cf /etc/ha.d/

   #cp /usr/share/doc/haresources /etc/ha.d/
   #cp /usr/share/doc/authkeys /etc/ha.d/
</pre>
<p>heartbeat的配置文件有两个位置/etc/ha.d与/usr/etc/ha.d，将/usr/etc/ha.d中文件全部copy到/etc/ha.d中，删除/usr/etc/ha.d，然后使用命令ln -s /etc/ha.d /usr/etc/ha.d创建软连接</p>
<p><strong>1、配置ha.cf</strong></p>
<pre>
   debugfile /var/log/ha-debug：该文件保存heartbeat的调试信息
   <br/>   logfile /var/log/ha-log：heartbeat的日志文件
   <br/>   keepalive 2：心跳的时间间隔，默认时间单位为秒
   <br/>   deadtime 30：超出该时间间隔未收到对方节点的心跳，则认为对方已经死亡。
   <br/>   warntime 10：超出该时间间隔未收到对方节点的心跳，则发出警告并记录到日志中。
   <br/>   initdead 120：在某些系统上，系统启动或重启之后需要经过一段时间网络才能正常工作，该选项用于解决这种情况产生的时间间隔。取值至少为deadtime的两倍。
<br/>   udpport 694：设置广播通信使用的端口，694为默认使用的端口号。
   <br/>   baud 19200：设置串行通信的波特率。
   <br/>   serial /dev/ttyS0：选择串行通信设备，用于双机使用串口线连接的情况。如果双机使用以太网连接，则应该关闭该选项。
   <br/>   bcast eth0：设置广播通信所使用的网络接口卡。
   <br/>   auto_failback on：heartbeat的两台主机分别为主节点和从节点。主节点在正常情况下占用资源并运行所有的服务，遇到故障时把资源交给从节点并由从节点运行服务。在该选项设为on的情况下，一旦主节点恢复运行，则自动获取资源并取代从节点，否则不取代从节点。
<br/>   ping ping-node1 ping-node2：指定ping node，ping node并不构成双机节点，它们仅仅用来测试网络连接。
   <br/>   respawn hacluster /usr/lib/heartbeat/ipfail：指定与heartbeat一同启动和关闭的进程，该进程被自动监视，遇到故障则重新启动。最常用的进程是ipfail，该进程用于检测和处理网络故障，需要配合ping语句指定的ping
   node来检测网络连接。
</pre>
<p><strong>2、 配置haresources文件</strong></p>
<p>haresources文件用于指定双机系统的主节点、集群IP、子网掩码、广播地址以及启动的服务等。其配置语句格式如下：</p>
<p>node-name network-config &lt;resource-group&gt; <br/>其中node-name指定双机系统的主节点，取值必须匹配ha.cf文件中node选项设置的主机名中的一个，node选项设置的另一个主机名成为从节点。network-config用于设置VIP（虚拟IP，也就是真正对外提供服务的IP）。resource-group用于设置heartbeat启动的服务，该服务最终由双机系统通过集群IP对外提供。</p>
<p><strong>3、配置authkeys文件</strong></p>
<p>authkeys文件用于heartbeat的鉴权设置，共有三种可用的鉴权方式：crc、md5和sha1。三种方式安全性依次提高，但同时占用的系统资源也依次扩大。crc安全性最低，适用于物理上比较安全的网络，sha1提供最为有效的鉴权方式，占用的系统资源也最多。</p>
<p>其配置语句格式如下： <br/>auth &lt;number&gt; <br/>&lt;number&gt; &lt;authmethod&gt; [&lt;authkey&gt;] <br/>举例说明： <br/>auth 1 <br/>1 sha1 key-for-sha1 <br/>其中键值key-for-sha1可以任意指定，number设置必须保证上下一致。</p>
<p>auth 2 <br/>2 crc <br/>crc方式不需要指定键值。 <br/><span style="COLOR: #ff0000">最后，设置authkeys文件权限为600（即-rw&#8212;&#8212;-），命令为：chmod 600 authkeys</span></p>
<p>===============================================================</p>
<p><strong>LVS</strong></p>
<p><strong>安装步骤</strong></p>
<pre>
   #tar zxvf ipvsadm-1.24.tar.gz
   #cd ipvsadm-1.24
   #./configure
   #make &amp;&amp; make install
   #cp /usr/local/src/Cluster-Resource-Agents-agents-1.0.3/ldirectord/ldirectord.cf /etc/ha.d/
</pre>
<p><strong>配置ldirectord.cf</strong></p>
<div class="cnblogs_Highlighter">
<pre>
# Global Directives
checktimeout=10
checkinterval=3
#fallback=127.0.0.1:80
autoreload=yes
#logfile="/var/log/ldirectord.log"
#logfile="local0"
#emailalert="admin@x.y.z"
#emailalertfreq=3600
#emailalertstatus=all
quiescent=no

# Sample for an http virtual service
virtual=10.10.50.216:80
        real=10.10.50.197:80 gate
        real=10.10.50.215:80 gate
        fallback=127.0.0.1:80 gate
        service=http
        scheduler=wlc
        #persistent=600
        #netmask=255.255.255.255
        protocol=tcp
        checktype=negotiate
        checkport=80
        request="check.html"
        receive="OKAY"
        #virtualhost=www.x.y.z
</pre>
</div>
<p>LVS脚本，在Linux-master、Linux-slave上运行</p>
<div class="cnblogs_Highlighter">
<pre>
#!/bin/sh
#director.sh

VIP=10.10.50.216
RIP1=10.10.50.197
RIP2=10.10.50.215

. /etc/rc.d/init.d/functions

case "$1" in
    start)
       echo " start LVS  of DirectorServer"
       /sbin/ifconfig eth0:0 $VIP broadcast $VIP netmask 255.255.255.255 up
       /sbin/route add -host $VIP dev eth0:0
       /sbin/ipvsadm -C
       /sbin/ipvsadm -A -t $VIP:80 -s wlc
       /sbin/ipvsadm -a -t $VIP:80 -r $RIP1:80 -g
       /sbin/ipvsadm -a -t $VIP:80 -r $RIP2:80 -g
       /sbin/ipvsadm
        ;;
    stop)
        echo "close LVS Directorserver"
        ifconfig eth0:0 down
        /sbin/ipvsadm -C
        ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
esac
</pre>
</div>
<p>客户端脚本，在Linux-web-01、Linux-web-02上运行</p>
<div class="cnblogs_Highlighter">
<pre class="brush:Perl">
#!/bin/sh
#realserver.sh

VIP=10.10.50.216

. /etc/rc.d/init.d/functions

case "$1" in
    start)
        echo "Tunl port starting"
        /sbin/ifconfig lo:0 $VIP netmask 255.255.255.255 broadcast $VIP up
        /sbin/route add -host $VIP dev lo:0
        echo "1" &gt;/proc/sys/net/ipv4/conf/tunl0/arp_ignore
        echo "2" &gt;/proc/sys/net/ipv4/conf/tunl0/arp_announce
        echo "1" &gt;/proc/sys/net/ipv4/conf/all/arp_ignore
        echo "2" &gt;/proc/sys/net/ipv4/conf/all/arp_announce
        sysctl -p
        ;;
    stop)
        echo "Tunl port closing"
        ifconfig lo:0 down
        ;;
    *)
        echo "Usage: $0 {start|stop}"
        exit 1
esac
</pre>
</div>
<p><span style="COLOR: #000000">我这里客户端上的WEB程序选用的是Nginx，在客户端输入</span></p>
<pre>
   <span style="COLOR: #000000">#echo "OKAY" &gt; /usr/local/nginx/html/check.html</span>
</pre>
<p><span style="COLOR: #888888"><br/></span></p>
<p><strong>ipvsadm 的用法和格式如下：</strong></p>
<pre>
   ipvsadm -A|E -t|u|f
   virutal-service-address:port [-s scheduler] [-p
   <br/>   [timeout]] [-M netmask]
   <br/>   ipvsadm -D -t|u|f virtual-service-address
   <br/>   ipvsadm -C
   <br/>   ipvsadm -R
   <br/>   ipvsadm -S [-n]
   <br/>   ipvsadm -a|e -t|u|f service-address:port -r real-server-address:port
   <br/>   [-g|i|m] [-w weight]
   <br/>   ipvsadm -d -t|u|f service-address -r server-address
   <br/>   ipvsadm -L|l [options]
   <br/>   ipvsadm -Z [-t|u|f service-address]
   <br/>   ipvsadm --set tcp tcpfin udp
   <br/>   ipvsadm --start-daemon state [--mcast-interface interface]
   <br/>   ipvsadm --stop-daemon
   <br/>   ipvsadm -h
</pre>
<p><br/>命令选项解释：</p>
<pre>
   <br/>   有两种命令选项格式，长的和短的，具有相同的意思。在实际使用时，两种都可
   <br/>   以。
   <br/>   -A --add-service 在内核的虚拟服务器表中添加一条新的虚拟服务器记录。也就是增加一台新的虚拟服务器。
   <br/>   -E --edit-service 编辑内核虚拟服务器表中的一条虚拟服务器记录。
   <br/>   -D --delete-service 删除内核虚拟服务器表中的一条虚拟服务器记录。
   <br/>   -C --clear 清除内核虚拟服务器表中的所有记录。
   <br/>   -R --restore 恢复虚拟服务器规则
   <br/>   -S --save 保存虚拟服务器规则，输出为-R 选项可读的格式
   <br/>   -a --add-server 在内核虚拟服务器表的一条记录里添加一条新的真实服务器记录。也就是在一个虚拟服务器中增加一台新的真实服务器
   <br/>   -e --edit-server 编辑一条虚拟服务器记录中的某条真实服务器记录
   <br/>   -d --delete-server 删除一条虚拟服务器记录中的某条真实服务器记录
   <br/>   -L|-l --list 显示内核虚拟服务器表
   <br/>   -Z --zero 虚拟服务表计数器清零（清空当前的连接数量等）
   <br/>   --set tcp tcpfin udp 设置连接超时值
   <br/>   --start-daemon 启动同步守护进程。他后面可以是master 或backup，用来说明LVS Router 是master 或是backup。在这个功能上也可以采用keepalived 的
   <br/>   VRRP 功能。
   <br/>   --stop-daemon 停止同步守护进程
   <br/>   -h --help 显示帮助信息
   <br/>   其他的选项:
   <br/>   -t --tcp-service service-address 说明虚拟服务器提供的是tcp 的服务[vip:port] or [real-server-ip:port]
   <br/>   -u --udp-service service-address 说明虚拟服务器提供的是udp 的服务[vip:port] or [real-server-ip:port]
   <br/>   -f --fwmark-service fwmark 说明是经过iptables 标记过的服务类型。
   <br/>   -s --scheduler scheduler 使用的调度算法，有这样几个选项
   <br/>   rr|wrr|lc|wlc|lblc|lblcr|dh|sh|sed|nq,
   <br/>   默认的调度算法是： wlc.
   <br/>   -p --persistent [timeout] 持久稳固的服务。这个选项的意思是来自同一个客户的多次请求，将被同一台真实的服务器处理。timeout 的默认值为300 秒。
   <br/>   -M --netmask netmask persistent granularity mask
   <br/>   -r --real-server server-address 真实的服务器[Real-Server:port]
   <br/>   -g --gatewaying 指定LVS 的工作模式为直接路由模式（也是LVS 默认的模式）
   <br/>   -i --ipip 指定LVS 的工作模式为隧道模式
   <br/>   -m --masquerading 指定LVS 的工作模式为NAT 模式
   <br/>   -w --weight weight 真实服务器的权值
   <br/>   --mcast-interface interface 指定组播的同步接口
   <br/>   -c --connection 显示LVS 目前的连接 如：ipvsadm -L -c
   <br/>   --timeout 显示tcp tcpfin udp 的timeout 值 如：ipvsadm -L --timeout
   <br/>   --daemon 显示同步守护进程状态
   <br/>   --stats 显示统计信息
   <br/>   --rate 显示速率信息
   <br/>   --sort 对虚拟服务器和真实服务器排序输出
   <br/>   --numeric -n 输出IP 地址和端口的数字形式
</pre>
<p>===============================================================</p>
<p style="TEXT-INDENT: 0px; MARGIN: 5px auto"><strong><span style="COLOR: #ff0000">启动服务</span></strong></p>
<p style="TEXT-INDENT: 0px; MARGIN: 5px auto">#/etc/init.d/heartbeat start</p>
<p style="TEXT-INDENT: 0px; MARGIN: 5px auto">
<p style="TEXT-INDENT: 0px; MARGIN: 5px auto">另外有两个比较有用的脚本</p>
<p style="TEXT-INDENT: 0px; MARGIN: 5px auto">/usr/share/heartbeat/hb_standby　　#强制将资源漂移到备份节点</p>
<p style="TEXT-INDENT: 0px; MARGIN: 5px auto">/usr/share/heartbeat/hb_takeover　　#强制将资源漂移到主节点</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nixway.net/blog/archives/489/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPv6 保留地址</title>
		<link>http://www.nixway.net/blog/archives/478</link>
		<comments>http://www.nixway.net/blog/archives/478#comments</comments>
		<pubDate>Sat, 09 Oct 2010 07:48:21 +0000</pubDate>
		<dc:creator>Jane Wang</dc:creator>
				<category><![CDATA[网络]]></category>
		<category><![CDATA[IPv6 保留地址]]></category>

		<guid isPermaLink="false">http://www.nixway.net/blog/archives/478</guid>
		<description><![CDATA[特殊保留地址 ::/128 &#8211; The address with all zero bits is<a href="http://www.nixway.net/blog/archives/478">&#160;&#160; ...<b>阅读全文</b>...</a>]]></description>
			<content:encoded><![CDATA[<h3>特殊保留地址</h3>
<ul>
<li><tt><strong>::/128</strong></tt> &#8211; The address with all zero bits is called the unspecified address (corresponding to <tt>0.0.0.0</tt> in IPv4). <br/>This address must never be assigned to an interface and is to be used only in software before the application has learned its host&#8217;s source address appropriate for a pending connection. Routers must not forward packets with the unspecified address. <br/>Applications may be listening on one or more specific interfaces for incoming connections, which are shown in listings of active internet connections by a specific IP address (and a port number, separated by a colon). When the unspecified address is shown it means that an application is listening for incoming connections on all available interfaces.</li>
</ul>
<h3>缺省路由/Default Route</h3>
<ul>
<li><tt><strong>::/0</strong></tt> &#8211; The default unicast route address (corresponding to <tt>0.0.0.0</tt> with netmask <tt>0.0.0.0</tt> in IPv4).</li>
</ul>
<h3>本地地址/Local addresses</h3>
<ul>
<li><tt><strong>::1/128</strong></tt> &#8211; The <a href="http://en.wikipedia.org/wiki/Loopback" title="Loopback"><span style="COLOR: #0645ad">loopback</span></a> address is a unicast <a href="http://en.wikipedia.org/wiki/Localhost" title="Localhost"><span style="COLOR: #0b0080">localhost</span></a> address. If an application in a host sends packets to this address, the IPv6 stack will loop these packets back on the same virtual interface (corresponding to <tt><span style="COLOR: #0645ad">127.0.0.1</span></tt> in IPv4).</li>
<li><tt>fe80::/10</tt> &#8211; Addresses in the link-local prefix are only valid and unique on a single link. Within this prefix only one subnet is allocated (54 zero bits), yielding an effective format of <tt>fe80::/64</tt>. The least significant 64 bits are usually chosen as the interface hardware address constructed in <span style="COLOR: #0645ad">modified EUI-64</span> format. A <span style="COLOR: #0645ad">link-local address</span> is required on every IPv6-enabled interface-in other words, applications may rely on the existence of a link-local address even when there is no IPv6 routing. These addresses are comparable to the auto-configuration addresses <tt>169.254.0.0/16</tt> of IPv4.</li>
</ul>
<h3>Unique local addresses</h3>
<ul>
<li><tt><strong>fc00::/7</strong></tt> &#8211; Unique local addresses (ULA&#8217;s) are intended for local communication. They are routable only within a set of cooperating sites (analogous to the private address ranges <tt>10/8</tt>, <tt>172.16/12</tt>, and <tt>192.168/16</tt> of IPv4).The addresses include a 40-bit <span style="COLOR: #0645ad">pseudorandom</span> number in the routing prefix intended to minimize the risk of conflicts if sites merge or packets are misrouted into the Internet. Despite the restricted, local usage of these addresses, their address scope is global, i.e. they are expected to be globally unique.</li>
</ul>
<h3>Solicited-Node multicast addresses</h3>
<ul>
<li><tt><strong>ff02::1:ff00:0/104</strong></tt> &#8211; The least significant 24 bits of the group ID are filled with the least significant 24 bits of the interface&#8217;s unicast or anycast address. These addresses allow link-layer address resolution via <span style="COLOR: #0645ad">Neighbor Discovery Protocol</span> (NDP) on the link without disturbing all nodes on the local network. A host is required to join a Solicited-Node multicast group for each of its configured unicast or anycast addresses.</li>
</ul>
<h3>IPv4 transition</h3>
<ul>
<li><tt><strong>::ffff:0:0/96</strong></tt> &#8211; This prefix designated an <em>IPv4-mapped IPv6 address</em>. With a few exceptions, this address type allows the transparent use of the <span style="COLOR: #0645ad">Transport Layer</span> protocols over IPv4 through the IPv6 networking <span style="COLOR: #0645ad">application programming interface</span>. Server applications only need to open a single listening <span style="COLOR: #0645ad">socket</span> to handle connections from clients using IPv6 or IPv4 protocols. IPv6 clients will be handled natively by default, and IPv4 clients appear as IPv6 clients at their IPv4-mapped IPv6 address. Transmission is handled similarly; established sockets may be used to transmit IPv4 or IPv6 datagram, based on the binding to an IPv6 address, or an IPv4-mapped address. (See also <span style="COLOR: #0645ad">Transition mechanisms</span>.)</li>
<li><tt><strong>::ffff:0:0:0/96</strong></tt> &#8211; A prefix used for <em>IPv4-translated addresses</em> which are used by the <span style="COLOR: #0645ad">Stateless IP/ICMP Translation (SIIT)</span> protocol.</li>
<li><tt><strong>2002::/16</strong></tt> &#8211; This prefix is used for <strong>6to4</strong> addressing. Here, an address from the IPv4 network <tt>192.88.99.0/24</tt> is also used.</li>
</ul>
<h3>Special Purpose Addresses</h3>
<p>The IANA has been allocated a so-called &#8216;Sub-TLA ID&#8217; address block which consists of 64 network prefixes in the range <tt>2001:0000::/29</tt> through <tt>2001:01f8::/29</tt>. Three assignments from this block have been made:</p>
<ul>
<li><tt><strong>2001::/32</strong></tt> &#8211; Used for Teredo tunneling (which also falls into the category of <span style="COLOR: #0645ad">IPv6 transition mechanisms</span>).</li>
<li><tt><strong>2001:2::/48</strong></tt> &#8211; Assigned to the Benchmarking Methodology Working Group (BMWG) for <span style="COLOR: #0645ad">benchmarking</span> IPv6 (corresponding to <tt>198.18.0.0/15</tt> for benchmarking IPv4).</li>
<li><tt><strong>2001:10::/28</strong></tt> &#8211; ORCHID (Overlay Routable Cryptographic Hash Identifiers). These are non-routed IPv6 addresses used for Cryptographic Hash Identifiers.</li>
</ul>
<h3>文档地址/Documentation</h3>
<ul>
<li><tt><strong>2001:db8::/32</strong></tt> &#8211; This prefix is used in documentation. The addresses should be used anywhere an example IPv6 address is given or model networking scenarios are described (corresponding to <tt>192.0.2.0/24</tt>, <tt>198.51.100.0/24</tt>, and <tt>203.0.113.0/24</tt> in IPv4.)</li>
</ul>
<p>如下为IANA的 <a href="http://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xml" target="_blank" title="Internet Protocol Version 6 Address Space">Internet Protocol Version 6 Address Space</a> , IANA更新日期: 2010-08-30</p>
<table cellpadding="5" border="1" cellspacing="0">
<thead>
<tr>
<th>IPv6 Prefix</th>
<th>Allocation</th>
<th>Reference</th>
<th>Note</th>
</tr>
</thead>
<tbody>
<tr>
<td>0000::/8</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td>
<pre>
The "unspecified address", the "loopback address",
and the IPv6 Addresses with Embedded IPv4 Addresses are assigned
out of the 0000::/8 address block.
</pre>
<pre>
0000::/96 was previously defined as the "IPv4-compatible IPv6
address" prefix.  This definition has been deprecated by [<a href="http://www.iana.org/go/rfc4291">RFC4291</a>].
</pre>
<pre>
</pre>
<pre>
The "Well Known Prefix" 64:ff9b::/96 used in an algorithmic
mapping between IPv4 to IPv6 addresses is defined out of the
0000::/8 address block, per [<a href="http://www.iana.org/go/draft-ietf-behave-address-format">RFC-ietf-behave-address-format</a>].
</pre>
</td>
</tr>
<tr>
<td>0100::/8</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>0200::/7</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4048">RFC4048</a>]</td>
<td>
<pre>
0200::/7 was previously defined as an OSI NSAP-mapped prefix set
[<a href="http://www.iana.org/go/rfc4548">RFC4548</a>]. This definition has been deprecated as of December
2004 [<a href="http://www.iana.org/go/rfc4048">RFC4048</a>].
</pre>
</td>
</tr>
<tr>
<td>0400::/6</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>0800::/5</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>1000::/4</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>2000::/3</td>
<td>Global Unicast</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td>
<pre>
The IPv6 Unicast space encompasses the entire IPv6 address range
with the exception of FF00::/8. [<a href="http://www.iana.org/go/rfc4291">RFC4291</a>] IANA unicast address
assignments are currently limited to the IPv6 unicast address
range of 2000::/3. IANA assignments from this block are registered
in the IANA registry: [<a href="http://www.iana.org/assignments/ipv6-unicast-address-assignments">IANA registry <em>ipv6-unicast-address-assignments</em>
                  </a>].
</pre>
</td>
</tr>
<tr>
<td>4000::/3</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>6000::/3</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>8000::/3</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>A000::/3</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>C000::/3</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>E000::/4</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>F000::/5</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>F800::/6</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>FC00::/7</td>
<td>Unique Local Unicast</td>
<td>[<a href="http://www.iana.org/go/rfc4193">RFC4193</a>]</td>
<td/> </tr>
<tr>
<td>FE00::/9</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>FE80::/10</td>
<td>Link Local Unicast</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
<td/> </tr>
<tr>
<td>FEC0::/10</td>
<td>Reserved by IETF</td>
<td>[<a href="http://www.iana.org/go/rfc3879">RFC3879</a>]</td>
<td>
<pre>
FEC0::/10 was previously defined as a Site-Local scoped address
prefix. This definition has been deprecated as of September 2004
[<a href="http://www.iana.org/go/rfc3879">RFC3879</a>].
</pre>
</td>
</tr>
<tr>
<td>FF00::/8</td>
<td>Multicast</td>
<td>[<a href="http://www.iana.org/go/rfc4291">RFC4291</a>]</td>
</tr>
</tbody>
</table>
<h3>保留的IPv6子网anycast地址</h3>
<p>IPv6地址中引入了anycast地址, 它被指定于一个或多个网络接口。如果数据包发向anycast地址, 它会被路由到有这个地址的最近接口处。</p>
<p><strong>地址格式：</strong>每个子网中, 最高的128个接口标记值被保留用做子网anycast地址, 地址格式取决于用于这个子网中的IP地址类型(即子网前缀)。IPv6地址需要以EUI-64格式有64位接口标记, 在所有保留的子网anycast地址中全局/本地位必须为&#8217;0&#8242;, 说明接口标记不是全局唯一的。这种类型的IPv6地址通常使用前缀为：从001到111（不要将多播地址1111 1111包含在内）。这些保留的子网anycast地址结构如下：</p>
<table cellpadding="7" width="100%" border="1" cellspacing="1">
<tbody>
<tr>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">64位</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">57位</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">7位</span></p>
</td>
</tr>
<tr>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">子网前缀</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">1111110111&#8230;111</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">anycast ID</span></p>
</td>
</tr>
<tr>
<td width="33%" valign="top"/>
<td width="67%" valign="top" colspan="2">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">接口标记域</span></p>
</td>
</tr>
</tbody>
</table>
<p style="TEXT-ALIGN: justify">对于其它IPv6地址类型, 接口标记可以<strong>不是EUI-64格式</strong>, 或者<strong>不是64位长</strong>的保留anycast地址如下构造：</p>
<table cellpadding="7" width="100%" border="1" cellspacing="1">
<tbody>
<tr>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">N位</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">121到N位</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">7位</span></p>
</td>
</tr>
<tr>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">子网前缀</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">1111111&#8230;111111</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">anycast ID</span></p>
</td>
</tr>
<tr>
<td width="33%" valign="top">　</td>
<td width="67%" valign="top" colspan="2">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">接口标记域</span></p>
</td>
</tr>
</tbody>
</table>
<p style="TEXT-ALIGN: justify">其中子网前缀包括IPv6地址中除了<strong>接口标记域</strong>的所有域, 这里的<strong>接口标记域</strong>由7位anycast地址标记形成, 其它位全部是1；但是, 对于EUI-64格式的接口标记, 全局/本地位必须设置为0。保留每个子网的高位地址是为了避免和一些存在的正式或非正式使用的低位地址冲突。只为anycast标记保留128个标记意味着接口标记长度的最小值是8位, 这样可以使子网前缀和接口标准按字节界限对齐。</p>
<p style="TEXT-ALIGN: justify"><strong>子网anycast地址列表</strong></p>
<p style="TEXT-ALIGN: justify">如下地址保留的子网anycast地址范围：</p>
<p style="TEXT-ALIGN: justify">
<table cellpadding="7" width="100%" border="1" cellspacing="1">
<tbody>
<tr>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">十进制</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">十六进制</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">描述</span></p>
</td>
</tr>
<tr>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">127</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">7F</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">保留</span></p>
</td>
</tr>
<tr>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">126</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">7E</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">机动IPv6 Home-Agents任播</span></p>
</td>
</tr>
<tr>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">0-125</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">00-7D</span></p>
</td>
<td width="33%" valign="top">
<p style="TEXT-ALIGN: justify"><span style="FONT-FAMILY: 宋体; FONT-SIZE: 0.9em">保留</span></p>
</td>
</tr>
</tbody>
</table>
<p>　</p>
<p><strong>参考链接:</strong></p>
<ul>
<li><a href="http://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xml" target="_blank" title="Internet Protocol Version 6 Address Space">Internet Protocol Version 6 Address Space</a></li>
<li><a href="http://en.wikipedia.org/wiki/IPv6_address" title="IPv6 Address">IPv6 Address</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.nixway.net/blog/archives/478/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPV4 多播地址</title>
		<link>http://www.nixway.net/blog/archives/477</link>
		<comments>http://www.nixway.net/blog/archives/477#comments</comments>
		<pubDate>Sat, 09 Oct 2010 03:00:11 +0000</pubDate>
		<dc:creator>Jane Wang</dc:creator>
				<category><![CDATA[网络]]></category>
		<category><![CDATA[IPV4 多播地址 Multicast]]></category>

		<guid isPermaLink="false">http://www.nixway.net/blog/archives/477</guid>
		<description><![CDATA[IPv4的多播(Multicast)机制是指: 发送和接收IP多播流量的机制。IP多播流量发送到单个目标IP地址，但是由多个IP主机接收和处理，而不管这些主机在IP互联网络上所处的位置。一个主机侦听一个特定的IP多播地址，并接收发送到该IP地址的所有数据包。 IP多播要比IP单播和广播更为高效。与单播不同，多播仅发送数据的一个副本。与广播不同，多播流量仅由正在侦听它的计算机进行接收和处理。 IP多播地址（Multicast, 也称为组地址）: D类地址: 在224.0.0.0到239.255.255.255范围内, 这是通过将前四个高序位设置为1110来定义的。在网络前缀或CIDR（Classless Inter-Domain Routing）表示法中，IP多播地址缩写为224.0.0.0/4。<a href="http://www.nixway.net/blog/archives/477">&#160;&#160; ...<b>阅读全文</b>...</a>]]></description>
			<content:encoded><![CDATA[<p>IPv4的多播(Multicast)机制是指: 发送和接收IP多播流量的机制。IP多播流量发送到单个目标IP地址，但是由多个IP主机接收和处理，而不管这些主机在IP互联网络上所处的位置。一个主机侦听一个特定的IP多播地址，并接收发送到该IP地址的所有数据包。</p>
<p>IP多播要比IP单播和广播更为高效。与单播不同，多播仅发送数据的一个副本。与广播不同，多播流量仅由正在侦听它的计算机进行接收和处理。</p>
<p>IP多播地址（Multicast, 也称为组地址）: D类地址: 在224.0.0.0到239.255.255.255范围内, 这是通过将前四个高序位设置为1110来定义的。在网络前缀或CIDR（Classless Inter-Domain Routing）表示法中，IP多播地址缩写为224.0.0.0/4。 从224.0.0.0到224.0.0.255 (224.0.0.0/24)范围的多播地址保留用于本地子网，而IP报头中的生存时间（Time to Live，TTL）可忽略，它们都不会被IP路由器转发。</p>
<p>在主机和服务器环境中，基本上只使用 224.0.0.0/4为多播地址。</p>
<table cellpadding="0" border="0" cellspacing="0">
<tbody>
<tr>
<td class="listBullet" valign="top">•</td>
<td class="listItem">
<p>224.0.0.1 &#8211; 该子网上的所有主机。</p>
</td>
</tr>
<tr>
<td class="listBullet" valign="top">•</td>
<td class="listItem">
<p>224.0.0.2 &#8211; 该子网上的所有路由器。</p>
</td>
</tr>
<tr>
<td class="listBullet" valign="top">•</td>
<td class="listItem">
<p>224.0.0.5 &#8211; 开放最短路径优先（Open Shortest Path First，OSPF）算法第2版，设计用于到达某个网络上的所有OSPF路由器。</p>
</td>
</tr>
<tr>
<td class="listBullet" valign="top">•</td>
<td class="listItem">
<p>224.0.0.6 &#8211; 开放最短路径优先算法第2版，设计用于到达某个网络上的所有OSPF指定的路由器。</p>
</td>
</tr>
<tr>
<td class="listBullet" valign="top">•</td>
<td class="listItem">
<p>224.0.0.9 &#8211; 路由信息协议（Routing Information Protocol，RIP）第2版。</p>
</td>
</tr>
<tr>
<td class="listBullet" valign="top">•</td>
<td class="listItem">
<p>224.0.1.1 &#8211; 网络时间协议（Network Time Protocol）。</p>
</td>
</tr>
</tbody>
</table>
<p>参考链接:</p>
<ul>
<li><a href="http://www.microsoft.com/china/technet/community/columns/cableguy/cg0202.mspx" target="_blank" title="IP多播概述">IP多播概述</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.nixway.net/blog/archives/477/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP &#8211; 使用header()更改 HTTP header信息</title>
		<link>http://www.nixway.net/blog/archives/463</link>
		<comments>http://www.nixway.net/blog/archives/463#comments</comments>
		<pubDate>Wed, 06 Oct 2010 14:04:43 +0000</pubDate>
		<dc:creator>Jane Wang</dc:creator>
				<category><![CDATA[HTML CSS 和 Javascript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.nixway.net/blog/archives/463</guid>
		<description><![CDATA[参考链接: http://web-sniffer.net/ 参考链接: http://php.net/manual/en/function.header.php 参考链接: http://www.jonasjohn.de/snippets/php/headers.htm 如何查看网站的headers信息，例如: web-sniffer.net, 还有: LiveHTTPHeaders,<a href="http://www.nixway.net/blog/archives/463">&#160;&#160; ...<b>阅读全文</b>...</a>]]></description>
			<content:encoded><![CDATA[<p>参考链接: <a href="http://web-sniffer.net/">http://web-sniffer.net/</a></p>
<p>参考链接: <a href="http://php.net/manual/en/function.header.php">http://php.net/manual/en/function.header.php</a></p>
<p>参考链接: <a href="http://www.jonasjohn.de/snippets/php/headers.htm">http://www.jonasjohn.de/snippets/php/headers.htm</a></p>
<p>如何查看网站的headers信息，例如: <a href="http://web-sniffer.net/">web-sniffer.net</a>, 还有: <a href="http://livehttpheaders.mozdev.org/">LiveHTTPHeaders</a>, <a href="http://www.blunck.se/iehttpheaders/iehttpheaders.html">ieHTTPHeaders</a> , 关于http状态代码，请参考 HTTP1.1 状态代码: <a title="HTTP 1.1状态代码" href="http://www.nixway.net/blog/archives/462" target="_blank">http://www.nixway.net/blog/archives/462</a> ,如下为一些通过 PHP生成HTTP header的例子:</p>
<pre class="php"><strong>// See related links for more status codes

// Use this header instruction to fix 404 headers
// produced by url rewriting...
</strong>
header('HTTP/1.1 200 OK');

<strong>// Page was not found:</strong>
header('HTTP/1.1 404 Not Found');

<strong>// Access forbidden:
</strong>
header('HTTP/1.1 403 Forbidden');

<strong>// The page moved permanently should be used for
// all redrictions, because search engines know
// what's going on and can easily update their urls.
</strong>
header('HTTP/1.1 301 Moved Permanently');

<strong>// Server error</strong>
header('HTTP/1.1 500 Internal Server Error');

<strong>// Redirect to a new location:</strong>
header('Location: <a href="http://www.example.org/'">http://www.example.org/'</a>);

<strong>// Redriect with a delay:</strong>
header('Refresh: 10; url=http://www.example.org/');
print 'You will be redirected in 10 seconds';

<strong>// you can also use the HTML syntax:
// &lt;meta http-equiv="refresh" content="10;http://www.example.org/ /&gt;</strong>

<strong>// override X-Powered-By value
</strong>
header('X-Powered-By: PHP/4.4.0');
header('X-Powered-By: Brain/0.6b');

<strong>// content language (en = English)</strong>
header('Content-language: en');

<strong>// last modified (good for caching)</strong>
$time = time() - 60; // or filemtime($fn), etc
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $time).' GMT');

// header for telling the browser that the content
// did not get changed
header('HTTP/1.1 304 Not Modified');

<strong>// set content length (good for caching):
</strong>
header('Content-Length: 1234');

<strong>// Headers for an download:</strong>
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="example.zip"');
header('Content-Transfer-Encoding: binary');

   <strong>// load the file to send:</strong>

readfile('example.zip');

<strong>// Disable caching of the current document:

</strong> header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');

header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past

header('Pragma: no-cache');

<strong>// set content type:</strong>

header('Content-Type: text/html; charset=iso-8859-1');

header('Content-Type: text/html; charset=utf-8');

header('Content-Type: text/plain'); // plain text file

header('Content-Type: image/jpeg'); // JPG picture

header('Content-Type: application/zip'); // ZIP file

header('Content-Type: application/pdf'); // PDF file

header('Content-Type: audio/mpeg'); // Audio MPEG (MP3,...) file

header('Content-Type: application/x-shockwave-flash'); // Flash animation

<strong>// show sign in box</strong>

header('HTTP/1.1 401 Unauthorized');

header('WWW-Authenticate: Basic realm="Top Secret"');

print 'Text that will be displayed if the user hits cancel or ';

<strong>// Headers for an download:</strong>
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="example.zip"');
header('Content-Transfer-Encoding: binary');
<strong>// load the file to send:</strong>
readfile('example.zip');</pre>
<p>本文由 <a title="nixway.net" href="http://www.nixway.net/">nixway.net</a> 整理</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nixway.net/blog/archives/463/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

