Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1096713
  • 博文数量: 252
  • 博客积分: 4561
  • 博客等级: 上校
  • 技术积分: 2833
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-15 08:23
文章分类

全部博文(252)

文章存档

2015年(2)

2014年(1)

2013年(1)

2012年(16)

2011年(42)

2010年(67)

2009年(87)

2008年(36)

分类: LINUX

2010-06-29 11:49:36

1. NAT mode
    loadbalancer configure:
        ifconfig eth0 192.168.10.184 netmask 255.255.255.0 up
        echo 1 > /proc/sys/net/ipv4/ip_forward
        echo 0 > /proc/sys/net/ipv4/conf/all/send_redirects
        echo 0 > /proc/sys/net/ipv4/conf/default/send_redirects
        echo 0 > /proc/sys/net/ipv4/conf/eth0/send_redirects
        echo 0 > /proc/sys/net/ipv4/conf/eth1/send_redirects
        ipvsadm -A -t 192.168.10.184:7777 -s rr
        ipvsadm -a -t 192.168.10.184:7777 -r 192.168.10.230:7777 -m

    real server configure:
        ifconfig eth0 192.168.10.230 netmask 255.255.255.0 up
        route add default gw 192.168.10.184
        route del -net 192.168.10.0/24
        route del default gw 192.168.10.1

2. DIRECT ROUTE mode
    loadbalancer configure:
        ifconfig eth0 192.168.10.184 netmask 255.255.255.0 up
        ifconfig eth0:0 192.168.10.177 broadcast 192.168.10.177 netmask 255.255.255.255 up
        route add -host 192.168.10.177 dev eth0:0
        echo 0 > /proc/sys/net/ipv4/ip_forward
        echo 1 > /proc/sys/net/ipv4/conf/all/send_redirects
        echo 1 > /proc/sys/net/ipv4/conf/default/send_redirects
        echo 1 > /proc/sys/net/ipv4/conf/eth0/send_redirects
        ipvsadm -A -t 192.168.10.177:7777 -s rr
        ipvsadm -a -t 192.168.10.177:7777 -r 192.168.10.230:7777 -g

    real server configure:
        ifconfig eth0 192.168.10.230 netmask 255.255.255.0 up
        ifconfig lo:0 192.168.10.177 broadcast 192.168.10.177 netmask 255.255.255.255 up
        route add -host 192.168.10.177 dev lo:0
        echo 0 > /proc/sys/net/ipv4/ip_forward
        echo 1 > /proc/sys/net/ipv4/conf/lo/arp_ignore
        echo 2 > /proc/sys/net/ipv4/conf/lo/arp_announce
        echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
        echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce

3. TUNNEL mode
    loadbalancer configure:
        ifconfig eth0 192.168.10.184 netmask 255.255.255.0 up
        ifconfig eth0:0 192.168.10.177 netmask 255.255.255.255 broadcast 192.168.10.177 up
        echo 1 > /proc/sys/net/ipv4/ip_forward
        ipvsadm -A -t 192.168.10.177:7777 -s rr
        ipvsadm -a -t 192.168.10.177:7777 -r 192.168.10.230:7777 -i

    real server configure:
        ifconfig eth0 192.168.10.230 netmask 255.255.255.0 up
        route add -net 192.168.10.0 netmask 255.255.255.0 dev eth0
        ifconfig tunl0 192.168.10.177 netmask 255.255.255.255 broadcast 192.168.10.177 up
        route add -host 192.168.10.177 dev tunl0
        echo 1 > /proc/sys/net/ipv4/ip_forward
        echo 1 > /proc/sys/net/ipv4/conf/all/send_redirects
        echo 1 > /proc/sys/net/ipv4/conf/lo/send_redirects
        echo 1 > /proc/sys/net/ipv4/conf/default/send_redirects
        echo 1 > /proc/sys/net/ipv4/conf/eth0/send_redirects


阅读(809) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~