วันอาทิตย์ที่ 15 พฤศจิกายน พ.ศ. 2569

Firewall - Palo vlan

 

Palo Alto Firewall Configuration Document

WAN DHCP + Cisco Layer 2 Switch + 5 VLANs + Separate Security Zones

ประเภทเอกสาร: Network Configuration & Implementation Guide
อุปกรณ์: Palo Alto Next-Generation Firewall
ระบบปฏิบัติการ: PAN-OS
Switch: Cisco Layer 2
WAN Connection: DHCP Client                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
จำนวน VLAN: 5 VLANs
Security Zone: Separate Zones


1. วัตถุประสงค์ (Objective)

เอกสารฉบับนี้จัดทำขึ้นเพื่อกำหนดแนวทางการ Configuration Palo Alto Firewall โดยเชื่อมต่อกับ Cisco Layer 2 Switch ผ่าน Interface ethernet1/2 และแบ่งเครือข่ายออกเป็น 5 VLAN ผ่าน Subinterface

Palo Alto Firewall ทำหน้าที่เป็น Default Gateway ของแต่ละ VLAN พร้อมควบคุมการรับส่งข้อมูลด้วย Security Policy และทำ Source NAT เพื่อให้ Client ภายในสามารถเชื่อมต่อ Internet ผ่าน WAN Interface ที่ได้รับ IP Address แบบ DHCP

วัตถุประสงค์หลัก

  1. แบ่ง Network ออกเป็น 5 VLAN
  2. กำหนด Subinterface บน Palo Alto Firewall
  3. แยก Security Zone ตาม VLAN
  4. กำหนด Security Policy สำหรับ Internet Access
  5. กำหนด NAT Policy สำหรับแปลง Private IP เป็น WAN IP
  6. กำหนด Routing เพื่อให้สามารถออก Internet ได้
  7. ตรวจสอบ Traffic Log และผลการเชื่อมต่อ

2. Network Topology

Network Diagram

INTERNET / ISP
↓
Palo Alto Firewall

  • ethernet1/1 = WAN DHCP
  • ethernet1/2 = LAN Trunk
  • ethernet1/2.10 = VLAN 10
  • ethernet1/2.20 = VLAN 20
  • ethernet1/2.30 = VLAN 30
  • ethernet1/2.40 = VLAN 40
  • ethernet1/2.50 = VLAN 50

↓ 802.1Q Trunk

Cisco Layer 2 Switch

↓
Client Devices แบ่งตาม VLAN 10, 20, 30, 40 และ 50

3. IP Address Design

กำหนด IP Address สำหรับแต่ละ VLAN ดังนี้

VLANSubinterfaceNetworkGatewaySecurity Zone
10e1/2.10192.168.10.0/24192.168.10.1ZONE-VLAN10
20e1/2.20192.168.20.0/24192.168.20.1ZONE-VLAN20
30e1/2.30192.168.30.0/24192.168.30.1ZONE-VLAN30
40e1/2.40192.168.40.0/24192.168.40.1ZONE-VLAN40
50e1/2.50192.168.50.0/24192.168.50.1ZONE-VLAN50

WAN Interface:

  • Interface: ethernet1/1
  • Interface Type: Layer3
  • IPv4: DHCP Client
  • Security Zone: Untrust
  • Virtual Router: default

4. Configure WAN Interface (DHCP)

เข้า Palo Alto Web GUI

Menu: Network → Interfaces → Ethernet → ethernet1/1

กำหนดค่าดังนี้


ParameterConfiguration
Interfaceethernet1/1
Interface TypeLayer3
Virtual Routerdefault
Security ZoneUntrust
IPv4 TypeDHCP Client
Automatically Create Default RouteEnable
Default Route Metric10

ตรวจสอบว่า WAN ได้รับข้อมูลจาก ISP ดังนี้

  • IP Address
  • Subnet Mask
  • Default Gateway
  • DNS (ถ้ามีการแจกผ่าน DHCP)

หมายเหตุ: เปิด Automatically create default route pointing to default gateway provided by server เพื่อให้ Firewall รับ Default Route จาก DHCP Server ของ ISP

5. Configure LAN Physical Interface

เข้าเมนู:

Network → Interfaces → Ethernet → ethernet1/2

กำหนดค่า:

ParameterConfiguration
Interfaceethernet1/2
Interface TypeLayer3
Virtual Routerdefault
Security ZoneNone
IPv4 Addressไม่กำหนด

Interface ethernet1/2 จะทำหน้าที่เป็น Parent Interface สำหรับ Subinterface ทั้ง 5 VLAN

6. Configure Subinterface

เข้าเมนู:

Network → Interfaces → Ethernet

เลือก ethernet1/2 และสร้าง Subinterface จำนวน 5 รายการ

InterfaceVLAN TagIPv4 AddressSecurity Zone
ethernet1/2.1010192.168.10.1/24ZONE-VLAN10
ethernet1/2.2020192.168.20.1/24ZONE-VLAN20
ethernet1/2.3030192.168.30.1/24ZONE-VLAN30
ethernet1/2.4040192.168.40.1/24ZONE-VLAN40
ethernet1/2.5050192.168.50.1/24ZONE-VLAN50

กำหนดค่าของแต่ละ Subinterface:

  • Interface Type: Layer3
  • Tag: กำหนดตาม VLAN
  • Virtual Router: default
  • Security Zone: กำหนดแยกตาม VLAN
  • IPv4 Address: Static

ตัวอย่าง VLAN 10:

Interface: ethernet1/2.10
Tag: 10
Virtual Router: default
Security Zone: ZONE-VLAN10
IPv4 Address: 192.168.10.1/24

ดำเนินการเช่นเดียวกันสำหรับ VLAN ที่เหลือ

7. Configure Security Zones

เข้าเมนู:

Network → Zones → Add

สร้าง Security Zone ดังนี้

Zone NameZone TypeInterface
ZONE-VLAN10Layer3ethernet1/2.10
ZONE-VLAN20Layer3ethernet1/2.20
ZONE-VLAN30Layer3ethernet1/2.30
ZONE-VLAN40Layer3ethernet1/2.40
ZONE-VLAN50Layer3ethernet1/2.50
UntrustLayer3ethernet1/1

การแยก Security Zone จะช่วยให้สามารถกำหนด Security Policy และควบคุมการรับส่งข้อมูลของแต่ละ VLAN ได้อย่างอิสระ

8. Configure Cisco Layer 2 Switch

กำหนด Cisco Switch ให้รองรับ VLAN 10, 20, 30, 40 และ 50

สมมติการเชื่อมต่อ:

  • Gi1/0/24 = Uplink ไป Palo Alto ethernet1/2
  • Gi1/0/1 = Client VLAN10
  • Gi1/0/2 = Client VLAN20
  • Gi1/0/3 = Client VLAN30
  • Gi1/0/4 = Client VLAN40
  • Gi1/0/5 = Client VLAN50

Cisco Switch Configuration

cisco
configure terminal

vlan 10
 name VLAN10
vlan 20
 name VLAN20
vlan 30
 name VLAN30
vlan 40
 name VLAN40
vlan 50
 name VLAN50

interface GigabitEthernet1/0/24
 description UPLINK-TO-PALOALTO-E1/2
 switchport mode trunk
 switchport trunk allowed vlan 10,20,30,40,50
 no shutdown
exit

interface GigabitEthernet1/0/1
 description CLIENT-VLAN10
 switchport mode access
 switchport access vlan 10
 spanning-tree portfast
 no shutdown
exit

interface GigabitEthernet1/0/2
 description CLIENT-VLAN20
 switchport mode access
 switchport access vlan 20
 spanning-tree portfast
 no shutdown
exit

interface GigabitEthernet1/0/3
 description CLIENT-VLAN30
 switchport mode access
 switchport access vlan 30
 spanning-tree portfast
 no shutdown
exit

interface GigabitEthernet1/0/4
 description CLIENT-VLAN40
 switchport mode access
 switchport access vlan 40
 spanning-tree portfast
 no shutdown
exit

interface GigabitEthernet1/0/5
 description CLIENT-VLAN50
 switchport mode access
 switchport access vlan 50
 spanning-tree portfast
 no shutdown
exit

end
write memory

ตรวจสอบ Cisco Switch

cisco
show vlan brief
show interfaces trunk
show interfaces status

หมายเหตุ: คำสั่งอาจแตกต่างกันตามรุ่น Cisco Switch และ IOS ที่ใช้งาน

9. Configure Security Policy

เข้าเมนู:

Policies → Security → Add

สร้าง Policy Name:

ALLOW-ALL-VLAN-TO-INTERNET

กำหนดค่าดังนี้

General

  • Name: ALLOW-ALL-VLAN-TO-INTERNET
  • Rule Type: universal

Source

  • Source Zone:
    • ZONE-VLAN10
    • ZONE-VLAN20
    • ZONE-VLAN30
    • ZONE-VLAN40
    • ZONE-VLAN50
  • Source Address: กำหนด Network ทั้ง 5 VLAN

Destination

  • Destination Zone: Untrust
  • Destination Address: any

Application

  • Application: any
  • Service: application-default

Actions

  • Action: Allow
  • Log at Session End: Enable

Source Network:

  • 192.168.10.0/24
  • 192.168.20.0/24
  • 192.168.30.0/24
  • 192.168.40.0/24
  • 192.168.50.0/24

หมายเหตุ: Policy นี้อนุญาตทุก Application จาก VLAN ที่ระบุไปยัง Untrust หากต้องการจำกัด Application ให้กำหนด Application ที่อนุญาต เช่น ping, web-browsing และ ssl

ควรตรวจสอบลำดับ Security Policy และ Rule ที่มีอยู่ก่อนสร้าง Policy ใหม่

10. Configure NAT Policy

เข้าเมนู:

Policies → NAT → Add

สร้าง NAT Policy Name:

NAT-ALL-VLAN-TO-INTERNET

Original Packet

ParameterConfiguration
Source ZoneZONE-VLAN10, 20, 30, 40, 50
Destination ZoneUntrust
Destination Interfaceany
Source Address5 VLAN Subnets
Destination Addressany
Serviceany

Translated Packet

ParameterConfiguration
Source TranslationDynamic IP and Port
Address TypeInterface Address
Interfaceethernet1/1
IP AddressDHCP-assigned WAN IP

NAT จะทำหน้าที่แปลง Source IP จาก Private Network ให้เป็น IP Address ของ WAN Interface เพื่อให้ Client สามารถเชื่อมต่อ Internet ได้

หมายเหตุ:

  • WAN Interface ต้องได้รับ DHCP Address ก่อน
  • เลือก ethernet1/1 ใน Interface Address
  • ไม่จำเป็นต้องกำหนด Public IP แบบ Static
  • ตรวจสอบลำดับ NAT Rule เพื่อไม่ให้ชนกับ Rule อื่น

11. Configure Routing

เข้าเมนู:

Network → Virtual Routers → default → Static Routes

ตรวจสอบ WAN Interface ethernet1/1 ว่ากำหนด DHCP Client และเปิดตัวเลือก Automatically create default route pointing to default gateway provided by server

Routing Table ที่คาดหวัง:

DestinationNext HopInterface
192.168.10.0/24Connectede1/2.10
192.168.20.0/24Connectede1/2.20
192.168.30.0/24Connectede1/2.30
192.168.40.0/24Connectede1/2.40
192.168.50.0/24Connectede1/2.50
0.0.0.0/0DHCP Gatewaye1/1

หมายเหตุ: Subinterface จะสร้าง Connected Route โดยอัตโนมัติเมื่อกำหนด IP Address และทำงานอยู่ ส่วน Default Route จะเรียนรู้จาก DHCP WAN

ไม่ควรสร้าง Default Route ซ้ำ หาก DHCP ได้สร้าง Default Route ให้อยู่แล้ว

12. Configure DHCP Server (Optional)

หากต้องการให้ Palo Alto เป็น DHCP Server สำหรับ Client แต่ละ VLAN สามารถตั้งค่าได้ที่:

Network → DHCP → DHCP Server → Add

ตัวอย่าง DHCP Pool:

VLANDHCP PoolDefault Gateway
10192.168.10.10–192.168.10.200192.168.10.1
20192.168.20.10–192.168.20.200192.168.20.1
30192.168.30.10–192.168.30.200192.168.30.1
40192.168.40.10–192.168.40.200192.168.40.1
50192.168.50.10–192.168.50.200192.168.50.1

DNS Server ตัวอย่าง:

  • 1.1.1.1
  • 8.8.8.8

หากมี DHCP Server ภายนอกอยู่แล้ว ไม่จำเป็นต้องเปิด DHCP Server บน Palo Alto

13. Commit Configuration

ก่อน Commit ให้ตรวจสอบรายการต่อไปนี้

  • WAN ethernet1/1 ได้รับ DHCP IP
  • WAN ได้รับ Default Gateway
  • ethernet1/2 กำหนดเป็น Layer3
  • สร้าง Subinterface ครบ 5 VLAN
  • กำหนด VLAN Tag ถูกต้อง
  • สร้าง Security Zone ครบ 5 Zone
  • Cisco Switch Uplink เป็น Trunk
  • กำหนด Security Policy แล้ว
  • กำหนด NAT Policy แล้ว
  • ตรวจสอบ Routing แล้ว
  • ตรวจสอบ Configuration ไม่มี Error

จากนั้นดำเนินการ:

  1. คลิก Commit
  2. เลือก Commit All Changes ตามสิทธิ์และรูปแบบการจัดการ Configuration
  3. รอจน Commit สำเร็จ
  4. ตรวจสอบ Interface และ Routing Table อีกครั้ง

14. Testing & Verification

14.1 ตรวจสอบ Client IP Address

VLANClient IPGateway
10192.168.10.10192.168.10.1
20192.168.20.10192.168.20.1
30192.168.30.10192.168.30.1
40192.168.40.10192.168.40.1
50192.168.50.10192.168.50.1

14.2 ทดสอบ Ping Gateway

จาก Client แต่ละ VLAN:

text
ping 192.168.10.1
ping 192.168.20.1
ping 192.168.30.1
ping 192.168.40.1
ping 192.168.50.1

ให้ทดสอบเฉพาะ Gateway ของ VLAN ที่ Client เชื่อมต่ออยู่

14.3 ทดสอบ Internet

text
ping 1.1.1.1

ทดสอบ HTTPS และ DNS เพิ่มเติม เพื่อยืนยันการใช้งาน Internet

14.4 ตรวจสอบ Traffic Log

เข้าเมนู:

Monitor → Logs → Traffic

Filter VLAN 10:

text
(addr.src in 192.168.10.10)

Filter VLAN 20:

text
(addr.src in 192.168.20.10)

Filter Traffic ที่ Allow ออก Internet:

text
(zone.dst eq Untrust) and (action eq allow)

ตรวจสอบ Field ดังนี้:

FieldExpected
SourceClient IP
Destination ZoneUntrust
Applicationping / web-browsing / ssl
Actionallow
NAT SourceWAN Interface IP

15. Test Acceptance Criteria

Test ItemExpected Result
VLAN 10 GatewayPASS
VLAN 20 GatewayPASS
VLAN 30 GatewayPASS
VLAN 40 GatewayPASS
VLAN 50 GatewayPASS
VLAN 10 InternetPASS
VLAN 20 InternetPASS
VLAN 30 InternetPASS
VLAN 40 InternetPASS
VLAN 50 InternetPASS
Security PolicyAllow
Source NATCorrect
Default RoutingActive
VLAN-to-VLANDeny หากไม่มี Policy อนุญาต

16. Troubleshooting

กรณี Client Ping Gateway ไม่ได้

  • ตรวจสอบ VLAN Access Port บน Cisco Switch
  • ตรวจสอบ Trunk Port
  • ตรวจสอบ VLAN Tag
  • ตรวจสอบ Subinterface และ IP Address

กรณี Ping Gateway ได้ แต่ Internet ไม่ได้

  • ตรวจสอบ WAN DHCP
  • ตรวจสอบ Default Route
  • ตรวจสอบ Security Policy
  • ตรวจสอบ NAT Policy
  • ตรวจสอบ DNS

กรณี Traffic Log เป็น Deny

  • ตรวจสอบ Source Zone
  • ตรวจสอบ Destination Zone
  • ตรวจสอบ Security Policy Rule Order
  • ตรวจสอบ Application และ Service

กรณี NAT ไม่ทำงาน

  • ตรวจสอบ Original Source Zone
  • ตรวจสอบ Destination Zone
  • ตรวจสอบ Source Address
  • ตรวจสอบ Translated Packet
  • ตรวจสอบ WAN Interface Address

17. Final Configuration Summary

ComponentConfiguration
WAN Interfaceethernet1/1 DHCP
LAN Interfaceethernet1/2 Layer3
SwitchCisco Layer 2
Uplink802.1Q Trunk
VLAN Count5
Subinterfaceethernet1/2.10–50
Security Zones5 Separate Zones
Virtual Routerdefault
Security PolicyVLAN to Untrust Allow
NAT PolicyDynamic IP and Port
NAT Interfaceethernet1/1
RoutingDHCP Default Route
DHCP ServerOptional

Network Traffic Flow

Client VLAN → Cisco Layer 2 Switch → Palo Alto Subinterface → Security Policy → Source NAT → WAN Interface → Internet


18. Conclusion

การ Configuration นี้เป็นการออกแบบระบบ Network โดยใช้ Palo Alto Firewall เป็นศูนย์กลางในการควบคุมและรักษาความปลอดภัยของเครือข่าย แบ่ง Network ออกเป็น 5 VLAN และกำหนด Security Zone แยกจากกัน เพื่อให้สามารถควบคุมการรับส่งข้อมูลได้อย่างเป็นอิสระ

ระบบสามารถรองรับการเชื่อมต่อ Internet ผ่าน WAN DHCP โดยใช้ Dynamic IP and Port NAT และกำหนด Default Route จาก DHCP Gateway ของ ISP

เมื่อ Configuration และ Testing สำเร็จ Client ในแต่ละ VLAN จะสามารถเชื่อมต่อ Internet ได้ตาม Security Policy ที่กำหนด

หมายเหตุ: ค่า IP Address และ Interface ในเอกสารนี้เป็นตัวอย่างสำหรับการออกแบบ ต้องตรวจสอบกับระบบจริงก่อนนำไปใช้งาน และควรสำรอง Configuration ก่อนดำเนินการเปลี่ยนแปลง


Document Status: Draft
Prepared For: Network Implementation
Configuration Platform: Palo Alto PAN-OS / Cisco Layer 2
End of Document