LVS Principle and Practice (NAT mode)

Source: Internet
Author: User

LVS regardless of the NAT and Dr Mode, both LVS server and real server in the same network segment, Nat needs to use LVS server as the default gateway for each realserver, Dr Mode with modified MAC address directly from the data link layer forwarding, Requirements must be within the same physical network segment

The experiment of Lvs-nat
Network topology:
The use of 1 router, a public network IP, a managed private network, 3 private network VMS built (1 LVS, 2 realserver), the VM firewall is closed, router binding public IP, configure port forwarding policy, 80 port to LVS IP : 80, Tsing Yun in firewall open downstream TCP 80 port

Environment: CentOS 6.4 x64
One LB
1 Install Ipvsadm First
2 opening Ip_forward
echo "1" >/proc/sys/net/ipv4/ip_forward
3 Writing LVS Rules
Ipvsadm-a-T Lvs_ip:80-s RR
Ipvsadm-a-T Lvs_ip:80-r web1_ip:80-m
Ipvsadm-a-T Lvs_ip:80-r web2_ip:80-m
4 Execution rules
5 use Ipvsadm-l to see
[Email protected] ~]# ipvsadm-l
IP Virtual Server version 1.2.1 (size=4096)
Prot Localaddress:port Scheduler Flags
Remoteaddress:port Forward Weight activeconn inactconn
TCP Lvs_ip:http RR
-web1_ip:http MASQ 1 0 0
-web2_ip:http MASQ 1 0 0
Two Real servers
Real server only needs to point the gateway to LVS_IP, open the Apache test

Route add default GW lvs_ip

Delete webserver default route: Route del defaults GW

Reference article:

LVS Principle and Practice (NAT mode)

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: 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.