Realization of LVS-NAT and LVS-DR model of Linux Virtual Server

Source: Internet
Author: User
LVS-NAT :( Linux virtual server) platform: VMwareACEEdition (Version: 6.05) IMGAGE: RedHatEnterpriseLinux5 --------------------------------------------------- LVS-NAT: (Linux virtual server)

Platform: VMware ACE Edition (Version: 6.05) IMGAGE: Red Hat Enterprise Linux 5

------------------------------------------------------------------
DIRECTOR:
VIP: 192.160.0.40 // eth0: 0
DIP: 172.16.10.10
REALSERVER:
RSever1 vip: 192.168.0.40 // lo: 0
RSever2 vip
: 192.168.0.40 // lo: 0
The architecture is as follows:
------------------------------------------------------------------
  1. Director: yum install ipvsadm
  2. RServer1: yum install mysql-server php-SQL php-mbsring
  3. RServer2: yum install mysql-server php-SQL php-mbsring
  4. RServer1: vim/var/www/html/index RealServer TestPage1
  5. RServer1: vim/var/www/html/index RealServer TestPage2
  6. Service httpd start
  7. Director: cat/proc/sys/net/ipv4/ip_forward
  8. Echo1>! $// Enable the ICMP forwarding function
  9. Director: ipvsadm-A-t192.168.0.40-S rr
  10. Ipvsadm-L-n
  11. Director: ipvsadm-a-t192.168.0.40:80-R172.16.10.11-M
  12. Ipvsadm-a-t192.168.0.40:80-R172.16.10.12-M

Test:


========================================================== ========================================================== ==========

LVS-DR: DR Model
1. All bridges are connected to a vswitch.
2. In order to avoid interference from the VIP's response to the host, we set the VIP address on the REALSERVER's LOOP interface on the REALSERVER.
The source address is always the best IP address, so the IP address from the REALSERVER is the LOOP interface VIP, which adds a host route based on the response.

Director:
RIP needs to be configured on the interface, and VIP needs to be configured on the LO alias.
1. Configure VIP
# Ifconfig lo: 0 $ vip broadcast $ vip netmask 255.255.255.255
# Route add-host $ vip dev eth0: 0
Echo 1>/proc/sys/net/ipv4/ip_forward
2. Define the cluster service // last congure

REALSERVER:
RIP needs to be configured on the interface, and VIP needs to be configured on the LO alias:
1. Define kernel parameters to prohibit responses to ARP broadcast requests to VIP addresses:
Echo 1>/proc/sys/net/ipv4/conf/lo/arp_igonre
Echo 2>/proc/sys/net/ipv4/conf/lo/arp_announce
Echo 1>/proc/sys/net/ipv4/conf/all/arp_igonre
Echo 2>/proc/sys/net/ipv4/conf/all/arp_announce
2. Configure VIP
# Ifconfig lo $ VIP broadcast $ VIP netmask 255.255.255.255 up
# Route ad-host $ VIP dev lo: 0
3. Configure the startup service as a cluster service
Related Article

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.