全部博文(1144)
分类: LINUX
2007-11-04 22:15:54
關於 LVS
環境:
為簡化測試環境, 本篇 Load Balancer 與 Real Server 皆為 Fedora Core 3
Virtual Server via NAT (VS/NAT)
Load Balancer:
eth1 (對外): 10.2.0.1
eth0 (對內): 192.168.1.254vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
sysctl -p
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE
ipvsadm -C
ipvsadm -A -t 10.2.0.1:80 -s rr
ipvsadm -a -t 10.2.0.1:80 -r 192.168.1.1:80 -m
ipvsadm -a -t 10.2.0.1:80 -r 192.168.1.2:80 -m
Real Server:
Default Gateway 指向 Director 的 LAN IP
Virtual Server via IP Tunneling (VS/TUN)
Load Balancer:
eth0: 10.2.0.1
eth0:0: 10.2.0.2vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
sysctl -p
ifconfig eth0:0 10.2.0.2 netmask 255.255.255.255 up
ipvsadm -C
ipvsadm -A -t 10.2.0.2:80 -s rr
ipvsadm -a -t 10.2.0.2:80 -r 10.2.0.11:80 -i
ipvsadm -a -t 10.2.0.2:80 -r 10.2.0.12:80 -i
Real Server:
vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2sysctl -p
ifconfig tunl0 10.2.0.2 netmask 255.255.255.255 up
route add -host 10.2.0.2 dev tunl0
ps. 以上是 Real Server 與 Director 在同一個 LAN 的 IP Tunneling, 跨 WAN 的 IP Tunneling 還搞不清楚... Orz
Virtual Server via Direct Routing (VS/DR)
Load Balancer:
eth0: 10.2.0.1
eth0:0: 10.2.0.2vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
sysctl -p
ifconfig eth0:0 10.2.0.2 netmask 255.255.255.255 up
ipvsadm -C
ipvsadm -A -t 10.2.0.2:80 -s rr
ipvsadm -a -t 10.2.0.2:80 -r 10.2.0.11:80 -g
ipvsadm -a -t 10.2.0.2:80 -r 10.2.0.12:80 -g
Real Server:
vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2sysctl -p
ifconfig lo:0 10.2.0.2 netmask 255.255.255.255 up
route add -host 10.2.0.2 dev lo:0
相關網頁
Posted by Jamyy at 2007年09月28日 10:56
TrackBack URL for this entry: