# Using Network Load Balancing

## Prerequisite

* มียอดคงเหลือใน Project มากกว่า 0 บาท ([ขั้นตอนการเติมเงินเข้าสู่ Project](/ncs-documents/nipa-cloud-space-overview/billing-and-wallet/topup-a-project-wallet.md))
* มี Load Balancer พร้อมใช้งาน ([ขั้นตอนการสร้าง Load Balancer](/ncs-documents/load-balancing/load-balancer/create-load-balancer.md))

## Instructions

### 1. เข้าสู่หน้าสร้าง Backend Group&#x20;

ในหน้า Load Balancer Detail ที่ tab Overview จะแสดงรายละเอียดของ Load Balancer โดยจะต้องสร้าง Backend Group เพื่อเริ่มใช้งาน โดยกดปุ่ม CREATE BACKEND GROUP ที่แถบ menu ด้านบน หรือ instruction card ที่ด้านขวาบน

<figure><img src="/files/nBE10HaQ5fOy6u1kVeRB" alt=""><figcaption><p>Load Balancer Overview - Create Backend Group Button</p></figcaption></figure>

### 2. ตั้งค่า Backend Group

ในหน้าสร้าง Backend Group ให้เลือก protocol เป็น TCP หรือ UDP ซึ่งจะต้องเป็น protocol เดียวกับกับ Listener ที่ใช้รับ load จากภายนอก Load Balancer

พร้อมกำหนดชื่อและ Algorithm ของ Backend Group

<figure><img src="/files/KJJ0Vhx7RRcqaVAZd29z" alt=""><figcaption><p>Create Backend Group - Backend Group</p></figcaption></figure>

### 3. ตั้งค่า Health Check

เลือกว่าจะเปิดใช้งาน Health Check ที่จะคอยเช็คสถานะของ Member ภายใน Backend Group และกำหนดความถี่ และรูปแบบของการทำ Health Check

<figure><img src="/files/phsqFM5ImsNRTlcphQqi" alt=""><figcaption><p>Create Backend Group - Health Check</p></figcaption></figure>

### 4. ตั้งค่า Members

เลือก IP Address และ Port ที่จะรับ load จาก Load Balancer จากนั้นกด CREATE เพื่อยืนยันการสร้าง Backend Group

<figure><img src="/files/9cBoV4BIKP2RZz1Q1Utk" alt=""><figcaption><p>Create Backend Group - Members</p></figcaption></figure>

{% hint style="info" %}
สถานะของ Backend Group member จะเป็น Disable จนกว่าจะมีการต่อใช้งานกับ Listener
{% endhint %}

### 5. เข้าสู่หน้าสร้าง Listener

ระบบจะพามาหน้า Load Balancer Detail ที่ tab Backend Group รอจนกว่า Load Balancer จะไม่ขึ้น Updating จากนั้นกดปุ่ม CREATE LISTENER

<figure><img src="/files/ldF49RvqBtEdY2Xrc2Xj" alt=""><figcaption><p>Load Balancer Backend Group - Create Listener Button</p></figcaption></figure>

### 6. ตั้งค่า Listener

ในหน้า Create Listener กำหนด Protocol เป็น TCP หรือ UDP กำหนด Port เลือก Backend Group ที่ใช้ Protocol เดียวกัน และตั้งค่าอื่น ๆ จากนั้นกด CREATE เพื่อยืนยันการสร้าง Listener

<figure><img src="/files/my9uiD3b3HaksbOJwTuw" alt=""><figcaption><p>Create Listener</p></figcaption></figure>

### 7. รอจน Listener สร้างสำเร็จ

รอจนกว่า Load Balancer จะไม่ขึ้นว่า Updating ก็ถือเป็นอันเสร็จสิ้น โดยในตอนนี้ ถ้ามี load เข้ามาที่ Load Balancer นี้ ผ่าน VIP หรือ External IP หากมี Port เดียวกันกับ Listener ที่สร้างไว้ load ก็จะถูกส่งไปยัง Member หนึ่งของ Backend Group นี้ ตาม Algorithm ที่เลือกไว้

<figure><img src="/files/UCoUhhdSeFhoZsFe1OLJ" alt=""><figcaption><p>Load Balancer Listener</p></figcaption></figure>

{% hint style="info" %}
สามารถทวนขั้นตอนนี้ใหม่อีกครั้ง เพื่อรับ load ใน Protocol และ Port อื่น ๆ โดยใน 1 Load Balancer สามารถทำงานได้ทั้ง Network Load Balancing และ Application Load Balancing ขึ้นอยู่กับ Backend Group และ Listener
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-epc.gitbook.io/ncs-documents/load-balancing/load-balancer/using-network-load-balancing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
