zoukankan      html  css  js  c++  java
  • lvs-nat搭建httpd

    拓扑图:

    #172.16.252.10
    [root@~ localhost]#route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         172.16.252.254  0.0.0.0         UG    100    0        0 ens33
    172.16.0.0      0.0.0.0         255.255.0.0     U     100    0        0 ens33
    192.168.2.0     0.0.0.0         255.255.255.0   U     100    0        0 ens37
    [root@~ localhost]#setenforce 0
    [root@~ localhost]#iptables -F
    #打开核心转发工功能
    [root@~ localhost]#sysctl -w net.ipv4.ip_forward=1
    [root@~ localhost]#yum install -y ipvsadm
    #定义集群服务
    [root@~ localhost]#ipvsadm -A -t 172.16.252.10 -s rr
    #管理集群服务
    [root@~ localhost]#ipvsadm -a -t 172.16.252.10 -r 192.168.2.10 -m
    [root@~ localhost]#ipvsadm -a -t 172.16.252.10 -r 192.168.2.12 -m
    [root@~ localhost]# ipvsadm -Ln
    IP Virtual Server version 1.2.1 (size=4096)
    Prot LocalAddress:Port Scheduler Flags
      -> RemoteAddress:Port           Forward Weight ActiveConn InActConn
    TCP  172.16.252.10:80 rr
      -> 192.168.2.10:80              Masq    1      0          5         
      -> 192.168.2.12:80              Masq    1      0          5 

    RS:

    #172.16.252.10
    [root@html localhost]#route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         192.168.2.140   0.0.0.0         UG    100    0        0 ens33
    192.168.2.0     0.0.0.0         255.255.255.0   U     100    0        0 ens33
    [root@html localhost]#setenforce 0
    [root@html localhost]#iptables -F
    #192.168.2.12
    [root@html localhost]#route -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    0.0.0.0         192.168.2.140   0.0.0.0         UG    100    0        0 ens33
    192.168.2.0     0.0.0.0         255.255.255.0   U     100    0        0 ens33
    [root@html localhost]#systemctl start httpd
  • 相关阅读:
    Docker镜像与仓库(四)
    Docker网络与存储(三)
    Docker基本使用(一)
    虚拟化KVM之优化(三)
    修改CENTOS7的网卡ens33修改为eth0
    虚拟化KVM之安装(二)
    虚拟化KVM之概述(一)
    Python不同版本打包程序为.exe文件
    JSON
    同源策略(same-origin policy)及三种跨域方法
  • 原文地址:https://www.cnblogs.com/wzhuo/p/7056495.html
Copyright © 2011-2022 走看看