[原创]LVS/NAT模式负载均衡示例
时间:2010-10-26 来源:nianzong
LVS/NAT:
LB:
eth0:inet 192.168.57.120/24 brd 192.168.57.255 scope global eth0
inet 192.168.57.126/24 brd 192.168.57.255 scope global secondary eth0:126
eth1:
inet 10.10.57.120/24 brd 10.10.57.255 scope global eth1
inet 10.10.57.2/24 brd 10.10.57.255 scope global secondary eth1:2
lvs命令:
ipvsadm -A -t 192.168.57.126:8080 -s wlc -p 30
ipvsadm -a -t 192.168.57.126:8080 -r 10.10.57.122:8080 -w 10 -m
ipvsadm -a -t 192.168.57.126:8080 -r 10.10.57.123:80 -w 10 -m
ip addr add 192.168.57.126/24 brd 192.168.57.255 dev eth0 label eth0:126
ip addr add 10.10.57.2/24 brd 10.10.57.255 dev eth1 label eth1:2
echo "1" >/proc/sys/net/ipv4/ip_forward #LVS/NAT模式必须要开启包转发
RS:
关闭eth0端口, eth1端口的网关必须配置为10.10.57.2,并确保默认路由为eth1,否则不能返回应答包.
相关阅读 更多 +