Linux Virtual Server?作??(VS NAT) (VS TUN) (VS DR)
已有 224 次阅读2013-9-9 20:12
Linux Virtual Server?作??(VS/NAT) (VS/TUN) (VS/DR) 来源: ChinaUnix博客 日期:2008.09.11 16:25 (共有条评论) ?境:
Load Balancer:kernel 2.6.x 已?建 LVS 模?kernel 2.4.x 需打
Fedora Core 3 ??安?即可使用 LVS 模?, 另以 yum 安? ipvsadm 套件
如?法以 yum 安? ipvsadm, 可?
下?
Real Server:VS/NAT 可使用任何平台的?路伺服器? Real ServerVS/TUN 需支援 IP TunnelingVS/DR 需支援 Non-ARP ?路????化???境, 本篇 Load Balancer ? Real Server 皆? Fedora Core 3
Virtual Server via NAT (VS/NAT)
screen.width*0,wfbz.devhub.com.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('');}" onmousewheel="return imgzoom(this);" alt="" />
Load Balancer:
eth1 (?外): 10.2.0.1
eth0 (??): 192.168.1.254
#vi /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)
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('');}" onmousewheel="return imgzoom(this);" alt="" />
Load Balancer:
eth0: 10.2.0.1
eth0:0: 10.2.0.2
#vi /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 = 2
#sysctl -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)
screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onmouseover="if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='Click here to open new window\nCTRL+Mouse wheel to zoom in/out';}" onclick="if(!this.resized) {return true;} else {window.open('');}" onmousewheel="return imgzoom(this);" alt="" />
Load Balancer:
eth0: 10.2.0.1
eth0:0: 10.2.0.2
#vi /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 = 2
#sysctl -p
#ifconfig lo:0 10.2.0.2 netmask 255.255.255.255 up
#route add -host 10.2.0.2 dev lo:0
本文来自ChinaUnix博客,如果查看原文请点: (共有条评论)