Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

3.4. 다중 포트 서비스 및 LVS

LVS routers under any topology require extra configuration when creating multi-port LVS services. Multi-port services can be created artificially by using firewall marks to bundle together different, but related protocols, such as HTTP (port 80) and HTTPS (port 443), or when LVS is used with true multi-port protocols, such as FTP. In either case, the LVS router uses firewall marks to recognize that packets destined for different ports, but bearing the same firewall mark, should be handled identically. Also, when combined with persistence, firewall marks ensure connections from the client machine are routed to the same host, as long as the connections occur within the length of time specified by the persistence parameter. For more on assigning persistence to a virtual server, see 4.6.1절. “VIRTUAL SERVER 하부 섹션”.
실제 서버에서의 로드 밸런스를 유지하기 위해 사용된 메카니즘 — IPVS —은 패킷에 지정된 방화벽 표시 기능을 인식할 수 있으나 그 자체로 방화벽 표시 기능을 지정할 수는 없습니다. 방화벽 표시 기능을 지정하는 작업은 Piranha Configuration Tool를 제외한 네트워크 패킷 필터, iptables에 의해 실행되어야 합니다.

3.4.1. 방화벽 표시 기능 지정

특정 포트로 목적지가 지정된 패킷에 방화벽 표시 기능을 지정하기 위해 관리자는 iptables를 사용해야 합니다.
This section illustrates how to bundle HTTP and HTTPS as an example; however, FTP is another commonly clustered multi-port protocol. If an LVS is used for FTP services, refer to 3.5절. “FTP 설정 ” for configuration details.
방화벽 규칙을 사용할 때 기억해 두어야 할 기본적인 규칙은 Piranha Configuration Tool에서 방화벽 규칙을 사용하는 모든 프로토콜의 경우 네트워크 패킷에 표시 기능을 지정하기 위해 적당한 iptables 규칙이 있어야 합니다.
네트워크 패킷 필터 규칙을 생성하기 전에 이미 생성된 규칙이 없는 지를 확인합니다. 이를 실행하기 위해 쉘 프롬프트를 열고 root로 로그인하여 다음을 실행합니다:
/sbin/service iptables status
iptables이 실행되지 않을 경우, 바로 프롬프트가 다시 나타납니다.
iptables가 활성화되어 있을 경우, 규칙 모음을 보여줍니다. 규칙이 나타나면 다음과 같은 명령을 입력합니다:
/sbin/service iptables stop
기존에 있는 규칙이 중요한 것일 경우, /etc/sysconfig/iptables의 내용을 확인하고 저장해 두어야할 규칙을 안전한 장소에 복사해 둡니다.
아래에는 포트 80 및 443에서 유동 IP 주소 n.n.n.n로 목적지가 지정된 들어오는 소통량에 같은 방화벽 표시 기능 80을 지정한 규칙이 있습니다.
/sbin/modprobe ip_tables
/sbin/iptables -t mangle -A PREROUTING -p tcp -d n.n.n.n/32 --dport 80 -j MARK --set-mark 80
/sbin/iptables -t mangle-A PREROUTING -p tcp -d n.n.n.n/32 --dport 443 -j MARK --set-mark 80
For instructions on assigning the VIP to the public network interface, see 4.6.1절. “VIRTUAL SERVER 하부 섹션”. Also note that you must log in as root and load the module for iptables before issuing rules for the first time.
위의 iptables 명령에서 n.n.n.n은 HTTP 및 HTTPS 가상 서버에 해당하는 유동 IP로 대체해야 합니다. 이러한 명령은 포트 상의 VIP에서 인식되는 모든 소통량에 대해 80이라는 방화벽 표시를 지정하는 효과를 갖게 되고, 80이라는 방화벽 표시는 IPVS에 의해 차례로 인식되어 올바르게 포워드됩니다.

주의

The commands above will take effect immediately, but do not persist through a reboot of the system. To ensure network packet filter settings are restored upon reboot, refer to 3.6절. “네트워크 패킷 필터 설정 저장 ”