<?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>Hello, SA &#187; lvs</title>
	<atom:link href="http://blog.helosa.org/tag/lvs/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.helosa.org</link>
	<description>Linux System Administrator</description>
	<lastBuildDate>Tue, 31 Jan 2012 08:28:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>ubuntu 下的lvs tunnel real server 配置注意</title>
		<link>http://blog.helosa.org/2011/09/03/ubuntu-lvs-tunnel-rs.html</link>
		<comments>http://blog.helosa.org/2011/09/03/ubuntu-lvs-tunnel-rs.html#comments</comments>
		<pubDate>Fri, 02 Sep 2011 17:03:55 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[lvs]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=423</guid>
		<description><![CDATA[来个速记。 以前就因为一次内网调整，使用了一次lvs 的tunnel 模式，后来都没有配置过了，今天因为要配置外网的lvs ，再次弄了一下，才发现要注意一下了。 DR 模式下的rs 配置一般如下： /sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up echo &#8220;1&#8243; &#62;/proc/sys/net/ipv4/conf/lo/arp_ignore echo &#8220;2&#8243; &#62;/proc/sys/net/ipv4/conf/lo/arp_announce echo &#8220;1&#8243; &#62;/proc/sys/net/ipv4/conf/all/arp_ignore echo &#8220;2&#8243; &#62;/proc/sys/net/ipv4/conf/all/arp_announce tunnel 的话，可以改成这样： /sbin/ifconfig tunl0 $VIP broadcast $VIP netmask 255.255.255.255 up echo &#8220;1&#8243; &#62;/proc/sys/net/ipv4/conf/lo/arp_ignore echo &#8220;2&#8243; &#62;/proc/sys/net/ipv4/conf/lo/arp_announce echo &#8220;1&#8243; &#62;/proc/sys/net/ipv4/conf/all/arp_ignore echo &#8220;2&#8243; &#62;/proc/sys/net/ipv4/conf/all/arp_announce 直接执行的话，可能会出现以下错误（反正那个死人坑爹的ubuntu 出现了！！！还是得找机会换了它。。。） SIOCSIFADDR: No such [...]]]></description>
			<content:encoded><![CDATA[<p>来个速记。</p>
<p>以前就因为一次内网调整，使用了一次lvs 的tunnel 模式，后来都没有配置过了，今天因为要配置外网的lvs ，再次弄了一下，才发现要注意一下了。</p>
<p>DR 模式下的rs 配置一般如下：</p>
<div id="_mcePaste">/sbin/ifconfig lo:0 $VIP broadcast $VIP netmask 255.255.255.255 up</div>
<div id="_mcePaste"></div>
<div id="_mcePaste">echo &#8220;1&#8243; &gt;/proc/sys/net/ipv4/conf/lo/arp_ignore</div>
<div id="_mcePaste">echo &#8220;2&#8243; &gt;/proc/sys/net/ipv4/conf/lo/arp_announce</div>
<div id="_mcePaste">echo &#8220;1&#8243; &gt;/proc/sys/net/ipv4/conf/all/arp_ignore</div>
<div id="_mcePaste">echo &#8220;2&#8243; &gt;/proc/sys/net/ipv4/conf/all/arp_announce</div>
<div></div>
<div>tunnel 的话，可以改成这样：</div>
<div>
<div>/sbin/ifconfig tunl0 $VIP broadcast $VIP netmask 255.255.255.255 up</div>
<div></div>
<div>echo &#8220;1&#8243; &gt;/proc/sys/net/ipv4/conf/lo/arp_ignore</div>
<div>echo &#8220;2&#8243; &gt;/proc/sys/net/ipv4/conf/lo/arp_announce</div>
<div>echo &#8220;1&#8243; &gt;/proc/sys/net/ipv4/conf/all/arp_ignore</div>
<div>echo &#8220;2&#8243; &gt;/proc/sys/net/ipv4/conf/all/arp_announce</div>
</div>
<div></div>
<div>直接执行的话，可能会出现以下错误（反正那个死人坑爹的ubuntu 出现了！！！还是得找机会换了它。。。）</div>
<div>
<div>SIOCSIFADDR: No such device</div>
<div>tunl0: ERROR while getting interface flags: No such device</div>
<div>SIOCSIFNETMASK: No such device</div>
</div>
<div></div>
<div>竟然不能建立tun 设备！！</div>
<div></div>
<div>好吧，tun 设备作为module 了，没有编译进去内核@@</div>
<div></div>
<div>modprobe ipip 即可。</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2011/09/03/ubuntu-lvs-tunnel-rs.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>kernel 2.6.32 的服务器作为lvs 的rs 无法建立tcp 连接的问题</title>
		<link>http://blog.helosa.org/2011/02/23/kernel-2-6-32-lvs-rs.html</link>
		<comments>http://blog.helosa.org/2011/02/23/kernel-2-6-32-lvs-rs.html#comments</comments>
		<pubDate>Wed, 23 Feb 2011 10:21:21 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lvs]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=378</guid>
		<description><![CDATA[最近用xen 的虚拟机作为lvs 的rs 组了一下lvs ，发现上线以后，无法与client 建立tcp 连接，开始还以为是xen 的bridge 网络的问题，后来才把问题定位到系统内核。其实之前也出现过类似的问题的，但当时急着上线，没去研究了，这回太忙，连测试环境都搭出来了，也都没空去深究，今天同事帮我测试了一下，倒是完全明白了。 问题描述： LVS 用dr 的方式组起来以后，访问vip 时，无法与real server 建立tcp 连接。tcpdump 看到只有client 过来的syn 包，rs 并不返回ack 包，根本无法完成tcp 握手。用curl 来模拟访问测试的话，会看到这样的返回 curl: (7) couldn&#8217;t connect to host 。 看看我的配置吧。 lvs director ： 采用dr 的调度方式，通过内网把请求分配到real server lvs 的 real server ： 内核为 2.6.32-5-amd64 （2.6.32 这个内核很普遍了，debian 6 和 rhel 6 默认都这个了），不响应arp 配置 echo &#8220;1&#8243; &#62;/proc/sys/net/ipv4/conf/lo/arp_ignore echo &#8220;2&#8243; [...]]]></description>
			<content:encoded><![CDATA[<p>最近用xen 的虚拟机作为lvs 的rs 组了一下lvs ，发现上线以后，无法与client 建立tcp 连接，开始还以为是xen 的bridge 网络的问题，后来才把问题定位到系统内核。其实之前也出现过类似的问题的，但当时急着上线，没去研究了，这回太忙，连测试环境都搭出来了，也都没空去深究，今天同事帮我测试了一下，倒是完全明白了。</p>
<p>问题描述：</p>
<p>LVS 用dr 的方式组起来以后，访问vip 时，无法与real server 建立tcp 连接。tcpdump 看到只有client 过来的syn 包，rs 并不返回ack 包，根本无法完成tcp 握手。用curl 来模拟访问测试的话，会看到这样的返回 curl: (7) couldn&#8217;t connect to host 。</p>
<p>看看我的配置吧。</p>
<p>lvs director ：</p>
<p>采用dr 的调度方式，通过内网把请求分配到real server</p>
<p>lvs 的 real server ：</p>
<p>内核为 2.6.32-5-amd64 （2.6.32 这个内核很普遍了，debian 6 和 rhel 6 默认都这个了），不响应arp 配置</p>
<div id="_mcePaste">echo &#8220;1&#8243; &gt;/proc/sys/net/ipv4/conf/lo/arp_ignore</div>
<div id="_mcePaste">echo &#8220;2&#8243; &gt;/proc/sys/net/ipv4/conf/lo/arp_announce</div>
<div id="_mcePaste">echo &#8220;1&#8243; &gt;/proc/sys/net/ipv4/conf/all/arp_ignore</div>
<div id="_mcePaste">echo &#8220;2&#8243; &gt;/proc/sys/net/ipv4/conf/all/arp_announce</div>
<p>其它基本的配置就不说了，如果就这样子起服务后，就会出现我描述的问题了。</p>
<p>原因在于内核的这个参数 : reverse path filtering，这个是啥，我摘抄一下：</p>
<p>Reverse Path Filtering (RPF) is a technology that is used on InternetProtocol routers to try and prevent source address spoofing, which is often used for DenialOfService attacks. RPF works by checking the source IP of each packet received on an interface against the routing table. If the best route for the source IP address does not use the same interface that the packet was received on the packet is dropped. There are some situations where this feature will obviously not be the desired behaviour and will need to be disabled. In general if you are not multi-homed then enabling RPF on your router will not be a problem.</p>
<p>简单地说，就是如果从eth1 接收到包，就不会从eth0 返回，内核把这个包丢弃。</p>
<p>正好我们的LVS 就是这样的服务模式，lvs director 接收到client 对vip 的访问，经过包的重写通过内网把包分配给rs ，rs 直接使用外网返回这个client 的请求。正好就会被rp_filter 给干掉了。</p>
<p>但是，为什么我们以前并没有出现过类似的问题呢？？看看rp_filter 的默认内核配置</p>
<p>net.ipv4.conf.eth1.rp_filter = 1</p>
<p>net.ipv4.conf.eth0.rp_filter = 1</p>
<p>net.ipv4.conf.lo.rp_filter = 0</p>
<p>net.ipv4.conf.default.rp_filter = 1</p>
<p>net.ipv4.conf.all.rp_filter = 0</p>
<p>rp_filter 的值的意义是：</p>
<p>814<span style="white-space: pre;"> </span>rp_filter &#8211; INTEGER</p>
<p>815<span style="white-space: pre;"> </span>0 &#8211; No source validation.</p>
<p>816<span style="white-space: pre;"> </span>1 &#8211; Strict mode as defined in RFC3704 Strict Reverse Path</p>
<p>817<span style="white-space: pre;"> </span> Each incoming packet is tested against the FIB and if the interface</p>
<p>818<span style="white-space: pre;"> </span> is not the best reverse path the packet check will fail.</p>
<p>819<span style="white-space: pre;"> </span> By default failed packets are discarded.</p>
<p>820<span style="white-space: pre;"> </span>2 &#8211; Loose mode as defined in RFC3704 Loose Reverse Path</p>
<p>821<span style="white-space: pre;"> </span> Each incoming packet&#8217;s source address is also tested against the FIB</p>
<p>822<span style="white-space: pre;"> </span> and if the source address is not reachable via any interface</p>
<p>823<span style="white-space: pre;"> </span> the packet check will fail.</p>
<p>0 就是对进来的包完全不作检查，这样有被dos 攻击的风险。</p>
<p>1 就是严格检查，只要不是这个interface 的包，就不返回。</p>
<p>2 就是不太严格，只要本机配置了这个ip ，还是可以返回的。</p>
<p>对于lvs 来说，用2 也是可以的。</p>
<p>只要把eth1 的 rp_filter 的值置为 0 ，lvs 的服务就能正常了。</p>
<p>从这里可以找到答案：http://www.spinics.net/lists/linux-net/msg17162.html</p>
<p>The first patch changed rp_filter from a boolean to an integer, and the</p>
<p>second patch changed the way the interface-specific value and the &#8220;all&#8221;</p>
<p>value are combined to produce a functional value from a logical AND to</p>
<p>an arithmetic MAX.</p>
<p>Before patches : functional value = interface AND all</p>
<p>After patches  : functional value = MAX(interface, all)</p>
<p>So now if net.ipv4.conf.all.rp_filter=1, source validation is enabled on</p>
<p>all interfaces as their functional value is at least 1. You may either</p>
<p>set net.ipv4.conf.all.rp_filter to 0 (to disable it) or 2 (to enable</p>
<p>loose mode globally), or set net.ipv4.conf.$interface.rp_filter to 2 (to</p>
<p>enable loose mode on $interface).</p>
<p>I guess that the patch suggested by Dave Miller is related to another</p>
<p>(apparently incomplete) change that occured in 2.6.32 :</p>
<p>在2.6.31 , 对于rp_filter 的最终值，有了不同的计算方法。</p>
<p>之前，是只要设置了all.rp_filter 为0 ，那么就是0 了。</p>
<p>之后，看具体的interface 和 all 的值的最大值来取最终值。</p>
<p>默认是 net.ipv4.conf.eth1.rp_filter = 1 和 net.ipv4.conf.all.rp_filter = 0 ，因此，组lvs 的时候，就会丢弃包了。</p>
<p>问题解决！！下次调一下内核参数吧。</p>
<p>PS：可以通过设置这个内核参数来查看一下log</p>
<p>echo 1 &gt;/proc/sys/net/ipv4/conf/&lt;interfacename&gt;/log_martians</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2011/02/23/kernel-2-6-32-lvs-rs.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>LVS hash size</title>
		<link>http://blog.helosa.org/2010/03/31/lvs-hash-size.html</link>
		<comments>http://blog.helosa.org/2010/03/31/lvs-hash-size.html#comments</comments>
		<pubDate>Wed, 31 Mar 2010 11:20:55 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[lvs]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=203</guid>
		<description><![CDATA[LVS 有个 connection hash table ，默认的 size 为 4096，可以通过以下命令得到： # ipvsadm -ln IP Virtual Server version 1.0.12 (size=4096) 简单地说，这个hash table 用于记录每个进来的连接及路由去向的信息。面对庞大的连接时，这个4096是远远不够的，这时就会产生冲突，然后hash table  就不断置换table 中的数据，系统的负荷就这样上来了。所以，很多调优文章都说，要把这个值调大。至于如何调大呢，好像必须重编译内核了。。。 我的是 centos 5.4 final ，利用 srpm 去重编译吧，使用当前系统的 config ，这样编译后的内核只不过是改变了 hash table 的值，并没有改变其它的东西。 下一个 kernel 的 srpm ：http://mirrors.163.com/centos/5.4/os/SRPMS/kernel-2.6.18-164.el5.src.rpm 重编内核时，把原来的 config（/boot/config-2.6.18-164.el5） copy 覆盖 SOURCES/kernel-2.6.18-x86_64.config . 把第一行的 # 改为 # x86_64 同时，修改 CONFIG_IP_VS_TAB_BITS=12 （2的12次方，4096）为 [...]]]></description>
			<content:encoded><![CDATA[<p>LVS 有个 connection hash table ，默认的 size 为 4096，可以通过以下命令得到：</p>
<p># ipvsadm -ln<br />
IP Virtual Server version 1.0.12 (size=4096)</p>
<p>简单地说，这个hash table 用于记录每个进来的连接及路由去向的信息。面对庞大的连接时，这个4096是远远不够的，这时就会产生冲突，然后hash table  就不断置换table 中的数据，系统的负荷就这样上来了。所以，很多调优文章都说，要把这个值调大。至于如何调大呢，好像必须重编译内核了。。。</p>
<p>我的是 centos 5.4 final ，利用 srpm 去重编译吧，使用当前系统的 config ，这样编译后的内核只不过是改变了 hash table 的值，并没有改变其它的东西。</p>
<p>下一个 kernel 的 srpm ：http://mirrors.163.com/centos/5.4/os/SRPMS/kernel-2.6.18-164.el5.src.rpm</p>
<p>重编内核时，把原来的 config（/boot/config-2.6.18-164.el5） copy 覆盖 SOURCES/kernel-2.6.18-x86_64.config .</p>
<p>把第一行的</p>
<p>#</p>
<p>改为</p>
<p># x86_64</p>
<p>同时，修改 CONFIG_IP_VS_TAB_BITS=12 （2的12次方，4096）为 CONFIG_IP_VS_TAB_BITS=20 。</p>
<p>然后 rpmbuild -ba &#8211;target=`uname -m` kernel-2.6.spec ，新编译出来的kernel-2.6.18-164.el5.x86_64.rpm 就在 RPMS/x86_64/ 里了。</p>
<p>rpm -Uvh 吧。</p>
<p>reboot 后，再 ipvsadm -ln 就可以看到</p>
<p>IP Virtual Server version 1.2.1 (size=1048576)</p>
<p>成功！<br />
lvs 调优的文章通常会说，如果你的并发连接数是 200，keep alive 是200秒，那么hash table size 就应该设置为不要低于 200&#215;200=40000 太多，2的15次方32768 就差不多了。不过，谁知道我们的需求是否会变呢？我一般都懒得算，直接开到最大，20 就是最大的了。</p>
<p>还需要注意一点，就是每个连接是要占用内存的，印象中是每个连接占用136 bytes ，尽管说 lvs 可以抗百万级别的连接，也要注意有没有足够的内存哦，呵呵。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/03/31/lvs-hash-size.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>利用 piranha 快速搭建 lvs</title>
		<link>http://blog.helosa.org/2010/03/18/piranha-lvs.html</link>
		<comments>http://blog.helosa.org/2010/03/18/piranha-lvs.html#comments</comments>
		<pubDate>Thu, 18 Mar 2010 13:04:15 +0000</pubDate>
		<dc:creator>Chan Cham Chung</dc:creator>
				<category><![CDATA[technology]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lvs]]></category>

		<guid isPermaLink="false">http://blog.helosa.org/?p=191</guid>
		<description><![CDATA[最近为那个公司很重视的项目搭建 lvs ，在这里 log 一下吧。 利用red hat 提供的 piranha ，简单快捷。 我选择的是 centos 5.4 ，安装 piranha ，很简单 yum install piranha 此时，它还需要你安装 ipvsadm , php , php-cli , php-common , httpd ，piranha 是一个 web 管理的工具，没办法，虽然我不用web 界面，但这些在yum 下还是必须装上的。 装完以后，/etc/sysconfig/ha/lvs.cf 还是空的，我去抄一份过来。 serial_no = 1 primary = 60.12.227.1 service = lvs backup_active = 1 backup = 60.12.227.2 heartbeat = 1 [...]]]></description>
			<content:encoded><![CDATA[<p>最近为那个公司很重视的项目搭建 lvs ，在这里 log 一下吧。</p>
<p>利用red hat 提供的 piranha ，简单快捷。</p>
<p>我选择的是 centos 5.4 ，安装 piranha ，很简单</p>
<p>yum install piranha</p>
<p>此时，它还需要你安装 ipvsadm , php , php-cli , php-common , httpd ，piranha 是一个 web 管理的工具，没办法，虽然我不用web 界面，但这些在yum 下还是必须装上的。</p>
<p>装完以后，/etc/sysconfig/ha/lvs.cf 还是空的，我去抄一份过来。</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">serial_no = 1
primary = 60.12.227.1
service = lvs
backup_active = 1
backup = 60.12.227.2
heartbeat = 1
heartbeat_port = 10001
keepalive = 6
deadtime = 18
network = direct
debug_level = NONE
virtual vs[1] {
    active = 1
    address = 60.12.227.200 eth0:200
    vip_nmask = 255.255.255.0
    port = 80
    send = &quot;GET / HTTP/1.0\r\n\r\n&quot;
    expect = &quot;HTTP&quot;
    use_regex = 0
    load_monitor = none
    scheduler = wlc
    protocol = tcp
    timeout = 6
    reentry = 15
    quiesce_server = 0
    server rs[1] {
    address = 192.168.0.1
        active = 1
        weight = 2
    }
    server rs[2] {
    address = 192.168.0.2
        active = 1
        weight = 2
    }
}</pre></div></div>

<p>到此，lvs 的 director 端，算是安装完成了。</p>
<p>有人会问了，为什么我没有修改 /proc/sys/net/ipv4/ip_forward 为1 。其实，这里我也还不是很懂，理论上，转发是必须设为1 的，但我发现，貌似不设，也可以正常工作，难道是 piranha 的关系？？</p>
<p>然后就是配置 real server 端了。</p>
<p>我又抄一个shell 过来</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">VIP</span>=60.12.227.200
<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ifconfig</span> lo:<span style="color: #000000;">0</span> <span style="color: #007800;">$VIP</span> broadcast <span style="color: #007800;">$VIP</span> netmask 255.255.255.255 up
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;1&quot;</span>  <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>ipv4<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>lo<span style="color: #000000; font-weight: bold;">/</span>arp_ignore
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;2&quot;</span>  <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>ipv4<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>lo<span style="color: #000000; font-weight: bold;">/</span>arp_announce
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;1&quot;</span>  <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>ipv4<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>all<span style="color: #000000; font-weight: bold;">/</span>arp_ignore
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;2&quot;</span>  <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>sys<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>ipv4<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>all<span style="color: #000000; font-weight: bold;">/</span>arp_announce</pre></div></div>

<p>由于我的director 端配置的是 dr 模式，所以必须关闭arp 响应。</p>
<p>执行一下这个shell，real server 端也算是完成了。</p>
<p>启动 director 端：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># /etc/init.d/pulse start</span>
Starting pulse:                                            <span style="color: #7a0874; font-weight: bold;">&#91;</span>  OK  <span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>查看服务状态：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ipvsadm -ln</span>
&nbsp;
IP Virtual Server version 1.2.1 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">size</span></span>=<span style="color: #000000;">4096</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
Prot LocalAddress:Port Scheduler Flags
-<span style="color: #000000; font-weight: bold;">&gt;</span> RemoteAddress:Port           Forward Weight ActiveConn InActConn
TCP  60.12.227.200:<span style="color: #000000;">80</span> wlc
-<span style="color: #000000; font-weight: bold;">&gt;</span> 192.168.0.1:<span style="color: #000000;">80</span>             Route   <span style="color: #000000;">2</span>      <span style="color: #000000;">326</span>        <span style="color: #000000;">172</span>
-<span style="color: #000000; font-weight: bold;">&gt;</span> 192.168.0.2:<span style="color: #000000;">80</span>             Route   <span style="color: #000000;">2</span>      <span style="color: #000000;">326</span>        <span style="color: #000000;">192</span></pre></div></div>

<p>搭建完成了，算是比较快速的了，呵呵。还有一点知识点的，下回再说吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.helosa.org/2010/03/18/piranha-lvs.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

