本文共 1626 字,大约阅读时间需要 5 分钟。
调度服务器:
两块网卡:Vmnet1内网:192.168.80.100Vmnet2外网:192.168.90.100(调度器的地址是外网口地址)-------------------------加载LVS内核模块----------------------LVS现在已成为Linux内核的一部分,默认编译为ip_vs模块,必要时能够自动调用。以下操作可以手动加载ip_vs模块,并查看当前系统中ip_vs模块的版本信息[root@lss ~]# cat /proc/net/ip_vscat: /proc/net/ip_vs: 没有那个文件或目录[root@lss ~]# modprobe ip_vs //加载ip_vs模块,[root@lss ~]# cat /proc/net/ip_vs //查看ip_vs版本信息[root@lss ~]# rpm -ivh /mnt/Packages/ipvsadm-1.27-7.el7.x86_64.rpm //安装管理软件,不需要启动[root@lss ~]# vi nat.sh
#!/bin/bashecho "1" > /proc/sys/net/ipv4/ip_forwardipvsadm -Cipvsadm -A -t 192.168.90.100:80 -s rripvsadm -a -t 192.168.90.100:80 -r 192.168.80.102:80 -mipvsadm -a -t 192.168.90.100:80 -r 192.168.80.101:80 -mipvsadm -Ln[root@lss ~]# sh nat.sh192.168.80.101服务器:
Vmnet1内网:192.168.80.101网关:192.168.80.100[root@lss01 ~]# yum install -y httpd[root@lss01 ~]# vi /etc/httpd/conf/httpd.confServerName www.aa.com[root@lss01 ~]# vi /var/www/html/index.html<h1>Server aa </h1>[root@lss01 ~]# service httpd restart[root@lss01 ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33GATEWAY=192.168.80.100[root@lss01 ~]# service network restart192.168.80.102服务器:
Vmnet1内网:192.168.80.102网关:192.168.80.100[root@lss02 ~]# yum install -y httpd
[root@lss02 ~]# vi /etc/httpd/conf/httpd.confServerName www.bb.com[root@lss02 ~]# vi /var/www/html/index.html<h1>Server bb </h1>[root@lss02 ~]# service httpd restart[root@lss02 ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33GATEWAY=192.168.80.100[root@lss02 ~]# service network restart真机浏览器测试:
Vmnet1:192.168.80.88Vmnet2:192.168.90.88友情链接:负载均衡群集之一LVS-DR
转载于:https://blog.51cto.com/13572519/2084181