LVS-DR(端口绑定)实验回顾

151252726.jpg


配置LVS DR(端口绑定)模式

=================================

Real Server A & Real Server B:

[root@localhost ~]# ifconfig lo:1 192.168.122.254/32

[root@localhost ~]# echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore

[root@localhost ~]# echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce

[root@localhost ~]# yum install vsftpd

[root@localhost ~]# vim /etc/vsftpd/vsftpd.conf

pasv_enable=YES -->开启被动模式

pasv_max_port=60000 -->指定被动端口范围 50000-60000

pasv_min_port=50000

pasv_address=192.168.122.254 -->指定被动模式使用的IP


Director:

[root@localhost ~]# iptables -t mangle -A PREROUTING -p tcp --dport 21 -j MARK --set-mark 123

[root@localhost ~]# iptables -t mangle -A PREROUTING -p tcp --dport 50000:60000 -j MARK --set-mark 123

[root@localhost ~]# yum install ipvsadm

[root@localhost ~]# ipvsadm -A -f 123 -s rr -p 30

[root@localhost ~]# ipvsadm -a -f 123 -r 192.168.122.10 -g

[root@localhost ~]# ipvsadm -a -f 123 -r 192.168.122.20 -g

[root@localhost ~]# ipvsadm -Ln

[root@localhost ~]# ipvsadm -Ln -c


你可能感兴趣的:(linux,负载均衡,lvs-dr,端口绑定)