> For the complete documentation index, see [llms.txt](https://manual.seara.biz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.seara.biz/connect-to-seara-with/fortigate.md).

# Fortigate

&#x20;                                       **การ Config จะประกอบไปด้วย 6 หัวข้อหลักดังนี้**

1. [การตั้งค่า Radius](#radius)  เป็นการตั้งค่า Fortigate ให้ Connect กับ Radius Server ของ Seara Cloud&#x20;
2. [การตั้งค่า User Groups](#user-grops)  เป็นการตั้งค่าในส่วนของ User ซึ่งจะทำงานร่วมกับ Menu [Package](/site-management/user-management/internet-package.md) บน Seara Cloud  ในการตั้งชื่อ User Group ชื่อจะต้องตรงกับชื่อ Package บน Seara Cloud ด้วย  ถ้าหากมี Package มากกว่า 1 Package  ก็ต้องสร้าง User Group ให้ครบตามจำนวน Package นะครับ
3. [การตั้งค่า Address](#address)  เป็นการกำหนด Network  ของขา LAN เพื่อที่จะนำ Network นี้ไปใช้ในการทำ Captive Portal Policy&#x20;
4. [การตั้งค่า Interface สำหรับ Internal ( ขา LAN )](#interface-internal-lan)  เป็นการตั้งค่า Interface ที่จะนำมาใช้สำหรับขา LAN ซึ่งจะรวไปถึงการ Config [IP Address](#config-lan-interface)  ของขา LAN    [DHCP Server](#dhcp-server)    [Captive Portal](#network)  &#x20;
5. [การ Import SSL Certification ](#import-ssl-certification)  เป็นการ Upload file certificate เข้าไปใน Fortigate&#x20;
6. [การตั้งค่า Firewall Policy](#firewall-policy)  เป็นการตกำหนด Policy ต่างๆเพื่อให้ Client สามารถใช้งาน Internet โดยการ Authentication&#x20;
7. [เพิ่ม Fortigate เข้าไปใน Seara ](#add-fortigate-on-seara)เป็นการเพิ่ม NAS ID ของ Fortigate เข้าไปใน Seara  ซึ่ง Login Page และ Radius จะ Call ผ่าน NAS ID ของ Fortigate

&#x20;                       <mark style="color:red;">#####          ในการ Config ควรจะเรียงลำดับตามหัวข้อด้านบนไปที่ละหัวข้อ          #####</mark>&#x20;

#### **ตั้งค่า Radius**&#x20;

1. เลือก Menu  User & Authentication
2. เลือก Menu  RADIUS Server
3. กด Create New

<figure><img src="/files/FBIZ0ceRHg0tBUcoFopv" alt=""><figcaption></figcaption></figure>

**Name  :** ตั้งชื่อ Radius Server

**Authentication method  :** เลือกเป็น Specify  จากนั้นเลือก Authen type เป็น PAP

**NAS IP  :** ใส่ IP Gateway ของขา LAN

<mark style="color:blue;">Primary Server</mark>

**IP/NAME  :**  <mark style="color:red;">(IP Radius ดูจาก E-Mail ที่ได้รับ)</mark>

**Secret  :**  <mark style="color:red;">(secret ดูจาก E-Mail ที่ได้รับ)</mark>

<mark style="color:blue;">จากนั้นกด Test Connectivity</mark> &#x20;

&#x20;           <mark style="color:green;">สังเกตว่า Connection status จะต้องขึ้น Successful</mark>

<figure><img src="/files/1BLr2azc5jh3lTTRpKqy" alt=""><figcaption></figcaption></figure>

**กดที่ >\_ Edit in CLI**

<figure><img src="/files/vwBFykMzjZhs1eYf8gfe" alt=""><figcaption></figcaption></figure>

**พิมพ์คำสั่ง**  <mark style="color:red;">config user radius</mark>   **หากพิมพ์ถูกต้องจะขึ้นตามภาพนี้**

<figure><img src="/files/gkRQGxlOFLGXBbgGwMhg" alt=""><figcaption></figcaption></figure>

**พิมพ์คำสั่ง**  <mark style="color:red;">edit</mark> **ตามด้วยชื่อ Radius ที่เราตั้งไว้ก่อนหน้านี้  ตั้วอย่างจะชื่อ Seara Auth  หรือพิมพ์คำว่า edit แล้วกด shift+? แล้วจะแสดงชื่อ Radius profile ของเราขึ้นมา**   &#x20;

<figure><img src="/files/rImUOVV0Yp34tinwvj8S" alt=""><figcaption></figcaption></figure>

**การ Setting Connect To  Radius Server  Copy คำสั่งไปวางบน Terminal ของ Fortigate ได้เลยครับ**

```html
set server (IP Radius ดูจาก E-Mail ที่ได้รับ)
set secret (secret ดูจาก E-Mail ที่ได้รับ)
set nas-ip 172.16.10.1 (ใส่ ip Gateway ของขา LAN)
set acct-interim-interval 60
set radius-coa enable
set auth-type pap
```

<figure><img src="/files/tqnDD0ZBIKBWVpCG0h6q" alt=""><figcaption></figcaption></figure>

**การ Setting Radius Accounting  Copy คำสั่งไปวางบน Terminal ของ Fortigate ได้เลยครับ**

```
config accounting-server
edit 1
set status enable
set server (IP Radius ดูจาก E-Mail ที่ได้รับ)
set secret (secret ดูจาก E-Mail ที่ได้รับ)
set port 1813
```

<figure><img src="/files/ytm6WttvpLQzFpqFQ1s6" alt=""><figcaption></figcaption></figure>

**ถ้าทำครบตามขั้นตอนแล้ว เมื่อพิมพ์คำสั่ง show ควรจะได้ผลตามภาพนี้**&#x20;

<figure><img src="/files/S07S1FMm9JhdUhRzRCaR" alt=""><figcaption></figcaption></figure>

***

#### ตั้งค่า User Grops

1. **ไปที่ Menu User & Authentication**
2. **User Groups**
3. **กด Create New**

<figure><img src="/files/CF0g95IxbxIWiO5AdoY7" alt=""><figcaption></figcaption></figure>

1. **ตั้งชื่อ Group**
2. **กด Add เพื่อเพิ่ม Radius Server ให้กับ User Group**
3. **ตั้งค่าในส่วนของ Radius**

**Remote Server  :** เลือก Radius Server ที่เราสร้างก่อนหน้านี้

**Groups  :**  เลือกเป็น Specify  แล้วตั้งชื่อ Package (ชื่อ Package จะต้องตรงกับ ชื่อ Package บน Seara Cloud)&#x20;

<mark style="color:red;">หากบน Seara Cloud มี Package มากกว่า 1 Package  ให้เพิ่ม User Group ขึ้นมาใหม่ให้ครบตามจำนวนของ Package  และตั้งชื่อ User Group ให้ตรงกับชื่อ Package บน Seara Cloud ด้วย</mark>

<figure><img src="/files/3xN1zkf3OSLvv1OIbum7" alt=""><figcaption></figcaption></figure>

***

#### **การตั้งค่า Address**&#x20;

1. **เข้าไปที่ Menu Policy & Objects**
2. **เลือก Menu Address**
3. **กด Create New แล้วเลือก Address**

<figure><img src="/files/BIvWfc5OtANjPCUvxo4f" alt=""><figcaption></figcaption></figure>

**Name  :** ตั้งชื่อให้กับ Address

**Type  :** เลือก Type เป็น Subnet

**IP/Netmask  :**  ใส่ Network และ Subnetmask ของขา LAN

**Interface  :**  เลือก any

<figure><img src="/files/lB0utjJBkrVP2BTmiZfw" alt=""><figcaption></figcaption></figure>

**Create เพิ่มอีก 1 Address**

**Name  :**  ตั้งชื่อให้กับ Address

**Type  :** เลือก FQDN

**FQDN  :**  ใส่ Domain Name ของ Seara ที่ได้รับใน E-Mail  ซึ่งในตัวอย่างจะเป็น demo.seara-portal.net

<figure><img src="/files/ZL9FvBNofaw0n0yLfOdz" alt=""><figcaption></figcaption></figure>

***

#### **การตั้งค่า Interface สำหรับ Internal ( ขา LAN )**&#x20;

เลือก Interface สำหรับขา LAN ในตัวอย่างจะใช้ Interface ที่ชื่อ Internal 3

<figure><img src="/files/DnFyCPX5HzsDpkWvlbL4" alt=""><figcaption></figcaption></figure>

#### Config LAN Interface

**Alias  :**  ตั้งชื่อให้กับ Interface

**Address  :** กำหนด IP address สำหรับขา LAN

**Administrative Access  :** ตั้งค่าการเข้าถึง Interface ของขา LAN   (ให้ตั้งค่าตามภาพเลยนะครับ)

<figure><img src="/files/KYAv1efJhaCambYfJJdS" alt=""><figcaption></figcaption></figure>

#### ตั้งค่า DHCP Server&#x20;

**DHCP status  :**  คลิ๊ก Enable

**Address range  :**  ตั้งค่าช่วงของ dhcp ที่ต้องการแจกให้กับ Client

**Netmask  :** ตั้งค่า Subnetmask

**DNS server 1  :** ตั้งค่า primary dns

**DNS server 2  :** ตั้งค่า secondary DNS

<figure><img src="/files/9lVrpQn1oXucXL4v0Keq" alt=""><figcaption></figcaption></figure>

#### Network&#x20;

**Security mode  :** เลือกเป็น Captive Poral

**Authentication portal  :**  เลือกเป็น External  จากนั้นใส่ Domain Name ของ Seara ที่ได้รับจาก E-Mail แล้วตามด้วย path=/app/portal/login   ในตัวอย่าง Domain ชื่อ <https://demo.seara-portal.net>  จากนั้นเติม path เข้าไปก็จะเป็น  <https://demo.seara-portal.net/app/portal/login>

**User access  :** เลือกเป็น Restricted to Groups    จากนั้นให้เพิ่ม Package ที่ได้สร้างไว้ก่อนหน้านั้นให้ครบ

**Exempt destinations/services  :** เพิ่ม Address ที่เราได้สร้างไว้ให้ครบ

**Redirect after Captive Portal  :** เลือกเป็น Specific URL  จากนั้นใส่ Domain Name ของ Seara ของเรา ตามด้วย Path= /app/portal/welcome   ตั้งอย่างจะเป็น <https://demo.seara-portal.net/app/portal/welcome>

<mark style="color:green;">หากตั้งค่าครบแล้วให้กด OK</mark>

<figure><img src="/files/XrwgAgoTwZ7oPVxH7Vmg" alt=""><figcaption></figcaption></figure>

***

#### **Import SSL Certification**&#x20;

1. **ไปที่ Menu System**&#x20;
2. **เลือก Menu Certificates**
3. **กด Import  เลือก Local Certificate**&#x20;

<figure><img src="/files/qa5M0JfRWGbnCJ9THjMh" alt=""><figcaption></figcaption></figure>

1. **ไปที่ Menu PKCS#12 Certificate**
2. **Certificate with key file**

Upload file Certificate ของเราเข้าไป  (Certificate file ต้องแปลงเป็นไฟล์นามสกุล .pfx ก่อนนะครับ)

<mark style="color:green;">จากนั้นกด OK เพื่อ Save</mark>

<figure><img src="/files/tzHQyU0ESLJ4G1oCspy6" alt=""><figcaption></figcaption></figure>

**Password :** ใส่ Password สำหรับ Certificate File

**Certificate name :** ต้องชื่อ Domain name&#x20;

<figure><img src="/files/I9YyRpawIzheraODJ0kj" alt=""><figcaption></figcaption></figure>

***

#### **การตั้งค่า Firewall Policy**

เป็นการตกำหนด Policy ต่างๆเพื่อให้ Client สามารถใช้งาน Internet โดยการ Authentication&#x20;

1. **ไปที่ Menu Policy & Objects**
2. **เลือก Menu Firewall Policy**
3. **กด Create New**

<figure><img src="/files/QK6bmdipVHPd9MUQWlBJ" alt=""><figcaption></figcaption></figure>

**Name  :** ตั้งชื่อ Policy

**Incoming Interface  :** เลือก Interface ขา LAN

**Outgoing Interface  :** เลือก Interface ขา WAN

**Source  :** เลือก Address ที่เราสร้างขึ้นมาก่อนหน้านี้&#x20;

**Destination  :** All

**Acction  :** ACCEPT

<mark style="color:blue;">Firewall / Network Options</mark>

**NAT  :**  Enable ให้เป็นสีเขียว&#x20;

<figure><img src="/files/WBaNr0OPTZUvcMhV2Pky" alt=""><figcaption></figcaption></figure>

<mark style="color:blue;">**เพิ่ม SSL Certificate ใน Policy**</mark>

**SSL inspection  :**  กด Create

<figure><img src="/files/yodQ9oVLdhm57Bk0B9j6" alt=""><figcaption></figcaption></figure>

**Name  :**  ตั้งชื่อให้กับ SSL

*<mark style="color:blue;">**SSL Inspection Otions**</mark>*

**Enable SSL Inspection of  :**  เลือกเป็น Protecting SSL Server

**Server certificate  :** เลือก certificate ที่เรา Upload เข้าไปก่อนหน้านี้

*<mark style="color:blue;">**Protocol Port Mapping**</mark>*

**HTTPS  :**  443

<mark style="color:green;">จากนั้นกด OK เพื่อ Save</mark>

<figure><img src="/files/gPKg5yB9Y3ZvqDHuZ4Gy" alt=""><figcaption></figcaption></figure>

**SSL Inspection  :** เลือก Certificate ที่เราได้ตั้งชื่อไว้

<mark style="color:green;">จากนั้นกด OK เพื่อ Save Policy</mark>

<figure><img src="/files/ziYmnuJ1v3EWLD8gt1zh" alt=""><figcaption></figcaption></figure>

**เปิด CLI Console ของ Fortigate ขึ้นมา**

พิมพ์คำสั่งตาม Code ด้านล่าง &#x20;

* ตรง set auth-cert   ให้ใส่ชื่อ domain ที่เราตั้งไว้ตอน Import certificate file&#x20;

```
config user setting 

set auth-cert fortiseara.captive-portal.net 

end
```

<figure><img src="/files/PCo6zrVlKR4P08SFMxpp" alt=""><figcaption></figcaption></figure>

พิมพ์คำสั่งตาม Code ด้านล่าง &#x20;

* ตรง set portal-addr  ให้ใส่ชื่อ domain ที่เราตั้งไว้ตอน Import certificate file&#x20;

```
config firewall auth-portal 

set portal-addr fortiseara.captive-portal.net

end
```

<figure><img src="/files/6YVRsOdcO9Kms1BN5mfl" alt=""><figcaption></figcaption></figure>

#### Add Fortigate on Seara

1. ไปที่ link Domain ของ Seara ที่ได้รับจาก Email ตัวอย่างเช่น [https://demo.seara-portal.net](https://demo.seara-dev.net/)
2. Add Location :   เข้าไปที่ Menu Site บน Seara แล้วเพิ่มสถานที่    วิธี [Add Location](/site-management/site-management-1/location.md)
3. Add Device :   เข้าไปที่ Menu Site บน Seara แล้วกด เพิ่ม NAS  จากนั้นทำตามขั้นตอนดังในภาพ

<mark style="color:red;">ปล. IP WAN จะต้องเป็น Public IP แบบ Static เท่านั้น</mark>

<figure><img src="/files/RG5Q3PLPozKEihMSs830" alt=""><figcaption></figcaption></figure>

&#x20;                          **.............................. เสร็จสิ้นการ Config เบื้องต้น ..............................**
