The Dr of LVs series (II.)

Source: Internet
Author: User

Load Cluster LVS_DR Model Principle :

ClientCipRequestWebresources, must go throughDirectorforwarded toRs, whileRsresponding to a request to a clientCipmust not go throughDirectorbecause the client's request was sent to theVipto respond to requests from the client, which requiresDirectorand theRsto share betweenVip. Directorof theDIP,RS1of theRIP1,RS2of theRIP2must be in the same network segment, either public or private, communication between them is based onMacaddress. RsIt's better to have a public network.Ip, or out of the gateway there are many, otherwise the single gateway is easy to become the bottleneck of the cluster. BecauseDirectorand theRshave the sameVip, so you have toRsdo someArplimits so that they cannot answerArpbroadcast, just putVipfor packet data responseCipTo ensure that all theRsrequests for resources on the resource must go through theDirectorload-balanced allocations.

Simulation process:

client cip send access web Vip; Request arrives Switch arp broadcast: who's Vip? arp limitation makes it impossible to answer, so only director answered: I am Vip so Switch Director

Source Ip

Target Ip

Cip

Director 's vip:172.16.58.1

The director selects the RS1 through the load Balancing algorithm , because the director 's DIP and RS1 RIP1 are in the same network segment, and they can be MAC address, the destination MAC address of the data frame is changed to RS1 's mac address so that the data frame is sent to the RS1, the source IP and target IP does not change

Rs1 The requested Web Resource encapsulation responds directly to Cip ip Rip1 rs1 native Lo:0 vip CIP

Source Ip

Target Ip

VIP on the lo:0 of RS1:172.16.58.1

Cip

This completes a communication

Lab Environment Preparation:

A physical routing host 172.16.0.1 that can communicate with the external network is required . Three virtual machines, one Director, one RS1, one RS2, and the NIC connection mode are all selected for bridging.

" Span style= "color: #2C2C2C; background: #FFFFFF;" >director: load Balancer Scheduler

         VIP : 172.16.58.1

         DIP : 172.16.58.2

rs1: real web server 1

          RIP1 : 172.16.58.7

vip : 172.16.58.1

rs2: real web server 2

          RIP1 : 172.16.58.8

vip : 172.16.58.1

Actual combat configuration:

RS1 the configuration:

# Set RIP1

Ifconfig eth0 172.16.58.7 up

# Set VIP

Ifconfig lo:0 172.16.58.1 netmask 255.255.255.255 broadcast172.16.58.1 up

# View

Ifconfig

# Setting the response level and notification level for ARP

Echo 1 >/proc/sys/net/ipv4/conf/all/arp_ignore

Echo 2 >/proc/sys/net/ipv4/conf/all/arp_announce

Echo 1 >/proc/sys/net/ipv4/conf/lo/arp_ignore

Echo 2 >/proc/sys/net/ipv4/conf/lo/arp_announce

# Add Route

Route Add–host 172.16.58.1 devlo:0

# synchronizing time from the server

Ntpdate 172.16.0.1

RS2 the configuration:

# Set RIP2

Ifconfig eth0 172.16.58.8 up

# Set VIP

ifconfiglo:0 172.16.58.1 netmask 255.255.255.255 broadcast172.16.58.1 up

# View

Ifconfig

# Setting the response level and notification level for ARP

Echo 1 >/proc/sys/net/ipv4/conf/all/arp_ignore

Echo 2 >/proc/sys/net/ipv4/conf/all/arp_announce

Echo 1 >/proc/sys/net/ipv4/conf/lo/arp_ignore

Echo 2 >/proc/sys/net/ipv4/conf/lo/arp_announce

permanent effect requires modification configuration file: /etc/sysctl.conf

Net.ipv4.conf.eth0.app_ignore = 1

Net.ipv4.conf.eth0.app_announce = 2

Net.ipv4.conf.all.arp_ignore = 1

Net.ipv4.conf.all.arp_announce = 2

sysctl–p make configuration effective

# Add Route

Route Add–host 172.16.58.1 devlo:0

# synchronizing time from the server

Ntpdate 172.16.0.1

Director settings for:

# Set VIP

Ifconfig eth0:0 172.16.58.1 GW 172.16.0.1 Up

# Set DIP

Ifconfig eth0 172.16.58.2 up

# Clear iptables rule

Iptales-f

Service Iptales Save

# Add a Cluster service

Ipvsadm–a–t 172.16.58.1:80–s WLC

# Add Real server RS1,RS2

Ipvsadm–a–t 172.16.58.1:80–r 172.16.58.7–g–w 2

Ipvsadm–a–t 172.16.58.1:80–r 172.16.58.8–g–w 1

# synchronizing time from the server

Ntpdate 172.16.0.1

# Browser Access Test

Browser Access 172.16.58.1 , constantly refreshed


This article from the "source clean is clear, the shape of the end of the shadow straight" blog, please be sure to keep this source http://zhouxt.blog.51cto.com/8743763/1641604

The Dr of LVs series (II.)

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.