你的位置:首页 > 操作系统

[操作系统]Lvs DR模式配置


#!/bin/bash#lvs setting#DIP# eth0:192.168.233.145#VIP# eth0:0 192.168.233.250/32#RIP1:192.168.233.146#RIP2:192.168.233.147#VIP# 192.168.233.250/32case $1 inrip)#VIP:iptables -Fsetenforce 0echo 1 >/proc/sys/net/ipv4/conf/lo/arp_ignoreecho 1 >/proc/sys/net/ipv4/conf/all/arp_ignoreecho 2 >/proc/sys/net/ipv4/conf/lo/arp_announceecho 2 >/proc/sys/net/ipv4/conf/all/arp_announceifconfig lo:0 192.168.233.250 netmask 255.255.255.255 broadcast 192.168.233.250 uproute add -host 192.168.233.250 dev lo:0;;dip)#DIP:iptables -Fsetenforce 0echo 1 >/proc/sys/net/ipv4/ip_forwardifconfig eth0:0 192.168.233.250 netmask 255.255.255.255 broadcast 192.168.233.250 upipvsadm -Cipvsadm -A -t 192.168.233.250:80 -s wlcipvsadm -a -t 192.168.233.250:80 -r 192.168.233.146 -gipvsadm -a -t 192.168.233.250:80 -r 192.168.233.147 -gipvsadm -Ln;;esac#End#