LVS_端口绑定

IP 规划(使用 XEN 虚拟机,virbr0)
=================================
Client: 192.168.122.1/24 (真实机做客户端)
Zhao YongGang
Director: VIP eth0:1 192.168.122.254/24
DIP eth0 192.168.122.100/24
Real Server A : eth0 192.168.122.10/24
Real Server B : eth0 192.168.122.20/24
Zhao YongGang
配置 LVS VS/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
Zhao YongGang
Zhao YongGang
[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
Zhao YongGang
Zhao YongGang
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
Zhao YongGang
[root@localhost ~]# yum install ipvsadm
[root@localhost ~]# ipvsadm -A -f 123 -s lc -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

你可能感兴趣的:(虚拟机,LVS,客户端,端口绑定)