LVS의 NAT Director

2313 단어 NATDirector
세 대의 서버: 한 대는director로, 두 대는real서버director로 외망카드(192.168.199.158)와 한 개의 내망ip(192.168.1.155) 두 개의 real서버에 내망ip(192.168.182)와(192.168.1.183)만 있고, 두 개의 real서버의 내망망을 director로 설정해야 하는 내망ip(192.168.155) 뒤에 상세한 과정 wgethttp://nginx.org/download/nginx-1.16.0.tar.gz설치nginxvip: 192.168.40.124rip: 192.168.40.15192.168.40.123 스케줄러 설치: 1. 방화벽 닫기 2, ipvsadmyum 설치 ipvsadm-y3,추가표-D 삭제 전체 표-d 삭제 (알고리즘 제외) ipvsadm-A-t 192.168.40.124:8080-s(스케줄링 알고리즘) rr(윤문 알고리즘) 추가기록(스케줄링 대상, 웹) ipvsadm-a-t 192.168.40.124:80.r 192.168.40.155 ipvsadm-a-t 192.168.40.124:80-r 192.168.40.1234, vip 주소 설정 ifconfig ens33:1 192.168.40.124/32
route add -host 192.168.40.124 dev ens33:1
echo 1 >/proc/sys/net/ipv4/ip_forward
웹 서비스 2대에 가상 숨김 VIP 설치 구성
echo 1 >/proc/sys/net/ipv4/conf/lo/arp_ignoreecho 2 >/proc/sys/net/ipv4/conf/lo/arp_announceecho 1 >/proc/sys/net/ipv4/conf/all/arp_ignoreecho 2 >/proc/sys/net/ipv4/conf/all/arp_announce
lo에 VIP 주소 설정 ifconfig lo:0 192.168.40.124/32 루트 추가 add - host 192.168.40.124 dev lo:0
스케줄러 ipvsadm -Ln
wget http://nginx.org/download/nginx-1.16.0.tar.gz설치nginxDirector 노드: (ens33 192.168.199.169 vip eth0:0 192.168.199.158)Real server1: (ens33 192.168.199.111 vip lo:0 192.168.199.158)Real server2: (ens33 192.168.199.231 vip lo:0 192.168.199.158)
    arp_announce      2  
    arp_ignore        1

vim /usr/local/sbin/lvs_dr.sh


#!/bin/bashecho 1 >/proc/sys/net/ipv4/ip_forwardipv=/sbin/ipvsadmdip=192.168.199.122vip=192.168.199.38rs1=192.168.199.143rs2=192.168.199.241ifconfig ens33:0 downifconfig ens33:0 $vip broadcast $vip netmask 255.255.255.255 uproute add -host $vip dev eth0:0$ipv -C$ipv -A -t $vip:80 -s wrr $ipv -a -t $vip:80 -r $rs1:80 -g -w 3$ipv -a -t $vip:80 -r $rs2:80 -g -w 1
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

vim /usr/local/sbin/lvs_dr_rs.sh


#!/bin/bashvip=192.168.199.38ifconfig lo:0 $vip broadcast $vip netmask 255.255.255.255 uproute add -host $vip lo:0echo "1">/proc/sys/net/ipv4/conf/lo/arp_ignoreecho "2">/proc/sys/net/ipv4/conf/lo/arp_announceecho "1">/proc/sys/net/ipv4/conf/all/arp_ignoreecho "2">/proc/sys/net/ipv4/conf/all/arp_announce++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

좋은 웹페이지 즐겨찾기