#네트워크 프록시 로드밸런서를 만들어보자.
# 네트워크 프록시 로드밸런서는 mod_myfixip.c 모듈 설치해서 클라이언트 IP 확인 가능하다.
# 네트워크 생성
# 서버 2대 생성
# 타겟 그룹 생성
# 네트워크 프록시 로드 밸런서 생성
1
구성1
VPC 10.0.0.0/20
Pub1 10.0.2.0/24
Pub-lb1 10.0.4.0/24
2
구성2
VPC 10.0.0.0/20
Pub1 10.0.2.0/24
Pub-lb1 10.0.4.0/24
Pri1 10.0.0.0/23
로키 리눅스로 만들어 보자
1대는 웹서버 설치, 시작
1대는 웹서버 미설치
PROXY_TCP
TCP
5
Small
Medium
Large
Extra Large
생성
1
타겟 그룹 > Taget 상태 확인
2
로드밸런서로 웹 접속하기
네트워크 프록시 로드밸런서는 mod_myfixip.c 모듈 설치해서 클라이언트 IP 확인 가능하다.
1
tail -f /var/log/httpd/access_log
2
[root@rocky-nas001 ~]# httpd -v
Server version: Apache/2.4.62 (Rocky Linux)
Server built: Jan 29 2025 00:00:00
[root@rocky-nas001 ~]#
3
cd /usr/bin
wget --no-check-certificate https://raw.githubusercontent.com/ggrandes/apache24-modules/master/mod_myfixip.c
4
sudo dnf install httpd-devel
apxs -c -i mod_myfixip.c
5
[root@rocky-nas001 bin]# find / -name httpd.conf
/etc/httpd/conf/httpd.conf
6
vi /etc/httpd/conf/httpd.conf
LoadModule myfixip_module modules/mod_myfixip.so
<IfModule mod_myfixip.c>
RewriteIPResetHeader off
RewriteIPAllow 10.31.0.0/16 #LB IP 대역으로 설정 (e.g. LB IP가 125.209.197.92인 경우 125.209.0.0/16)
</IfModule mod_myfixip.c>
sudo systemctl restart httpd # CentOS, RHEL 계열
# 또는
sudo systemctl restart apache2 # Ubuntu 계열
#
systemctl enable httpd
systemctl start httpd
systemctl disable httpd
systemctl stop httpd
vi /etc/httpd/conf/httpd.conf
systemctl status httpd.service
systemctl restart httpd
7
tail -f /var/log/httpd/access_log
참고
https://guide.ncloud-docs.com/docs/loadbalancer-classiclb-classic
다음
https://brunch.co.kr/@topasvga/4741