
Cloudflare Tunnel: A Server Can Serve the Internet Without Opening an Inbound Port on the Firewall
Vũ Khôi
Tác giả tại Wotech Electronics Blog

For many years, we almost took it for granted that publishing a service to the Internet requires a point where the Internet can connect in: request a public IP, configure DNS, NAT a port on the firewall, create a security policy, install an SSL certificate, deploy a reverse proxy. But try reversing the question: why must we open a door for outsiders to find their way in, when we can proactively build a connection from the inside going out? That is the most interesting idea behind Cloudflare Tunnel — article #03 in Dũng Nguyễn's series "KHI VPN KHÔNG CÒN LÀ CÂU TRẢ LỜI DUY NHẤT" ("When VPN Is No Longer the Only Answer").
Quick answer
- Cloudflare Tunnel reverses the direction of connection setup: instead of the firewall opening an inbound port to accept connections from the Internet, a connector called cloudflared proactively creates encrypted outbound connections to Cloudflare's infrastructure — the server needs no public IP, and the firewall needs no inbound port for the application.
- The tunnel is the means of connection; the security ecosystem is what decides how that connection is controlled: ZTNA, SSO, MFA, WAF, DDoS protection and rate limiting belong to Cloudflare Access and other services — they do not appear automatically just because cloudflared is installed.
- Cloudflare Tunnel does not replace a firewall: a firewall still has to segment the network, control traffic between VLANs, protect databases, run IPS/IDS and SSL Inspection, Site-to-Site VPN, SD-WAN and many other jobs.
- No open inbound port does not mean hackers cannot attack: SQL Injection, XSS, Broken Access Control and RCE are application vulnerabilities — they do not disappear just because the server sits behind a Tunnel.
- An outbound tunnel can also become a blind spot: a connector installed without authorization can open a path into internal systems without creating any new NAT policy on the firewall.
- Moving a service to the cloud does not make risk disappear: it only changes where the risk lives and how we must manage it.
What is Cloudflare Tunnel?
Cloudflare Tunnel is a solution that connects internal applications and resources to Cloudflare's network infrastructure through tunnels established from inside the system. The key component in this model is a connector called cloudflared.
Instead of requiring the firewall to open an inbound port to accept connections directly from the Internet, cloudflared proactively establishes encrypted outbound connections to Cloudflare's infrastructure. When a user accesses an application, the request is received at Cloudflare, then forwarded through the established tunnel back to the internal server. The model becomes:
USER → CLOUDFLARE EDGE → CLOUDFLARE TUNNEL → APPLICATION SERVER.
Meanwhile, the tunnel connection is initiated in the opposite direction:
CLOUDFLARED → FIREWALL → INTERNET → CLOUDFLARE.
The corporate firewall does not need to open a dedicated inbound port for an application published through a Tunnel. The application server does not need to own a public IP. The company does not necessarily need its own public IP address capable of receiving connections from the Internet. This allows Cloudflare Tunnel to work in many NAT and CGNAT environments, or in systems where the administrator has no right to configure port forwarding. Technically, cloudflared can use QUIC or HTTP/2 to establish connections to Cloudflare, depending on configuration and network conditions.
Of course, the firewall must still allow the necessary outbound connections. No open inbound port does not mean no network connection, no firewall policy, or no traffic control is needed. The difference is this: we no longer have to publicly expose the application's connection endpoint on the corporate network.
The story of service ports opened to the Internet
Imagine a company with an ERP system running on an internal server. The server sits behind a firewall, uses a private IP address, and cannot be accessed directly from the Internet. One fine day, management requires employees to be able to use the ERP while traveling or working from home.
The IT team usually has two familiar options. The first is to deploy a VPN so employees connect to the internal network and then access the ERP. The second is to publish the ERP application to the Internet through the firewall, NAT and appropriate security components. The second model usually looks like this:
INTERNET → PUBLIC IP → FIREWALL → NAT/REVERSE PROXY → APPLICATION SERVER.
This is an architecture that has existed for decades and is still widely used. It is not wrong. But it also brings a host of problems the IT team must solve: the public IP can be scanned, the published service port can become a target, the firewall must accept connections from the Internet, the link can become a DDoS target, the application may contain security vulnerabilities, SSL certificates must be managed, and access policies must be built and maintained.
If a company has dozens of applications to publish, the number of configurations, policies and components to manage grows as well. Not to mention companies using Internet links behind CGNAT, with no dedicated public IP or no ability to do port forwarding in the traditional way. And that is when a different approach becomes worth attention.
What can Cloudflare Tunnel actually do?
If you think of Cloudflare Tunnel only as a tool to replace NAT ports for websites, you are looking at this technology too narrowly. Cloudflare Tunnel can serve many different problems:
- Publishing websites and web applications: a company can expose internal HTTP/HTTPS applications to the Internet through a domain name without opening an inbound port directly for each application.
- Remote access to corporate applications: ERP, CRM, HRM, Helpdesk, work management software and other internal web applications can be provided to remote users.
- Access to non-web services: Cloudflare Tunnel can support SSH, RDP and other TCP services through appropriate connection methods. However, not every protocol can be accessed directly with an ordinary client the way HTTP/HTTPS can — some cases need the Cloudflare One Client (WARP), a user-side cloudflared, or additional components.
- Connecting to private networks: Cloudflare Tunnel can be used to route traffic to private IP ranges when combined with a suitable Cloudflare Zero Trust architecture.
- Operating in NAT and CGNAT environments: systems without a dedicated public IP can still establish a Tunnel if they meet the outbound connection requirements.
- Supporting multiple connectors: a company can deploy multiple cloudflared instances to reduce risk when one connector fails.
- Publishing many applications through the same Tunnel: instead of building a separate connection for each application, administrators can configure multiple services and hostnames on the same Tunnel system.
But what makes Cloudflare Tunnel special is not only those connectivity capabilities — it is also the security ecosystem that can be integrated in front of the applications. When combined with the right Cloudflare services, a company can additionally deploy: Zero Trust Network Access (ZTNA), Single Sign-On (SSO), Multi-Factor Authentication (MFA), integration with Microsoft Entra ID, Google Workspace and other Identity Providers, authorization by user and user group, Device Posture Check, Web Application Firewall (WAF), DDoS Protection, Rate Limiting, Bot Management, Access Logging, Load Balancing, and context-based access control policies.
However, it is necessary to distinguish clearly what is a function of Cloudflare Tunnel and what belongs to Cloudflare Access, WAF, Gateway, Load Balancing and other services. Installing cloudflared on a server does not automatically give you all the security features listed above. Real capability depends on architecture, configuration, service type and the license plan the company uses.
The tunnel is the means of connection. The security ecosystem is what decides how that connection is controlled.
When 500 employees only need to access one ERP software
Take a very practical problem. A company has 500 employees, 300 of whom regularly work outside the office. All of them need to access the ERP software.
Under the traditional VPN model, the IT team may have to deploy a VPN client, issue accounts, build access policies, help users install it, handle connection errors and manage endpoints. Users who want to work must turn on the VPN. If the VPN does not connect, they call IT. Change laptops, call IT. Forget the password, call IT. Sitting in a hotel with a VPN that will not connect, call IT again. On some days, the IT team feels less like system administrators and more like a customer service hotline for the VPN client.
But try approaching the problem from another direction. The company deploys Cloudflare Tunnel combined with Cloudflare Access. Users access erp.company.vn. The system requires authentication with a corporate account through Microsoft Entra ID. Users perform MFA according to the authentication policy. Cloudflare Access checks identity, user groups and the configured access conditions. If the requirements are met, the user is allowed to access the ERP. If not, the connection is refused. For suitable web applications, users can complete the whole process through a browser without a traditional VPN connection.
The biggest difference here is not that users save a few clicks, but that the scope of access rights has changed. An accountant is allowed to access the ERP, but that does not mean they are given a network connection to the Domain Controller, File Server, Database Server or virtualization management system. A software vendor is allowed to access the application they need to maintain, but that does not mean they are allowed to wander through the entire corporate network.
Instead of granting access to a network and then trying to limit what users can do, we can start by granting access only to the exact application they need to use. That is one of the important values of ZTNA.
Cloudflare Tunnel can replace NAT ports — but can it replace a firewall?
This is a question many infrastructure engineers will certainly ask. If there is no need for a dedicated public IP, no need for inbound NAT ports, and there is WAF, DDoS protection, Zero Trust and access control — why buy a firewall at all?
The answer is that we are talking about different layers of protection. A corporate firewall system does not exist only to NAT ports for a web server. It must also handle a long list of tasks: segmenting the LAN, Server, DMZ and Management networks; controlling traffic between VLANs; protecting the database system; controlling East-West and North-South traffic passing through the firewall; IPS/IDS; Application Control; Antivirus Gateway; Web Filtering; SSL Inspection; controlling outbound connections; Site-to-Site VPN; Multi-WAN Load Balancing; SD-WAN; Routing; Network Segmentation; and monitoring and logging network traffic. Depending on the product and license, a firewall can provide many different functions.
Cloudflare Tunnel does not by default replace all those tasks. Imagine a corporate architecture with three network zones: the first contains the Web Application, the second contains the Database, the third contains the management system, Active Directory, Backup and critical servers. Cloudflare Tunnel can help users access the Web Application without opening an inbound port directly on the firewall. But who will control which database the Web Application is allowed to connect to? Who will stop a compromised web server from reaching the Domain Controller? Who will control connections from the application server to the Internet? Who will stop an incident in the DMZ from spreading to the Backup zone? Who will segment and control internal connections that do not pass through Cloudflare?
That remains the job of the internal security architecture, in which the firewall, network segmentation and Endpoint Security play very important roles. A sensible model can perfectly well include:
USER → CLOUDFLARE ACCESS/WAF → CLOUDFLARE TUNNEL → CONNECTOR/DMZ ZONE → FIREWALL POLICY → APPLICATION SERVER → DATABASE FIREWALL → DATABASE SERVER.
Each component is responsible for protecting a different scope. Cloudflare controls the access layer from outside. The firewall controls connections between network zones. The WAF inspects web application traffic. EDR monitors behavior on servers. SIEM collects and correlates security events. Backup and Disaster Recovery help the company recover when incidents occur.
Do not, because you found a new way to open a door, rush to tear down all the walls protecting the house.
Does no open inbound port mean hackers cannot attack?
If someone tells you that using Cloudflare Tunnel makes a server impossible for hackers to attack because there is no open inbound port, be careful with that claim. Because it confuses the network attack surface with the application attack surface.
When Cloudflare Tunnel is used correctly, we can reduce the chance of the origin server being reached directly from the Internet. But the application still has to accept requests from users through Cloudflare. If the application is published publicly, malicious requests can still be sent to the application through that access path, unless the security layers detect and block them.
Remember the familiar vulnerabilities: SQL Injection, Cross-Site Scripting, Broken Access Control, Authentication Bypass, Server-Side Request Forgery, Remote Code Execution. These vulnerabilities do not automatically disappear just because the server sits behind a Cloudflare Tunnel. An application with an authorization flaw can still let users access other people's data. An application with an SQL Injection flaw can still be exploited. An application with weak authentication can still have its accounts taken over. A WAF can help detect and block many forms of web attacks, but it is not a tool that fixes every vulnerability in the source code.
Cloudflare Tunnel can help hide the origin server's direct entry path, but it cannot hide the existence of an application being publicly provided on the Internet.
We can change the road leading to the application, but we cannot thereby change the security quality of the application itself.
When the outbound tunnel becomes the company's blind spot
This is the angle Security professionals need to pay special attention to. Cloudflare Tunnel is very convenient for the IT team. But that convenience can also create risk if the company does not control tunnel deployments.
Imagine a company that has built a very strict firewall system: no arbitrary NAT ports, no RDP open to the Internet, no publishing internal servers without approval. Every firewall policy change must go through the Security department.
But what if someone with the right to install software on a server deploys a connector on their own, connecting to a Cloudflare account outside the company's management? If the outbound policy allows that connection to work, an access path from outside into internal resources can be formed without creating any additional NAT policy on the firewall. Depending on the connector's configuration and permissions, internal resources can be published outside the company's control.
What is notable is that when the Network team checks the NAT port list, they may find no new service publication configuration. When checking inbound ports, everything still looks normal. But a connection from outside to the internal system may already exist through an intermediary service. This is a form of risk related to Shadow IT and unauthorized tunnels. It is not limited to Cloudflare Tunnel — it can also appear with many other outbound connection technologies.
Therefore, companies need to build appropriate controls: manage software allowed to be installed on servers and endpoints; control outbound traffic from critical network zones; detect unauthorized proxy and tunnel services; centrally manage the company's Cloudflare account; protect Tunnel Tokens and connector credentials; limit the network scope a connector is allowed to access; monitor abnormal processes and connections with EDR; collect logs into the SIEM system; periodically inventory published applications and services; and build an approval process for deploying new tunnels.
Just because you see an outbound connection does not mean you can assume it is safe. And just because it connects to a famous cloud provider does not mean all traffic inside that connection is trustworthy.
In the past, Security teams had to control doors opened from the outside in. Today, they must also control doors that insiders proactively open themselves.
When a company moves part of its security infrastructure to the cloud
Cloudflare Tunnel brings many benefits. But when deployed at enterprise scale, we must also recognize the risks related to dependence on a service provider.
Imagine the entire ERP, CRM, Helpdesk and critical applications are all accessed through Cloudflare. One day, Cloudflare's infrastructure has an incident. Or the DNS system has a problem. Or the Microsoft Entra ID authentication service stops working. Or the Cloudflare administrator account is taken over. Or the connector at the company fails. Or the Access policy is misconfigured.
The ERP server still runs. The database still works. The firewall is still all green. The virtualization system still reports Healthy. But employees outside cannot access the application. Technically, the company's server system has not crashed. In business terms, the company can still suffer an operational disruption. That is the difference between infrastructure availability and service availability.
When deploying Cloudflare Tunnel for critical applications, a company needs to assess the provider's SLA, Internet link redundancy, the ability to deploy multiple connectors, Application Server and Database redundancy, administrator account recovery, emergency access plans when the authentication system fails, requirements on data processing and storage location, certificate and encryption management policies, license costs when expanding the number of users, monitoring, log storage and retrieval capabilities, and plans to maintain operations when the cloud service is interrupted.
It should also be noted that for a web application where Cloudflare acts as a reverse proxy, TLS from the user is usually terminated at Cloudflare, and traffic is then forwarded to the internal system through the corresponding connections. The segment from the Connector to the Origin Server also needs to be configured and protected appropriately. This is different from assuming all traffic is end-to-end encrypted in a way that the intermediary provider cannot access the content. For companies operating in banking, finance, healthcare or handling sensitive data, these are issues that need serious assessment.
The cloud helps us reduce a lot of operational work. But the cloud does not help us transfer all responsibility for the system's safety and availability.
Moving a service to the cloud does not make risk disappear. It only changes where the risk exists and how we must manage it.
Cloudflare Tunnel and VPN — who will replace whom?
If a company needs to connect two large network systems at two data centers, transfer tens of terabytes of backup data, synchronize storage or connect many business systems with specific routing and bandwidth requirements, Site-to-Site VPN or dedicated links remain very worthwhile choices.
But if a company only needs to provide a web application to a few hundred remote employees, Cloudflare Tunnel combined with Access can significantly simplify the access architecture. If the IT team needs to manage servers via SSH or RDP, we can consider Cloudflare Zero Trust, VPN or other overlay network solutions. If a company needs to publish a website to millions of customers on the Internet, Cloudflare Tunnel combined with web security services can become a component of the overall architecture.
There is no reason forcing a company to choose only one technology. A system can perfectly well use IPsec VPN to connect branches, Cloudflare Tunnel to provide ERP to employees, ZTNA to control application access, a firewall to segment the network and protect the database, a separate overlay network for infrastructure management work, and dedicated links to transfer backup data between data centers.
Each technology solves one problem. Each technology has its own advantages and limitations. The value of a solution consultant lies not in knowing many technology names, but in knowing how to place each technology in its proper position within an overall architecture.
The future of firewalls in the data center
Perhaps in the coming years, the role of the firewall in a company will continue to change. Not because the firewall is obsolete, but because more and more security decisions are made at different places: at the Cloud Edge, at the identity authentication system, at the Endpoint, at each application, at each network zone, at each access session.
In the past, we tried to build one huge wall around the entire company. Everything outside the wall was considered dangerous. Everything inside the wall was usually trusted more. But today's company no longer fits neatly inside a wall. Employees are everywhere. Applications are everywhere. Data is everywhere. Servers sit in the data center, in the cloud and at branch offices. And attackers do not necessarily have to stand outside that wall.
Cloudflare Tunnel is a very interesting example of how our approach to connectivity is changing. From publishing an IP address to publishing an application. From accepting direct connections to proactively establishing outbound tunnels. From determining access rights mainly by network address to combining identity, device and context. From protecting a fixed network boundary to protecting each specific resource.
But no matter how much technology changes, the basic principles of security do not change. We must know who is accessing. Accessing what. With which device. Under what conditions. And when an incident occurs, how far the damage will be limited.
After decades in IT, we were once very proud to get an internal server onto the Internet. Happy to successfully configure a NAT line. Sitting for hours fixing a port forwarding error. Thinking that opening a service port from outside was completing a technical problem.
But today, perhaps we need to be proud of something else. That is when a company can still provide services to thousands of users, still ensure work effectiveness, but without having to publicly expose resources that do not need to be exposed to the Internet.
In the past, a good Network engineer was someone who knew how to open a door so the whole world could walk in.
Today, a good Network and Security engineer is someone who can provide services to the whole world without opening unnecessary doors.
And remember:
No open inbound port does not mean the company has no way in. It only means the way in has been built differently.
The security professional's job remains controlling what is allowed to pass through that way in.
Apply it now
- Test on a less critical internal application first: install cloudflared on a lab server, publish a test application through a Tunnel, and check the full journey USER → CLOUDFLARE EDGE → TUNNEL → APP SERVER.
- Distinguish the Tunnel from the security services: write down which service is actually protecting the application — the Tunnel is only the connection path, while Access, WAF and DDoS Protection must be enabled and configured separately.
- Apply ZTNA to applications instead of VPN to the whole network: grant access to exactly the application users need (ERP for accounting), not a connection to the Domain Controller or File Server.
- Keep the firewall in its proper place: continue using the firewall to segment VLANs, control East-West/North-South traffic and protect the database — the Tunnel does not replace these jobs.
- Control shadow tunnels: manage software allowed on servers and endpoints, control outbound traffic, detect unauthorized tunnels, protect Tunnel Tokens, and centrally manage the Cloudflare account.
- Prepare for the day the provider has an incident: deploy multiple connectors, redundant Application Servers and Databases, have an emergency access plan when authentication fails, and assess the SLA before putting critical applications on a Tunnel.
- Do not forget application security: patch SQL Injection, XSS and Broken Access Control — a WAF is only an extra layer of defense, it does not fix vulnerabilities in the source code.
- Combine instead of choosing one: IPsec VPN for branches, Tunnel for ERP, ZTNA for application access, firewall for segmentation, EDR and SIEM for monitoring — each technology in its proper place.
Frequently asked questions
What is Cloudflare Tunnel?
Cloudflare Tunnel is a solution that connects internal applications and resources to Cloudflare's infrastructure through tunnels established from inside the system. The cloudflared connector proactively creates encrypted outbound connections to Cloudflare, so the firewall needs no inbound port and the server needs no public IP.
Can Cloudflare Tunnel replace a firewall?
No. A firewall still has to segment the network, control traffic between VLANs, protect databases, run IPS/IDS and SSL Inspection, Site-to-Site VPN, SD-WAN and many other tasks that a Tunnel does not perform. A Tunnel only changes how applications are published to the Internet.
Without an open inbound port, is the application absolutely safe?
No. No open inbound port only reduces the network attack surface — the origin server is harder to reach directly. But application vulnerabilities such as SQL Injection, XSS, Broken Access Control and RCE still exist and can still be exploited through legitimate access paths.
Can Cloudflare Tunnel be used behind CGNAT?
Yes. Because the Tunnel is initiated by an outbound connection from cloudflared going out, it works in NAT and CGNAT environments where a company has no dedicated public IP or cannot configure port forwarding — as long as the firewall allows the necessary outbound connections.
When Cloudflare has an incident, does my application go down?
Your servers and database keep running, but outside users may not be able to access the application — that is the difference between infrastructure availability and service availability. So assess the SLA, deploy multiple connectors, and have an emergency access plan for critical applications.
Source: Article by Dũng Nguyễn, posted in the Facebook group Community of Digital Sarch on 25/11/2026 — Article #03 in the series "KHI VPN KHÔNG CÒN LÀ CÂU TRẢ LỜI DUY NHẤT". The next article in the series (Tailscale — article #04, the finale) has already been published on Wotech: Tailscale and Mesh VPN: Hundreds of Servers Connected Without a Central VPN Gateway. The cover is an illustration created by Wotech (the only image in the original post was about AI code review, unrelated to the content, so it was not used).
Bài viết liên quan

1 tháng 12, 2026 · 13 phut doc
Anthropic 'Cracks' ML-KEM: the Truth Behind the Hot News — and Why Today's Data Is Still Safe
According to The Guardian, Anthropic was about to announce it had found a way to break ML-KEM — the encryption standard designed to withstand the power of quantum computers. The news spread at lightn…

1 tháng 12, 2026 · 12 phut doc
Shopify CEO: $2,000 in Tokens, One Weekend to Rewrite a System — and the Lesson on Verifying AI Code
Tobi Lütke — who wrote Shopify's first lines of code himself more than 20 years ago — recently made some remarkable remarks on David Senra's Founders podcast. He revealed that almost all engineering …

1 tháng 12, 2026 · 12 phut doc
DroidClaw: Turning an Old Phone into an AI Agent That Taps Apps on Android
In early February 2026, a developer spent a few hours reverse-engineering Android's accessibility tree, just because he wanted to turn an old phone into an AI agent that taps apps by itself. The resu…