RedHat 8.0/9.0 LVS安裝手冊(3)

类别:编程语言 点击:0 评论:0 推荐:

PART II:LVS设定

系统架构

一、简易设定:

1、IP Tunnel的设定:

Load Balance : 10.144.43.175(nb8048) Real Server:10.144.43.142(linux142)、10.144.43.187(linux187) Virtual IP :10.144.43.185(VIP)

Nb8048上面的设定:

1、先建立一个Subinterface

# ifconfig eth0:0 10.144.43.185 netmask 255.255.255.255 broadcast || 10.144.43.185 up

2、建立IP Tunnel的Rule

2.1、先打开IP Forwarding

# echo 1 > /proc/sys/net/ipv4/ip_forward

2.2、建立IP Tunnel的Rule,先建立Service

# ipvsadm -A -t 10.144.43.185:23 -s wlc

2.3、加入两台Real Server的IP

# ipvsadm -a -t 10.144.43.185:23 -r 10.144.43.187 -i # ipvsadm -a -t 10.144.43.185:23 -r 10.144.43.142 -i

linux142与linux187上面的设定:

1、另外建立一个Tunnel0

# ifconfig tunl0 10.144.43.185 netmask 255.255.255.255 broadcast 10.144.43.185

2、将host加入routing table

# route add -host 10.144.43.185 dev tunl0

3、将接口的hidden属性打开:

# echo 1 > /proc/sys/net/ipv4/ip_forward # echo 1 > /proc/sys/net/ipv4/conf/all/hidden # echo 1 > /proc/sys/net/ipv4/conf/tunl0/hidden

2、Direct Routing的设定

Load Balance:10.144.43.175 Virtual IP: 10.144.43.185 RealServer1:10.144.43.175(nb8048) RealServer2:10.144.43.142(linux142) RealServer3:10.144.43.187(linux187)

  网络架构图如上所示,其中DR与RealServer1、RealServer2在同一个网段,其IP Address配置如附图,基本设定如下,包含避免ARP Problem的设定:

DR(Direct Routing Server):

# ifconfig eth0 10.144.43.175 netmask 255.255.255.0 broadcast 10.144.43.255 # route add -net 10.144.43.0 dev eth0 # ifconfig eth0:0 10.144.43.185 netmask 255.255.255.255 broadcast 10.144.43.185 # echo 1 > /proc/sys/net/ipv4/ip_forward # ipvsadm -A -t 10.144.43.185:23 -s rr (用Round Robin方式) # ipvsadm -a -t 10.144.43.185:23 -r 10.144.43.175 -g # ipvsadm -a -t 10.144.43.185 :23 -r 10.144.43.142 -g # ipvsadm -a -t 10.144.43.185 :23 -r 10.144.43.187 -g

RealServer1 与RealServer2的设定:

# ifconfig eth0 10.144.43.142 netmask 255.255.255.0 broadcast 10.144.43.255 # route add -net 10.144.43.0 dev eth0 # ifconfig lo:0 10.144.43.185 netmask 255.255.255.255 broadcast 10.144.43.185 # route add -host 10.144.43.185 dev lo:0 # echo 1 > /proc/sys/net/ipv4/ip_forward # echo 1 > /proc/sys/net/ipv4/conf/all/hidden # echo 1 > /proc/sys/net/ipv4/conf/lo/hidden

测试:

  从10.16.1.16机器上,对10.144.43.185作telnet 测试,三次联机三次都连到不同的Server,所以测试正常。

本文地址:http://com.8s8s.com/it/it23431.htm