[root@zw ~]# cd /etc/sysconfig/network-scripts/
[root@zw network-scripts]# cp ifcfg-ens33 ifcfg-ens33:0
[root@zw network-scripts]# vim ifcfg-ens33:0
NAME=ens33:0
DEVICE=ens33:0
ONBOOT=yes
IPADDR=192.168.248.100
NETMASK=255.255.255.255
[root@zw network-scripts]# ifup ifcfg-ens33:0
[root@zw network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.248.78 netmask 255.255.255.0 broadcast 192.168.248.255
inet6 fe80::3a56:a61b:f0f3:fd09 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:d9:07:16 txqueuelen 1000 (Ethernet)
RX packets 1342 bytes 143729 (140.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1055 bytes 126013 (123.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens33:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.248.100 netmask 255.255.255.255 broadcast 192.168.248.100
ether 00:0c:29:d9:07:16 txqueuelen 1000 (Ethernet)
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:24:31:78 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@zw network-scripts]#
[root@zw network-scripts]# vim /etc/sysctl.conf
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.ens33.send_redirects = 0
[root@zw network-scripts]# sysctl -p
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.ens33.send_redirects = 0
[root@zw network-scripts]#
[root@zw ~]# modprobe ip_vs
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port Forward Weight ActiveConn InActConn
[root@zw ~]# yum -y install ipvsadm
[root@zw ~]# ipvsadm -v
ipvsadm v1.27 2008/5/15 (compiled with popt and IPVS v1.2.1)
[root@zw ~]# [root@zw ~]# ipvsadm -C
[root@zw ~]# ipvsadm -a -t 192.168.248.78:80 -r 192.168.248.88:80 -g -w 1
[root@zw ~]# ipvsadm-save > /etc/sysconfig/ipvsadm
[root@zw ~]# cat /etc/sysconfig/ipvsadm
-A -t www.test.com:http -s rr
-a -t www.test.com:http -r 192.168.248.88:http -g -w 1
[root@zw ~]# systemctl start ipvsadm.service
[root@zw ~]# systemctl enable ipvsadm.service
[root@uuu ~]# yum -y install nfs-utils rpcbind
[root@uuu ~]# mkdir -p /opt/wwwroot
[root@uuu ~]# vim /etc/exports
/opt/wwwroot 192.168.248.0/24(rw,sync,no_root_squash)
[root@uuu ~]# systemctl restart rpcbind
[root@uuu ~]# systemctl restart nfs
[root@uuu ~]# yum -y install httpd
[root@uuu ~]# cd /etc/sysconfig/network-scripts/
[root@uuu network-scripts]# cp ifcfg-lo ifcfg-lo:0
[root@uuu network-scripts]# vim ifcfg-lo:0
DEVICE=lo:0
IPADDR=192.168.248.78
NETMASK=255.255.255.255
ONBOOT=yes
[root@uuu ~]# yum install -y httpd
[root@uuu ~]# cd /etc/sysconfig/network-scripts/
[root@uuu network-scripts]# cp ifcfg-lo ifcfg-lo:0
[root@uuu network-scripts]# vim ifcfg-lo:0
[root@uuu network-scripts]# ifup lo:0
[root@uuu network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.248.88 netmask 255.255.255.0 broadcast 192.168.248.255
inet6 fe80::fa3a:33a0:cd48:1429 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:89:c9:b0 txqueuelen 1000 (Ethernet)
RX packets 2581 bytes 1205845 (1.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1446 bytes 184056 (179.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo:0: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 192.168.248.78 netmask 255.255.255.255
loop txqueuelen 1000 (Local Loopback)
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:30:60:00 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@uuu network-scripts]#
[root@uuu network-scripts]# vim /etc/sysctl.conf
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.default.arp_ignore = 1
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
[root@uuu network-scripts]# sysctl -p
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.default.arp_ignore = 1
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
[root@uuu network-scripts]#
[root@uuu ~]# showmount -e 192.168.248.215
Export list for 192.168.248.215:
/opt/wwwroot 192.168.248.0/24
[root@uuu ~]# mount 192.168.248.215:/opt/wwwroot /var/www/html
[root@uuu ~]# vim /etc/fstab
192.168.248.215:/opt/wwwroot /var/www/html/ nfs defaults,_netdev 0 0
[root@uuu ~]# systemctl start httpd.service
[root@uuu ~]# systemctl enable httpd.service
然后就可以测试了