LVS-DR experiment in UbuntuServer10.4

Source: Internet
Author: User
Target: Server Load balancer LVS (ip: 192.168.3.10, virtual IP: 192.168.3.100), rs2 (ip: 192.168.3.20), rs3 (ip: 192.168.3.30 ), one block is installed on all three machines, and apache is installed on the machine. Access http: // 192.168.3.100 on a client cs (ip Address: 192.168.3.1). The experiment is successful if two instances are accessed in turn. 1. Configure the target LVS server: Server Load balancer LVS (ip: 192.168.3.10, virtual IP: 192.168.3.100), and rs2 (ip: 192.168.3.20 ), rs3 (ip address 192.168.3.30). All three machines have a network block installed and apache is installed on the instance. Access http: // 192.168.3.100 on a client cs (ip Address: 192.168.3.1). The experiment is successful if two instances are accessed in turn.

1. Configure The LVS machine:

Ubuntu Server 10.4 does not have the ipvsadm package installed by default. I have read many tutorials on the Internet and want to edit the kernel. But now 2.6.32 does not need to be edited.

# Sudo apt-get install ipvsadm

Will prompt please run dpkg-reconfigure ipvsadm

# Sudo dpkg-reconfigure ipvsadm (dpkg and-reconfigure are connected together without spaces)

# Sudo ifconfig eth0: 0 192.168.3.100 netmask 255.255.255.255 broadcast 192.168.3.100
# Sudo route add-host 192.168.3.100 dev eth0: 0
# Sudo ipvsadm-A-t 192.168.3.100: 80-s rr
# Sudo ipvsadm-a-t 192.168.3.100: 80-r 192.168.3.20-g
# Sudo ipvsadm-a-t 192.168.3.100: 80-r 192.168.3.30-g
# Sudo ipvsadm-save
*: Here, rr indicates polling among the eight algorithms of ipvsadm. The experiment selects this algorithm, and the effect is obvious. -G is the LVS-DR mode among the three modes of lvs. -I is the channel LVS-TUN. why is the broadcast of eth0: 0 its IP address, because its netmask is/32. (the VIP is a/32 addr, so the brd addr is the VIP, not x. x. x.255 .)
Modify/etc/sysctl. conf
Net. ipv4.ip _ forward = 0
Net. ipv4.conf. all. send_redirects = 1
Net. ipv4.conf. default. send_redirects = 1
Net. ipv4.conf. eth0.send _ redirects = 1
# Sudo sysctl-p
2. Configure the real-machine rs2 and rs3 as follows:
# Sudo ifconfig lo: 0 192.168.3.100 netmask 255.255.255.255 broadcast 192.168.3.100
# Sudo route add-host 192.168.3.100 dev lo: 0
Modify/etc/sysctl. conf
Net. ipv4.ip _ forward = 0
Net. ipv4.conf. lo. arp_ignore = 1
Net. ipv4.conf. lo. arp_announce = 2
Net. ipv4.conf. all. arp_ignore = 1
Net. ipv4.conf. all. arp_announce = 2
# Sudo sysctl-p
Change the index.html content of rs2, rs3 under/var/wwwto "this is rs2", "this is rs3". When you access the time zone, do not access the machine, check whether the experiment is successful.

During the experiment: At the beginning, no changes were made to the/etc/sysctl under rs2 and rs3. conf: when accessing http: // 192.168.3.100, rs2, rs3 can be accessed in turn, sometimes not. After modification, it is found that the effect is good and the experiment goal is achieved.

Why modify can refer to the following ARP, but also specifically explained in the LVS-DR mode ARP problem and how to solve the ARP problem, also has the specific meaning of arp_ingnore, arp_announce.

To learn LVS in depth, you must look at this LVS-HOWTO
*:
In the firefox browser, enter "about: config" in the address bar and find "network. http. keep-alive" and set "false" to view the experiment results.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.