Azure Network Security Group (NSG) Inbound Rule
NSG เป็นกลุ่มกฎความปลอดภัยที่บังคับใช้กับทรัพยากร Azure (VM, Subnet, NIC) ควบคุมทรัฟฟิก Inbound (เข้า) และ Outbound (ออก) ตาม Source, Destination, Port, Protocol
พอร์ต RADIUS มาตรฐาน
| บริการ | พอร์ต | โปรโตคอล | คำอธิบาย |
|---|---|---|---|
| RADIUS Authentication | 1812 | UDP | ยืนยันตัวตนผู้ใช้ (Access-Request/Access-Accept/Reject) |
| RADIUS Accounting | 1813 | UDP | บันทึกการใช้งาน (Accounting-Request/Response) |
| RADIUS (Legacy) | 1645, 1646 | UDP | พอร์ตเก่า ใช้บ้างในอุปกรณ์ Network รุ่นเก่า |
ขั้นตอนสร้าง Inbound Rule สำหรับ RADIUS ใน Azure Portal
- เข้า Azure Portal > ค้นหา "Network Security Groups" > เลือก NSG ของคุณ
- เมนูซ้าย: Settings > Inbound security rules > + Add
- กรอกข้อมูล:
- Source: Any / IP Addresses (ระบุ IP ของ RADIUS Client/NAS เช่น VPN Gateway, Switch, AP)
- Source port ranges: * (ทั้งหมด)
- Destination: Any / IP Addresses (IP ของ RADIUS Server/VM ใน Azure)
- Service: Custom
- Destination port ranges:
1812,1813(หรือ 1812-1813) - Protocol: UDP
- Action: Allow
- Priority: 100-4096 (ตัวเลขน้อย = ความสำคัญสูง ประมวลผลก่อน)
- Name: Allow-RADIUS-Inbound
- Description: Allow RADIUS Auth (1812) and Acct (1813) from on-prem NAS
- คลิก Add
ผ่าน Azure CLI / PowerShell
# Azure CLI
az network nsg rule create \
--resource-group myResourceGroup \
--nsg-name myNSG \
--name Allow-RADIUS-Inbound \
--priority 200 \
--source-address-prefixes 192.168.1.0/24 \
--destination-address-prefixes '*' \
--destination-port-ranges 1812 1813 \
--protocol Udp \
--access Allow \
--description "Allow RADIUS from on-prem"
# PowerShell
$rule = New-AzNetworkSecurityRuleConfig -Name "Allow-RADIUS-Inbound" `
-Description "Allow RADIUS Auth/Acct" `
-Access Allow -Protocol Udp -Direction Inbound -Priority 200 `
-SourceAddressPrefix "192.168.1.0/24" -SourcePortRange "*" `
-DestinationAddressPrefix "*" -DestinationPortRange "1812-1813"
แนวทางปฏิบัติที่ดีที่สุด (Best Practices)
- จำกัด Source IP: ระบุเฉพาะ IP/CIDR ของ RADIUS Client (NAS, VPN, Switch) ไม่ใช่ Any
- ใช้ Application Security Group (ASG): จัดกลุ่ม VM ที่เป็น RADIUS Server ให้เป็น ASG แล้วอ้างอิง ASG ใน Rule
- Logging: เปิด NSG Flow Logs ส่งไป Log Analytics / Storage Account เพื่อ Audit
- Just-in-Time (JIT) VM Access: สำหรับ Management Ports (RDP/SSH) ไม่ใช่ RADIUS
- Priority: ให้ Priority ต่ำกว่า (หมายเลขน้อยกว่า) Default Rules (65000+)
กำหนด NSG ให้กับ VM/Subnet
- NSG > Settings > Subnets / Network interfaces > + Associate
- เลือก VNet > Subnet หรือ NIC ของ VM
- OK
ทดสอบการเชื่อมต่อ RADIUS
จาก On-prem RADIUS Client (NAS): radtest user pass 10.0.0.4 1812 testing123 (10.0.0.4 = Azure RADIUS Server Private IP) ตรวจสอบ NSG Flow Logs ว่า Allow/Deny