In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "method of installation and configuration of lvs in centos". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the method of installation and configuration of lvs in centos.
I. lvs-nat mode
Network configuration:
The code is as follows:
Lvs-server eth0: host-only adapter 192.168.56.101
Lvs-server eth2: Internal 192.168.0.1
Real-server-1 eth0:Internal 192.168.0.2
Real-server-2 eth0:Internal 192.168.0.3
Lvs-server:
1. Install ipvsadm software
The code is as follows:
Yum-y install ipvsadm*
Echo 1 > / proc/sys/net/ipv4/ip_forward router function, ip forwarding
Ipvsadm-C
Ipvsadm-At 192.168.56.101 rr 80-s round robin mode
Ipvsadm-at 192.168.56.101 80-r 192.168.0.2-m
Ipvsadm-at 192.168.56.101 80-r 192.168.0.3-m
Ipvsadm-L-n
2 、 real-server-1:
The code is as follows:
Ifconfig eth0 192.168.0.2 netmask 255.255.255.0
Route add default gw 192.168.0.1
3 、 real-server-2
The code is as follows:
Ifconfig eth0 192.168.0.3 netmask 255.255.255.0
Route add default gw 192.168.0.1
Route-n View routing tabl
II. Lvs-ipturn
Network configuration:
The code is as follows:
Lvs-server eth0:host-only adapter 192.168.56.101
Real-server-1 eth0:host-only adapter 192.168.56.102
Real-server-2 eth0:host-only adapter 192.168.56.103
Lvs-server:
Configure virtual ip, namely vip
The code is as follows:
Ifconfig tunl0 192.168.56.10 netmask 255.255.255.255 up
Route add-host 192.168.56.10 dev tunl0
Ivsadm-C
Ipvsadm-At 192.168.56.10 rr 80-s rr
Ipvsadm-at 192.168.56.10 80-r 192.168.56.102-I
Ipvsadm-at 192.168.56.10 80-r 192.168.56.103-I
Ipvsadm-L-n
Real-server-1:
The code is as follows:
Ifconfig tunl0 192.168.56.10 netmask 255.255.255.255 up
Route add-host 192.168.56.10 dev tunl0
Echo 1 > / proc/sys/net/ipv4/conf/tunl0/arp_ignore
Echo 2 > / proc/sys/net/ipv4/conf/tunl0/arp_announce
Echo 1 > / proc/sys/net/ipv4/conf/all/arp_ignore
Echo 2 > / proc/sys/net/ipv4/conf/all/arp_announce
Real-server-2:
The code is as follows:
Ifconfig tunl0 192.168.56.10 netmask 255.255.255.255 up
Route add-host 192.168.56.10 dev tunl0
Echo 1 > / proc/sys/net/ipv4/conf/tunl0/arp_ignore
Echo 2 > / proc/sys/net/ipv4/conf/tunl0/arp_announce
Echo 1 > / proc/sys/net/ipv4/conf/all/arp_ignore
Echo 2 > / proc/sys/net/ipv4/conf/all/arp_announce
III. Lvs-dr
Network configuration:
The code is as follows:
Lvs-server eth0:host-only adapter 192.168.56.101
Real-server-1 eth0:host-only adapter 192.168.56.102
Real-server-2 eth0:host-only adapter 192.168.56.103
Lvs-server:
Ifconfig eth0:0 192.168.56.10 netmask 255.255.255.255
Route add-host 192.168.56.10 dev eth0:0
Ipvs:
The code is as follows:
Ipvsadm-C ipvsadm-At 192.168.56.10 s rr ipvsadm-at 192.168.56.10 At 80-r 192.168.56.102-g ipvsadm-at 192.168.56.10 s rr ipvsadm 80-r 192.168.56.103-g ipvsadm-L-n
Real-server-1: ifconfig lo:0 192.168.56.10 netmask 255.255.255.255 route add-host 192.168.56.10 dev lo:0 echo 1 > / proc/sys/net/ipv4/conf/lo/arp_ignore echo 2 > / proc/sys/net/ipv4/conf/lo/arp_announce echo 1 > / proc/sys/net/ipv4/conf/all/arp_ignore echo 2 > / proc/sys/net/ipv4/conf/all/arp_announce
Real-server-2: ifconfig lo:0 192.168.56.10 netmask 255.255.255.255 route add-host 192.168.56.10 dev lo:0 echo 1 > / proc/sys/net/ipv4/conf/lo/arp_ignore echo 2 > / proc/sys/net/ipv4/conf/lo/arp_announce echo 1 > / proc/sys/net/ipv4/conf/all/arp_ignore echo 2 > / proc/sys/net/ipv4/conf/all/arp_announce
Thank you for reading, the above is the content of "lvs installation and configuration method in centos". After the study of this article, I believe you have a deeper understanding of the installation and configuration method of lvs in centos, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.