L4 스위치/Alteon SLB/서버로드밸런싱

by 파시스트 posted Feb 27, 2017
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

대부분의 네트워크망에서 꼭 알아야지만 전체 트래픽의 흐름도를 알 수 있는 Layer4 Switch 입니다.


일단 가장 Layer4 SW를 많이 사용하는 SLB(Server Load Balancing)부터 알아보겠습니다.


이후 방화벽/VPN 로드발란싱을 정리해보도록 하겠습니다.


이후 BIPIP(F5)도 시간이 되면 정리해보겠습니다.


@ Alteon SLB(서버 로드 발란싱) Manual 정리

   

1.png


 

   

   

* 정리 순서

1. SLB의 장점 3가지

   

2. SLB 동작 방법

2.1 Alteon 로드 발란싱의 방법들

2.2 SLB의 중요한 Key 내용들

2.2.1 Client 와 Server 간 트래픽은 L4를 경유하

2.2.2 Client/Server Processing

   

3. SLB 고급 옵션

3.1 기본 SLB 지원 서비스와 애플리케이션

3.1.2 Disabling and Enabling Real Servers

3.1.3 R_IP, V_IP에 IP망 subnet mask 할당법

3.1.4 Health Check for Real Server

3.1.4.1 Multiple Services

3.1.5 Real Server Groups

3.1.5.1 Weight for Real Servers

3.1.6 Time-outs for Real Servers

3.1.7 Maximum Connection for Real Servers

3.1.8 Backup/Overflow Servers

   

3.2 Content Intelligent Server Load Balancing

   

3.3 SLB 확장 토폴로지

3.3.1 VMA(Virtual Matrix Architecture)

3.3.2 Proxy IP Addresses

3.3.3 Mapping Port

3.3.4 Direct Server Return(DSR)

   

3.4 DMA(Direct Access Mode)

   

   

   

   

1. SLB의 장점 3가지

2.png


 

   

   

2. SLB 동작 방법

: 기존의 3가지 웹 서버를 각각 모든 웹 서버가 모든 서비스를 지원하게 설정 한 후 L4를 도입 후에

사용자의 트래픽을 효과적으로 분산(다양한 알고리즘 적용 가능)할 수 있다.

3.png


 

   

!- 웹 호스팅에 필요한 3가지 요구 : 서버 가용성, 서버 성능 확장, 서버/네트워크 쉬운 관리

4.png


 

   

   

   

2.1 Alteon 로드 발란싱의 방법들

ㄱ. Virtual Server-base load balancing : 가상 인터페이스 기반 로드 발란싱(Real Server 로 맵핑)

ㄴ. Filtered-based load balancing : 필터 기반(허용, 차단, 리다이렉트)의 로드 발란싱

ㄷ. Content-based load balancing : Layer7 기반(콘텐츠)의 로드 발란싱

5.png


 

   

   

2.2 SLB의 중요한 Key 내용들

   

2.2.1 Client 와 Server 간 트래픽은 L4를 경유하기('One-Arm mode' 라고 함)

: Client 의 모든 트래픽은 일반적으로 Virtual server IP로 들어와서 Real server 로 넘겨주게 되고 다시 L4로 돌아와서

Client 로 돌아가게 됩니다. 만약 그림 아래의 '회색점선' 처럼 L4를 경유하지 않는 경우 'Proxy IP address'를 통해서

L4를 경유하게 해야 합니다. (물론 예외 경우 존재, DSR-Direct Server Return 처럼 비대칭 흐름이 나올 수 있음)

6.png


 

   

   

2.2.2 Client/Server Processing

: L4에 port 를 서버 혹은 클라이언트가 연결된 곳에 Client/Server port 라고 지정을 하게 되면 각각 processing 일어난다.

: 물론 해당 포트는 Layer2 스위칭과 Layer3 라우팅 기능이 동작 가능하다.

- Client Processing : 클라이언트의 V_IP 로 요청 트래픽을 V_IP 를 R_IP로 변환해준다.

- Server Processing : 서버가 클라이언트에 응답하는 트래픽을 R_IP를 V_IP로 변환해준다.

: 아래의 그림에서 port 11은 Client/Server Processing 이 둘 다 일어나는 곳이다. 특히 Web 가 DNS request 를 보내는

DNS Server 가 V_IP 이며 port 13,14쪽에 DNS 서버들이 위치해있고 R_IP 응답이 된다.

   

- Client Processing

7.png


 

   

   

3. SLB 고급 옵션

: 대략 아래 처럼 SLB 고급 옵션 지원

8.png


 

   

   

3.1 기본 SLB 지원 서비스와 애플리케이션

9.png


 

: Virtual server 에 8개의 서비스 설정이 가능하다. 한 스위치에 최대 1023 서비스가 가능하다.

: FTP나 RTSP의 경우 특별한 설정이 필요하다.

   

   

3.1.2 Disabling and Enabling Real Servers

: Real Server 를 재부팅 하기 위해서 L4에서 해당 서버로 전달을 하지 않는 설정

예제) /oper/slb/dis <real server number> n

   

3.1.3 R_IP, V_IP에 IP망 subnet mask 할당법

   

3.1.4 Health Check for Real Server

: 다양한 health check 방법

   

3.1.4.1 Multiple Services

: 하나의 서버가 FTP와 SMTP를 동시에 서비스 할 때 health check 하는 옵션

   

3.1.5 Real Server Groups

: Real Server 로 부하 분산하는 다양한 알고리즘

   

3.1.5.1 Weight for Real Servers

: Real Server 에 가중치를 두어서 부하 분산 기능 제공

   

3.1.6 Time-outs for Real Servers

: L4를 경유한 TCP/IP 세션이 정상 종료 되지 않았을 경우 해당 세션을 종료하는 time-out 설정 가능

   

3.1.7 Maximum Connection for Real Servers

: SLB 환경에서 Real Server 로의 최대 Connection 제한, 반대로 무제한 옵션 가능(단 L4 및 웹 서버의 성능에 따라 다름)

   

3.1.8 Backup/Overflow Servers

: SLB 환경에서 Real Server 가 모두 다 fail 시 혹은 Overflow 시 동작하는 서버 지정 가능

   

   

   

3.2 Content Intelligent Server Load Balancing

: Layer7 콘텐츠 기반의 SLB 기능, 아래 처럼 '그림파일 전용 서버' 등으로 SLB 가능하다.

: 단 DMA 기능을 사용하거나 Proxy IP 기능을 사용해야 한다.

예제1) DMA 사용 # /cfg/slb/adv/direct ena

예제2) Proxy IP 사용

# /cfg/slb/direct dis

# /cfg/slb/pip

>> Proxy IP Address# add 12.12.12.12

>> Proxy IP Address# type port (Use port-based proxy IP)

# /cfg/slb/port 2/proxy ena (Enable proxy on client port)

   

10.png


 

   

NOTE – When URL-based SLB is used in an active/active redundant setup, use a proxy IP address

instead of Direct Access Mode (DAM) to enable the URL parsing feature.

URL 기반 SLB 가 A-A 설정 시 proxy IP 를 사용해야 한다.(URL parsing 기능 시 사용하는 DAM대신)

   

   

3.3 SLB 확장 토폴로지

   

3.3.1 VMA(Virtual Matrix Architecture)

: 알테온 시스템 최적화 기능, 기본적으로 활성화 되어있다.

   

3.3.2 Proxy IP Addresses

   

3.3.3 Mapping Port

   

3.3.4 Direct Server Return(DSR)

서버가 클라이언트에게 직접 바로 응답을 돌려주는 방법. 서버와 클라이언트간 많은 트래픽이 오갈때 유용하다.

하지만 비대칭형 데이터 경로가 된다. DSR과 'content-intelligent Layer7 switching' 는 같이 동작 할 수 없다.

왜냐하면 L7 필터링/스위칭은 L4로 응답 패킷이 들어와야 제대로 동작하기 때문이다.

Some clients may need direct access to the real servers

(for example, to monitor a real server from a management workstation).

The Direct Server Return (DSR) feature allows the server to respond directly to the client.

This capability is useful for sites where large amounts of data are flowing from servers to clients,

such as with content providers or portal sites that typically have asymmetric traffic patterns.

DSR and content-intelligent Layer 7 switching cannot be performed at the same time

because content intelligent switching requires that all frames go back to the switch for connection splic-ing.

   

!- 아래 처럼 C_IP가 V_IP로 L4로 접근 하면 L4는 부하 분산으로 R_IP 를 선택 후 보내게 되고

이후 R_IP가 응답을 L4를 거치지 않고 C_IP로 바로 전달하는 방식입니다.

11.png


 

   

3.4 DMA(Direct Access Mode)

DAM은 클라이언트의 트래픽이 들어온 포트로 서버의 응답 패킷이 돌아가는 기능을 말합니다.

또한 Client/Server processing 이 같은 포트에서 동작이 일어나게 됩니다. 또한 real server 에 direct access 해야 합니다.

Direct Access Mode (DAM) allows any client to communicate with any real server's load-bal-anced service.

Also, with DAM enabled, any number of virtual services can be configured to load balance a real service.

Direct Access Mode enables both Client and Server processing on the same port to handle traffic

that requires direct access to real servers.

>> Main# /cfg/slb/adv/direct e

   

!- DMA 를 사용하는 곳 : R_IP로 바로 접근 시, R_S가 여러개의 V_IP를 가지고 있을 시, L7 switching 기능 중

111.png



 

   

!- DMA 사용 하면서 특정 서비스로는 V_IP로 접근을 허용 할 때

>> Main# /cfg/slb/adv/direct e (Enable DAM globally on the switch)

>> /cfg/slb/virt 1/service 9200/direct disable

   

3.5 Assigning Multiple IP Addresses

: Using Proxy IP Addresses 또는 Mapping Ports

!- 아래의 경우 DAM 으로 R_IP(Port 80)로 접근 가능하고 V_IP(Port)로 접근하면 R_IP(Port 8000)으로 접근 가능하다.

12.png



 

   

   

3.6 Delayed Binding

: DoS 공격은 서버와 연결을 맺는 과정에서 일어나게 됩니다. 즉 연결을 완료하기 전에 방어를 해야 합니다.

   

!- Delayed Binding 시 : L4가 Client 와 3way 과정 수행 후 정상이면 Server 와 연결

13.png


 

!

   

>> # /cfg/slb/virt <virtual server number>/service <service type>/dbind

   

   

$------- Delayed Binding 활성화 하지 않고 BT4에서 DoS 공격 시

ㄱ. BT4에서 S_IP를 1.1.1.1로 변조해서 V_IP(10.10.10.10)으로 TCP 80 DoS 공격

BT4) hping3 -a 1.1.1.1 10.10.10.10 -S -p 80 --flood

   

ㄴ. Alteon SW에서 확인 : Total, Highest 세션 확인

>> Server Load Balancing Statistics# virt 1

------------------------------------------------------------------

Virtual server 1 stats:

Current Total Highest

Real IP address Sessions Sessions Sessions Octets

---- --------------------------- -------- ---------- -------- ---------------

1 192.168.1.10 0 116197 20273 23634933

2 192.168.2.20 0 184362 41178 32799799

---- --------------------------- -------- ---------- -------- ---------------

10.10.10.10 0 300559 61451 56434732

   

ㄷ. 첫번째 서버에서 TCP 세션 확인

14.png


 

   

ㄹ. 두번째 서버에서 TCP 세션 확인

15.png


 

   

   

$------- Delayed Binding 활성화 후 BT4에서 DoS 공격 시

ㄱ. BT4에서 S_IP를 1.1.1.1로 변조해서 V_IP(10.10.10.10)으로 TCP 80 DoS 공격

BT4) hping3 -a 1.1.1.1 10.10.10.10 -S -p 80 --flood

   

ㄴ. Alteon SW에 Delayed Binding 설정 후 공격 후 확인 : Total, Highest 세션 확인

/cfg/slb/virt 1/service 80/dbind e

/stat/slb/layer7/maint

/stat/slb virt 1

!- 아래 처럼 'Half open connections' 은 DoS 공격 count 이다.

16.png


 

   

!- 아래 처럼 L4에 console 에 log 가 나온다.

Mar 28 11:53:54 ALERT slb: SYN attack detected: 14123 new half-open sessions per second

Mar 28 11:53:56 ALERT slb: SYN attack detected: 14322 new half-open sessions per second

Mar 28 11:53:58 ALERT slb: SYN attack detected: 14523 new half-open sessions per second

Mar 28 11:54:00 ALERT slb: SYN attack detected: 14272 new half-open sessions per second

Mar 28 11:54:02 ALERT slb: SYN attack detected: 13960 new half-open sessions per second

Mar 28 11:54:04 ALERT slb: SYN attack detected: 10137 new half-open sessions per second

   

ㄷ. 첫번째/두번째 서버에서 TCP 세션 확인

공격 트래픽이 도달하지 않는다.

   

* 참고문서

ftp://ftp.software.ibm.com/systems/support/system_x_pdf/24r9742.pdf

http://cafe.naver.com/neteg/31178






Articles

1 2 3 4 5 6 7