NeuroAgent

How to Configure Port Forwarding for QNAP NAS in pfSense

Complete guide to configuring port forwarding for QNAP NAS in pfSense. Learn how to provide access to NAS resources through external links with proper NAT and firewall rule configuration.

How to configure port forwarding for QNAP NAS links in pfSense?

Hello colleagues! I’m having a problem with network configuration:

  • pfSense gateway is installed in the local network
  • There is a QNAP NAS server with an internal IP address that doesn’t have external access
  • Links are published on the organization’s website, which are generated through the QNAP NAS admin interface
  • Problem: when a link is published on the website, it doesn’t open the resource (for example, a document) from the QNAP NAS

I understand that the problem is related to port forwarding, but I don’t know how to properly configure pfSense to access QNAP NAS resources through external links.

Please advise on how to properly configure port forwarding in pfSense for access to QNAP NAS?

NeuroAgent

To configure port forwarding for QNAP NAS access through pfSense, you need to create NAT rules in the Firewall > NAT section, specifying the NAS internal IP address, required ports (such as 8080 for web access or 443 for HTTPS), and selecting the appropriate protocol (TCP/UDP). After creating the rules, be sure to activate them and test the functionality through your gateway’s external IP address.


Contents


Basic Concepts of Port Forwarding

Port forwarding is a mechanism that allows redirecting incoming internet connections on a specific external IP address port to an internal IP address of a device on the local network. For QNAP NAS, this means that external users will be able to access NAS resources through the internet, even if the NAS doesn’t have a direct external IP address.

Key principle: When you publish a link on your website, it contains an IP address and port that point to your pfSense gateway. Port forwarding rules in pfSense redirect this traffic to the internal IP of the QNAP NAS.

For successful setup, you will need:

  • Internal IP address of QNAP NAS (e.g., 192.168.1.10)
  • Knowledge of required ports for accessing resources
  • Access to the pfSense administrative panel

Preparing QNAP NAS

Before configuring pfSense, ensure that your QNAP NAS is properly configured:

  1. IP Address Verification: Determine the static internal IP address of your QNAP NAS. It’s recommended to use a static IP instead of DHCP for stable operation.

  2. Enable Required Services: In the QNAP admin interface, go to “Control Panel” > “Network & File Services” and ensure that necessary services (e.g., SMB, AFP, HTTP/HTTPS) are enabled.

  3. Port Configuration: In “Control Panel” > “Network & File Services” > “TCP/IP”, check which ports are used for accessing resources.

  4. Test Local Access: Ensure you can access QNAP NAS resources from the local network using the internal IP.

As noted in the official QNAP documentation, you can use myQNAPcloud for port forwarding on the NAS itself, but for external access through pfSense, it’s better to configure rules at the gateway level.

pfSense Configuration

Step 1: Access the pfSense Control Panel

Open a web browser and navigate to your pfSense IP address (typically this is your local network gateway, e.g., 192.168.1.1). Log in with administrator credentials.

Step 2: Create Port Forwarding Rule

  1. Navigate to Firewall > NAT > Port Forward
  2. Click Add to create a new rule
  3. Fill in the fields:
    • Interface: WAN (external interface)
    • Protocol: TCP (for web access) or UDP (for other services)
    • External port range: External port that will be accessible from the internet (e.g., 8080)
    • Internal IP address: Internal IP of QNAP NAS (e.g., 192.168.1.10)
    • Internal port range: Internal QNAP port (usually same as external, e.g., 8080)
    • Description: Rule description (e.g., “QNAP Web Access”)

Step 3: Create Firewall Rules

After setting up port forwarding, you need to create allowing rules in the firewall:

  1. Go to Firewall > Rules
  2. Select the WAN interface
  3. Click Add to create a new rule:
    • Action: Pass
    • Interface: WAN
    • Protocol: TCP or UDP
    • Source: Any
    • Destination port: The port you specified (e.g., 8080)
    • Description: “Allow QNAP Access”

As explained in the pfSense setup guide, it’s important to configure both NAT rules and firewall rules properly to ensure access.

Configuring Specific Ports

Accessing QNAP Web Interface

For accessing the QNAP web interface through an external IP:

markdown
- External port: 8080 (or another available port)
- Internal port: 8080 (or the port configured in QNAP)
- Protocol: TCP
- QNAP IP: 192.168.1.10

Accessing File Resources (SMB)

For accessing files via SMB/CIFS:

markdown
- External ports: 137-139, 445
- Internal ports: 137-139, 445
- Protocol: TCP/UDP
- QNAP IP: 192.168.1.10

Important: By default, ports 137-139 may be blocked by providers. In this case, use alternative ports.

Accessing myQNAPcloud

If you’re using myQNAPcloud for remote access, as mentioned in the QNAP guide, configuration may require additional rules for specific service ports.

Testing and Verification

Rule Verification

  1. After creating rules, go to Diagnostics > States and check if connections appear when attempting access
  2. Use the pfctl -s nat command in the pfSense console to view active NAT rules

Access Testing

  1. Determine your gateway’s external IP address (can be found by searching “what is my ip”)
  2. Try to access through a browser: http://external_IP:port
  3. Check QNAP logs for incoming requests

If configured correctly, as described in the pfSense guide, you should see successful connection and be able to access NAS resources.

Security and Best Practices

Access Restriction

  1. IP Restriction: In firewall rules, specify specific IP addresses allowed for access
  2. Use HTTPS: Configure SSL/TLS encryption for secure access
  3. Regular Updates: Update software and firmware for pfSense and QNAP NAS

Monitoring

  1. Enable logging in pfSense: Status > System Logs
  2. Set up notifications for suspicious activity
  3. Regularly check access statistics

As experts from the pfSense community note, security should be a priority when setting up port forwarding in a corporate environment.

Common Issues

Issue: “Connection timed out”

Possible causes:

  • Incorrect QNAP internal IP
  • Disabled services in QNAP
  • Port blocking by provider

Solution:

  1. Check QNAP IP address in the local network
  2. Ensure QNAP services are active
  3. Try using different ports

Issue: “Access denied”

Possible causes:

  • Missing firewall rules
  • Incorrect NAT settings
  • Port conflicts

Solution:

  1. Check for firewall rules on the WAN interface
  2. Ensure NAT rules are active
  3. Change the port if it’s already in use

Issue: “Page not found”

Possible causes:

  • Incorrect QNAP web server configuration
  • Path access errors

Solution:

  1. Check web service settings in QNAP
  2. Ensure resource paths are correct

For complex issues, it’s helpful to refer to community guides where users share experience with similar configurations.


Sources

  1. Official QNAP Documentation - Configuring Port Forwarding
  2. Guide to Installing pfSense on QNAP NAS
  3. Step by Step: Setting up Port Forwarding in pfSense
  4. Configuring pfSense for QNAP
  5. Troubleshooting Port Forwarding Issues
  6. Spiceworks Community Discussion
  7. Netgate Forum - pfSense and QNAP

Conclusion

Setting up port forwarding for QNAP NAS in pfSense requires properly executing several steps: determining the NAS IP address and ports, creating NAT rules in pfSense, configuring firewall rules, and thorough testing. By following these instructions, you can ensure secure external access to your NAS resources through links published on your website.

Key recommendations:

  • Always use static IP addresses for important devices
  • Regularly update firmware for security
  • Restrict access by IP addresses where possible
  • Maintain logs for activity monitoring

If you have additional questions or encounter issues during setup, refer to manufacturer documentation or professional communities where you’ll find support and additional recommendations for optimizing your network infrastructure.