Load Balancing in network address translation mode under RedHat

Source: Internet
Author: User
First, the working principle of Server Load balancer in network address translation mode: the client accesses the director machine, and the director machine sends client requests to the real server, and then the real server responds to the director machine, the director machine then returns the response to the client. This low efficiency is generally only applicable to small enterprises. Experiment environment: two host servers: 192.168.0.11 and 192.168.0.12 (the server is in the same Intranet network segment

First, the working principle of Server Load balancer in network address translation mode: the client accesses the director machine, and the director machine sends client requests to the real server, and then the real server responds to the director machine, the director machine then returns the response to the client. This low efficiency is generally only applicable to small enterprises.

Experiment environment: two host servers: 192.168.0.11 and 192.168.0.12 (the server is in the same Intranet segment)
Medium transfer (two NICS): 192.168.0.13 and 192.168.513
Client: 192.168.5.10
(The host name must be consistent with the IP address. Iptables: clear -- iptables-F. Selinux disabled)

Tutorial steps:
A. Server:
1. 192.168.0.11
# Yum install-y httpd
# Service httpd start
# Echo "192.168.0.11">/var/www/html/index.html
# Route add default gw 192.168.0.13
2. 192.168.0.12
# Yum install-y httpd
# Service httpd start
# Echo "192.168.0.12">/var/www/html/index.html
# Route add default gw 192.168.0.13
B. Intermediate transfer:
1. Install the ipvs service:
# Yum clean all
# Yum install-y ipvsadm
2. Enable the ip forwarding function and disable other services.
# Echo "1">/proc/sys/net/ipv4/ip_forward
# Echo "0">/proc/sys/net/ipv4/conf/all/send_redirects
# Echo "0">/proc/sys/net/ipv4/conf/default/send_redirects
# Echo "0">/proc/sys/net/ipv4/conf/eth0/send_redirects
# Echo "0">/proc/sys/net/ipv4/conf/eth1/send_redirects
3. Set transfer:
Vim setNet
/Sbin/ipvsadm-C
/Sbin/ipvsadm-A-t 192.168.5.13: 80-s rr
/Sbin/ipvsadm-a-t 192.168.5.13: 80-r 192.168.0.11: 80-m-w 1
/Sbin/ipvsadm-a-t 192.168.5.13: 80-r 192.168.0.12: 80-m-w 1
/Sbin/ipvsadm

#./SetNet

C. Client:
1. Add IP addresses of 5 CIDR blocks
# Ifconfig eth0: 5 192.168.5.10
# Ping 192.168.5.13
2. Open http: // 192.168.5.13/in the browser. Refresh the page again. If the page is different, the experiment is successful !)

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.