码迷,mamicode.com
首页 > 其他好文 > 详细

lvs_realserver

时间:2016-11-14 02:33:10      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:lvs

realserver端脚本就可以完成:

[root@RSV2 ~]# cat lvs_rs.sh 

#!/bin/bash

# Date: 2015.10.1

# Description: lvs之realserver 配置

# Version: 0.0.1

# By the way : echo 1 > /proc/sys/net/ipv4/ip_forward

VIP=192.168.1.103  #client use to request

NETMASK=255.255.255.255   #hidden in the network

IFACE=lo

case $1 in

start)

echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore  

echo 1 > /proc/sys/net/ipv4/conf/lo/arp_ignore

echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce

echo 2 > /proc/sys/net/ipv4/conf/lo/arp_announce

#不向外广播,外面来找也不能让找到

ifconfig "$IFACE":0  "$VIP" netmask $NETMASK broadcast $VIP up

route add -host $VIP dev lo:0

;;

stop)

ifconfig "$IFACE":0 down

echo 0 > /proc/sys/net/ipv4/conf/all/arp_ignore

echo 0 > /proc/sys/net/ipv4/conf/lo/arp_ignore

echo 0 > /proc/sys/net/ipv4/conf/all/arp_announce

echo 0 > /proc/sys/net/ipv4/conf/lo/arp_announce

;;

*)

echo "usage `basename` $0 start|stop"

exit 1

;;

esac


本文出自 “Linux” 博客,请务必保留此出处http://ridingonhorse.blog.51cto.com/11265295/1872466

lvs_realserver

标签:lvs

原文地址:http://ridingonhorse.blog.51cto.com/11265295/1872466

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!