Securing Wazuh with UniFi: Network Configuration for SIEM Deployment
This article was written with the help of Sonnet 4.5 on Claude.ai. All outputs were reviewed for accuracy and confirmed working on UniFi OS…
Securing Wazuh with UniFi: Network Configuration for SIEM Deployment
This article was written with the help of Sonnet 4.5 on Claude.ai. All outputs were reviewed for accuracy and confirmed working on UniFi OS 5.0.12.
Overview
This guide focuses exclusively on configuring UniFi OS 5.0.12 to support a Wazuh SIEM deployment. It assumes you already have a Wazuh server installed and running, and covers the network configuration needed to enable both internal and external agent connectivity while maintaining security through VLAN isolation and controlled firewall policies.
Prerequisites:
- Wazuh server already installed and configured
- Wazuh dashboard configured on port 8443
- DuckDNS subdomain registered and pointing to your public IP
- Cloud Gateway Ultra running UniFi OS 5.0.12
- Static IP assigned to Wazuh server
What This Guide Covers:
- Port forwarding for external agent connectivity
- Firewall policies for internal agent access
- Teleport VPN access for secure dashboard access
- Network isolation best practices
What This Guide Does NOT Cover:
- Wazuh server installation
- Wazuh configuration
- Agent installation and deployment
Understanding the Network Requirements
Wazuh Communication Ports
Agent Communication:
- Port 1514 (TCP): Agent log transmission and communication
- Port 1515 (TCP): Agent enrollment and authentication
Dashboard Access:
- Port 8443 (HTTPS): Wazuh web interface (changed from default 443 to avoid conflict with UniFi OS)
Network Access Patterns
External Agents:
- Laptops, mobile devices outside your network
- Connect via DuckDNS hostname (e.g.,
yourdomain.duckdns.org) - Route through port forwarding on ports 1514 and 1515
Internal Agents:
- Workstations, servers on your local VLANs
- Can use DuckDNS hostname (hairpin NAT) or local IP
- Require firewall policies to reach Wazuh VLAN
Dashboard Access:
- Never exposed directly to internet
- Access via Teleport VPN for security
- Requires port 8443 access through firewall
Why This Configuration?
Single Agent Configuration: Using DuckDNS for all agents means laptops work seamlessly whether at home or traveling. No need to maintain separate configurations or reconfigure when location changes.
Security Through Isolation: Wazuh server on dedicated VLAN with controlled access prevents unauthorized systems from reaching sensitive security infrastructure.
Secure Remote Access: Dashboard access through Teleport VPN eliminates internet exposure while enabling administration from anywhere.
Part 1: Prerequisites and Preparation
Verify Wazuh Server Configuration
Before configuring UniFi, confirm:
- Wazuh server is accessible locally at its static IP on port 8443
- Static IP is assigned to Wazuh server in UniFi
- Wazuh is on isolated VLAN (typically security or monitoring VLAN)
- DuckDNS is configured and resolving to your public IP
Verify UniFi Teleport VPN
Ensure Teleport VPN is enabled and functioning:
- Navigate to Settings → Teleport & VPN
- Verify Teleport VPN shows as “Active”
- Test connection from WiFiman app or Teleport client
Create Teleport VPN Network List
You’ll need a network list for Teleport VPN clients to use in firewall policies:
- Navigate to Settings → Profiles → Network Lists
- Click Add New
- Configure:
- Name: Teleport VPN Clients
- Type: IPv4
- Address/Subnet: Your Teleport subnet (verify by connecting to Teleport and checking assigned IP)
- Click Save
Finding Your Teleport Subnet:
- Connect to Teleport VPN via WiFiman app
- Check your assigned IP address
- Use the first three octets with .0/24 (e.g., if assigned 192.168.13.5, subnet is 192.168.13.0/24)
Part 2: Port Forwarding Configuration
Port forwarding enables external agents to connect to your Wazuh server from anywhere using your DuckDNS hostname.
Step 1: Forward Agent Communication Port
- Navigate to Settings → Policy Engine
- Click Create New Policy
- Select Port Forwarding
- Configure:
- Name: Wazuh Agent Communication
- WAN Interface: WAN1 (Default)
- WAN Port: 1514
- From: Any
- Forward IP Address: Your Wazuh server’s static IP (Select Device)
- Forward Port: 1514
- Protocol: TCP
- Click Add
Step 2: Forward Agent Enrollment Port
- Navigate to Settings → Policy Engine
- Click Create New Policy
- Select Port Forwarding
- Configure:
- Name: Wazuh Agent Enrollment
- WAN Interface: WAN1 (Default)
- WAN Port: 1515
- From: Any
- Forward IP Address: Your Wazuh server’s static IP (Select Device)
- Forward Port: 1515
- Protocol: TCP
- Click Add
Understanding Port Forwarding
What Happens:
- External agent resolves
yourdomain.duckdns.orgto your public IP - Agent connects to public IP on port 1514 or 1515
- Cloud Gateway forwards traffic to Wazuh server’s internal IP
- Agent communicates with Wazuh server
Security Note: Only ports 1514 and 1515 are exposed. Dashboard port 8443 is NOT forwarded, keeping it inaccessible from internet.
Part 3: Firewall Policy Configuration
Policy 1: External Access to Wazuh
This policy allows external agents to reach your Wazuh server through port forwarding:
- Navigate to Settings → Policy Engine
- Click Create New Policy
- Select Firewall
- Configure:
- Name: External to Wazuh
- Source Zone: External
- Source Port: Any
- Action: Allow
- Auto Allow Return Traffic: Checked
- Destination Zone: Internal
- Check box for IP Address
- Destination IP: Your Wazuh server’s static IP
- Destination Port: 1514,1515
- Protocol: TCP
- Click Add Policy
Policy 2: Internal Access to Wazuh
This policy allows devices on your internal VLANs to reach the Wazuh server:
- Navigate to Settings → Policy Engine
- Click Create New Policy
- Select Firewall
- Configure:
- Name: Internal to Wazuh
- Source Zone: Internal
- Source Networks: Select all VLANs with agents (workstations, servers, IoT devices, etc.)
- Source Port: Any
- Action: Allow
- Auto Allow Return Traffic: Checked
- Destination Zone: Internal
- Check box for IP Address
- Destination IP: Your Wazuh server’s static IP
- Destination Port: 1514,1515
- Protocol: TCP
- Click Add Policy
Which VLANs to Include:
- Workstation/laptop VLANs
- Server VLANs
- IoT device VLANs (if monitoring smart home devices)
- Any VLAN with systems you want to monitor
Policy 3: Teleport VPN Access to Dashboard
This policy enables secure remote access to the Wazuh dashboard:
- Navigate to Settings → Policy Engine
- Click Create New Policy
- Select Firewall
- Configure:
- Name: Teleport to Wazuh
- Source Zone: External
- Source: IP
- Source Type: List
- Source List: Teleport VPN Clients
- Source Port: Any
- Action: Allow
- Auto Allow Return Traffic: Checked
- Destination Zone: Internal
- Check box for IP Address
- Destination IP: Your Wazuh server’s static IP
- Destination Port: 8443
- Protocol: TCP
- Click Add Policy
Part 4: Understanding Hairpin NAT
What is Hairpin NAT?
When internal agents use your DuckDNS hostname instead of a local IP:
- Agent resolves
yourdomain.duckdns.orgto your public IP - Traffic routes to your WAN interface
- Port forwarding sends it back to internal Wazuh server
- Connection succeeds
This “loopback” behavior is called hairpin NAT or NAT reflection.
Why Use DuckDNS for Internal Agents?
Benefits:
- Single configuration: Laptops that travel use the same config at home and away
- No management overhead: No need to track which agents are internal vs external
- Automatic failover: Agent works regardless of location
- Simplified deployment: One agent configuration for all systems
How It Works:
- At home: Hairpin NAT routes traffic back to internal server
- Away: Standard port forwarding handles external connection
- Agent doesn’t know or care about location
Verifying Hairpin NAT
Test from an internal device:
# Test agent communication port
nc -zv yourdomain.duckdns.org 1514
# Test agent enrollment port
nc -zv yourdomain.duckdns.org 1515
Both should connect successfully, confirming hairpin NAT is working.
If Tests Fail:
- Verify port forwarding is configured correctly
- Check that “Internal to Wazuh” firewall policy includes the testing device’s VLAN
- Ensure DuckDNS is resolving to your current public IP
Part 5: Accessing Wazuh Dashboard
Remote Access via Teleport VPN
From Mobile Device:
- Open WiFiman app
- Tap Teleport icon
- Connect to your home network
- Open browser
- Navigate to
[https://wazuh-server-ip:8443](https://wazuh-server-ip:8443) - Login with Wazuh credentials
From Computer:
- Install UniFi Teleport app or use WiFiman
- Connect to Teleport VPN
- Open browser
- Navigate to
https://wazuh-server-ip:8443orhttps://wazuh.local:8443(if local DNS configured) - Accept security certificate warning (self-signed)
- Login with Wazuh credentials
Local Access (On Internal Network)
From any device on VLANs with access to the Wazuh server:
- Navigate to
[https://wazuh-server-ip:8443](https://wazuh-server-ip:8443) - Accept certificate warning
- Login with credentials
Why Not Expose Dashboard to Internet?
Security Risks of Direct Exposure:
- Dashboard provides complete visibility into your network security
- Contains sensitive security event data
- Exposed interfaces are prime targets for attacks
- Additional attack surface for credential stuffing
Benefits of Teleport VPN Access:
- Dashboard never exposed to internet
- VPN provides encryption and authentication
- Can access entire home network securely
- No additional ports to manage or secure
Part 6: Testing and Verification
Test External Agent Connectivity
From outside your network (cellular data):
# Test agent ports
nc -zv yourdomain.duckdns.org 1514
nc -zv yourdomain.duckdns.org 1515
Both should show successful connection.
Test Internal Agent Connectivity
From device on internal VLAN:
# Using DuckDNS (tests hairpin NAT)
nc -zv yourdomain.duckdns.org 1514
nc -zv yourdomain.duckdns.org 1515
# Using local IP (tests internal policy)
nc -zv wazuh-server-ip 1514
nc -zv wazuh-server-ip 1515
All tests should succeed.
Test Dashboard Access
Via Teleport:
- Connect to Teleport VPN
- Access
[https://wazuh-server-ip:8443](https://wazuh-server-ip:8443) - Should load dashboard login
Without VPN (should fail):
- Disconnect from Teleport
- Try accessing
[https://yourdomain.duckdns.org:8443](https://yourdomain.duckdns.org:8443) - Should timeout (port not forwarded)
Verify in UniFi Analytics
Check Port Forwarding:
- Navigate to Insights → Traffic
- Filter by destination IP (Wazuh server)
- Should see connections on ports 1514 and 1515
Check Policy Usage:
- View firewall policies in Policy Engine
- Policies should show traffic counters
- Confirms policies are active and being used
Part 7: Security Best Practices
Network-Level Security
- Isolate Wazuh Server:
- Keep on dedicated VLAN
- Separate from production workloads
- Apply principle of least privilege for access
2. Review Firewall Policies Regularly:
- Quarterly review which VLANs have access
- Remove access for decommissioned networks
- Verify policies match current infrastructure
3. Monitor External Connections:
- Use UniFi traffic analytics
- Alert on unusual connection patterns
- Review connection sources regularly
4. Limit Dashboard Exposure:
- NEVER forward port 8443 to internet
- Always use Teleport VPN for remote access
- Consider IP whitelisting for additional security
Port Forwarding Security
- Only Forward Required Ports:
- Ports 1514 and 1515 only
- Dashboard port 8443 stays internal
- No unnecessary exposure
2. Monitor Port Forwarding Rules:
- Document all forwarding rules
- Review annually or when infrastructure changes
- Remove unused rules promptly
3. DuckDNS Security:
- Keep token secure
- Update IP addresses automatically
- Monitor for unauthorized changes
Teleport VPN Security
- Strong Ubiquiti Account:
- Use complex password
- Enable two-factor authentication
- Don’t share credentials
2. Monitor VPN Access:
- Review Teleport connection logs
- Alert on connections from unexpected locations
- Disable if not actively used
3. Keep Teleport Updated:
- Update UniFi OS regularly
- Review Teleport release notes
- Test after major updates
Part 8: Troubleshooting Common Issues
External Agents Can’t Connect
Symptoms:
- Agent shows disconnected in Wazuh dashboard
- Connection timeouts on ports 1514/1515
- Agent logs show connection failures
Solutions:
- Verify DuckDNS resolves to correct public IP
- Check port forwarding rules are active
- Confirm “External to Wazuh” firewall policy is enabled
- Test ports from external network:
nc -zv yourdomain.duckdns.org 1514 - Check UniFi logs for blocked connections
Internal Agents Can’t Connect
Symptoms:
- Hardwired agents work but WiFi agents fail
- Agents on some VLANs work, others don’t
- Hairpin NAT test fails
Solutions:
- Verify agent’s VLAN is in “Internal to Wazuh” policy’s Source Networks
- Check that VLAN has isolation enabled (if isolated, needs explicit policy)
- Confirm Wazuh server’s static IP hasn’t changed
- Test connection:
nc -zv wazuh-server-ip 1514 - Review firewall logs for blocked traffic
Can’t Access Dashboard via Teleport
Symptoms:
- Connection timeout to dashboard
- Certificate errors
- “This site can’t be reached”
Solutions:
- Verify Teleport VPN connection is active (green in WiFiman)
- Confirm “Teleport to Wazuh” policy is enabled
- Check Teleport network list includes correct subnet
- Verify Wazuh dashboard is running:
sudo systemctl status wazuh-dashboard - Test local access first (from device on internal VLAN)
Hairpin NAT Not Working
Symptoms:
- Internal agents using DuckDNS can’t connect
- External connection works, internal doesn’t
- Port tests fail from internal network
Solutions:
- Verify Cloud Gateway Ultra supports hairpin NAT (it should)
- Check “Internal to Wazuh” firewall policy includes testing device’s VLAN
- Confirm port forwarding rules are correct
- Test using local IP instead:
nc -zv wazuh-server-ip 1514 - If local IP works but DuckDNS doesn’t, hairpin NAT may be disabled
Conclusion
Proper UniFi network configuration is essential for secure and functional Wazuh SIEM deployment. By implementing port forwarding for external agents, targeted firewall policies for internal access, and Teleport VPN for dashboard administration, you’ve created a network architecture that balances security with operational needs.
What You’ve Accomplished:
Secure External Access: Traveling laptops and remote devices can connect to your Wazuh server from anywhere while maintaining security through controlled port forwarding and firewall policies.
Internal Network Isolation: Wazuh server operates on an isolated VLAN, accessible only through explicit firewall policies. Even compromised systems on other VLANs cannot reach your security infrastructure without authorization.
Unified Agent Configuration: Using DuckDNS for all agents provides seamless connectivity whether devices are at home or traveling. Hairpin NAT ensures the same configuration works in both scenarios without manual intervention.
Protected Dashboard Access: The Wazuh dashboard is never exposed to the internet. Remote access requires Teleport VPN connection, adding authentication and encryption layers while enabling secure administration from anywhere.
Enterprise-Grade Network Security: The techniques demonstrated — VLAN isolation, IP-based firewall targeting, controlled port forwarding, and VPN-secured administration — implement best practices used in enterprise environments.
This network configuration provides the foundation for comprehensive security monitoring across your entire infrastructure. Whether monitoring 5 systems or 500, the architecture scales seamlessly by adding VLANs to firewall policies and deploying agents with consistent configuration.
The combination of UniFi’s robust networking capabilities and Wazuh’s powerful security monitoring creates a professional-grade security operations center that protects your infrastructure while maintaining the flexibility needed for modern remote work environments.
References and Resources
- UniFi Documentation: https://help.ui.com/
- UniFi Teleport VPN Guide: https://help.ui.com/hc/en-us/articles/115005445768
- DuckDNS: https://www.duckdns.org/
- Wazuh Documentation: https://documentation.wazuh.com/
- Network Segmentation Best Practices: NIST Special Publication 800–125B
메타데이터
- post_id
- 2e6a310cb0fb
- slug
- securing-wazuh-with-unifi-network-configuration-for-siem-deployment-2e6a310cb0fb
- url
- https://medium.com/@lazro/securing-wazuh-with-unifi-network-configuration-for-siem-deployment-2e6a310cb0fb
- canonical_url
- https://medium.com/@lazro/securing-wazuh-with-unifi-network-configuration-for-siem-deployment-2e6a310cb0fb
- author_url
- https://medium.com/@lazro
- status
- ok
- fetched_at
- 2026-07-11 18:15:18