LVS Load balancer address translation using polling algorithm experiment (end code in mind)

Source: Internet
Author: User

地址转换模式:调度服务器有双网卡,做NAT映射,请求经过调度服务器,也是各个节点服务器回应客户机的出口,可作用于私网,较安全。

Experimental thinking and environment

One, the dispatch server configures the dual network card, does the gateway, requests the traffic as well as forwards the traffic to go to dispatch the server to go

Second, the resource server both provide Web services, in order to test, the contents of the two are not the same
IP:192.168.10.10/24 httpd Service
IP:192.168.10.20/24 httpd Service

Third, Remote Storage devices
Use NFS for Remote Storage and memory support for resource servers

图解如下

1、安装ipvsadm包yum install ipvsadm2、调度服务器虚拟机配置双网卡,设置ip

3、清防火墙规则表,开启路由转发功能,并写入规则

vim /etc/sysctl.conf



4、加载内核,  并启动管理工具      modprode ip_vs

5、写入轮询规则


=======================================================提供出一个简易的网页,开启httpd服务的内容就不在赘述========================================================

Page content is as follows

======================================================NFS服务如何搭建请参考我的另一篇博客http://blog.51cto.com/13760226/2148122=========================================================the end 直接访问网关,验证结果


The experiment code is recorded with

One, Remote Storage server NFS
---Edit the configuration file----
Vi/etc/exports
/usr/share * (Ro,sync)
/opt/benet 192.168.100.0/24 (Rw,sync)
/OPT/ACCP 192.168.100.0/24 (Rw,sync)

Exportfs-rv

---client view, mount----
SHOWMOUNT-E 192.168.100.103
Mount.nfs 192.168.100.103:/opt/benet/var/www/html
Mount.nfs 192.168.100.103:/opt/accp/var/www/html

Second, install HTTPD Linux on the resource server six or seven random
Provide a service, not repeat

Third, install IPVSADM on the dispatch server

Rpm-q ipvsadm//Check Ipvsadm bag

Yum install IPVSADM//load Balanced Package

Iptables-f

Iptables-t nat-f//Clear table

Vim/etc/sysctl.conf

Net.ipv4.ip_forward=1/Turn on the route forwarding function

Iptables-t nat-a postrouting-o ens36-s 192.168.10.0/24-j SNAT--to-source 12.0.0.1//write firewall rules

Modprode ip_vs//load kernel

Cat/proc/net/ip_vs

Ipvsadm--save >/etc/sysconf/ipvsadm//7 First save on startup

Systemctl Start Ipvsadm/start

Systemctl Status Ipvsadm.service//Check service has no boot

vim/opt/nat.sh//write command script
#!/bin/bash
Ipvsadm-c
Ipvsadm-a-T 12.0.0.1:80-s RR
Ipvsadm-a-T 12.0.0.1:80-r 192.168.10.10:80-m
Ipvsadm-a-T 12.0.0.1:80-r 192.168.10.20:80-m
Ipvsadm

LVS Load balancer address translation using polling algorithm experiment (end code in mind)

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.