Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบเครือข่าย >> ความปลอดภัยเครือข่าย

สร้าง Inbound Rule สำหรับพอร์ต RADIUS ใน Azure Network Security Group

Azure Network Security Group (NSG) Inbound Rule

NSG เป็นกลุ่มกฎความปลอดภัยที่บังคับใช้กับทรัพยากร Azure (VM, Subnet, NIC) ควบคุมทรัฟฟิก Inbound (เข้า) และ Outbound (ออก) ตาม Source, Destination, Port, Protocol

พอร์ต RADIUS มาตรฐาน

บริการพอร์ตโปรโตคอลคำอธิบาย
RADIUS Authentication1812UDPยืนยันตัวตนผู้ใช้ (Access-Request/Access-Accept/Reject)
RADIUS Accounting1813UDPบันทึกการใช้งาน (Accounting-Request/Response)
RADIUS (Legacy)1645, 1646UDPพอร์ตเก่า ใช้บ้างในอุปกรณ์ Network รุ่นเก่า

ขั้นตอนสร้าง Inbound Rule สำหรับ RADIUS ใน Azure Portal

  1. เข้า Azure Portal > ค้นหา "Network Security Groups" > เลือก NSG ของคุณ
  2. เมนูซ้าย: Settings > Inbound security rules > + Add
  3. กรอกข้อมูล:
    • 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
  4. คลิก 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

  1. NSG > Settings > Subnets / Network interfaces > + Associate
  2. เลือก VNet > Subnet หรือ NIC ของ VM
  3. 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