On izCloud, servers in your private VLAN use private addresses. With DNAT you expose a specific service to the outside, and with SNAT you let servers reach the internet. Rules are defined from the panel.
What is NAT?
NAT (Network Address Translation) is when a network device changes the IP address or port number on packets. This is usually done by a firewall or a router.
The first reason for NAT was the shortage of IPv4 addresses. Many devices in a network use private addresses and reach the internet through a single public address. Today NAT is used not only to save addresses but also to hide the internal network layout and to expose services in a controlled way.
Translation works in two directions. On outgoing traffic the source address is changed (SNAT), and on incoming traffic the destination address is changed (DNAT).
What is SNAT and what is it used for?
SNAT changes the source IP address of a packet and is most often used when devices on a private network reach the internet. When a server with the internal address 10.0.0.5 goes out to the internet, the source address of the packet is translated to the public address of the firewall.
When the return traffic arrives, the device uses the connection information it saved earlier and passes the reply to the right internal server. The connection tracking table does this matching, so you do not need to write another rule.
When the source address is translated to the current address of the outgoing interface, it is called masquerade. This term is used especially in the Linux world for cases where the external address is dynamic.
SNAT has an important side effect: the server on the outside cannot see the internal address of the device that made the connection, only the public address of the firewall. You need to add this public address to the access lists of external services.
What is DNAT and what is it used for?
DNAT changes the destination IP address of a packet and, if needed, the port number. It is most often used to forward a request coming from the internet to a server on the internal network.
Only the public address of the firewall is visible to the outside world. When someone connects to port 443 of this address, the DNAT rule forwards the request to the private address of the web server on the internal network. The server's reply is translated on the way back, and the person who connected never sees the internal address.
A DNAT rule means exposing a service to the outside. So every DNAT rule is a security decision and must be considered together with a firewall rule.
Think about the reverse direction too. When the internal server replies to the outside, its source address is the internal address. Because the firewall tracks the connection, it translates the reply to the public address. This happens by itself without needing a rule.
What is the difference between DNAT and SNAT?
The difference is which address is changed and in which direction the traffic flows. SNAT translates the source, and DNAT translates the destination.
| Feature | SNAT | DNAT |
|---|---|---|
| Full name | Source NAT | Destination NAT |
| Field that changes | Source address of the packet | Destination address (and port) of the packet |
| Typical direction | From the internal network to the outside (outgoing) | From the outside to the internal network (incoming) |
| Who starts the connection | A device on the internal network | A client on the outside |
| Typical purpose | Internet access, address sharing | Exposing a service, port forwarding |
| Other name | Masquerade (for dynamic addresses) | Port forwarding |
What are DNAT and SNAT called in the izCloud panel?
In the izCloud panel, DNAT is defined on the "Virtual IPs" screen. SNAT is set in the NAT setting of a security rule or on the "IP Pools" screen.
In the izCloud firewall, a DNAT rule is called a virtual IP (VIP). A VIP maps a public IP assigned to you to the address of a server on the internal network. If you want, you forward only a specific port.
There are two options for SNAT. If you choose the outgoing interface address, servers go out to the internet with the firewall's outgoing address. If you choose an IP pool, outgoing traffic uses the public IPs you defined in the pool.
| Action | Where in the panel | What it does |
|---|---|---|
| DNAT | "Virtual IPs" | Forwards a public IP and port to an internal server |
| SNAT | Rule wizard → NAT and Logging | Translates outgoing traffic to the address of the outgoing interface |
| SNAT (pool) | "IP Pools" | Translates outgoing traffic to the public IPs you choose |
What are port forwarding and PAT?
Port forwarding is the form of DNAT that maps a port to a specific internal address. For example, port 8080 of the external address can be forwarded to port 80 of a server on the internal network.
PAT (Port Address Translation) lets many internal devices share a single public address by telling them apart with port numbers. In everyday life, all the devices at home reaching the internet through one address rely on PAT. In practice it is mentioned together with SNAT.
In port forwarding, the external port and the internal port do not have to be the same. You can use this to keep a service a little further from random scans by using a non-standard port number. However, this alone does not provide security.
Also state the protocol when forwarding. TCP and UDP are separate rules. For example, a DNS server may need both UDP and TCP port 53. Choosing the wrong protocol is a common reason a rule does not work.
In which scenarios are DNAT and SNAT used?
There are two common scenarios: letting servers reach the internet and exposing a service to the outside.
- If servers on a private network need to reach the internet: the servers have private addresses and cannot be routed on the internet. An SNAT rule translates the outgoing traffic of these servers to the public address of the firewall. Downloading updates and connecting to external services work this way.
- If a web server will be exposed: the web server is on the private network. A DNAT rule forwards requests arriving at the public address on port 443 to the private address of the web server. The firewall allows only this port.
- If management access is needed: opening an SSH or remote desktop port straight to the internet with DNAT is risky. If possible, connect through a VPN or restrict the source address.
- An extra scenario is a connection between two private networks. If both networks use the same address range, traffic cannot be routed directly. In this case NAT can be used to translate the addresses so that they do not overlap. An address plan that prevents the overlap from the start is a cleaner solution than NAT.
How do NAT and a firewall work together?
NAT translates the address, and the firewall decides whether to allow the traffic. They do not replace each other; they are used together.
Writing a DNAT rule does not mean the traffic will pass. The firewall must also allow the traffic separately. When writing the rule, check your platform's documentation to see whether the translated (internal) address or the untranslated (external) address is matched, because this behavior depends on the product.
On izCloud the firewall works with a private VLAN dedicated to you. DNAT and SNAT rules are defined from the panel. We explained the rule logic of the firewall in what is a server firewall.
Frequently asked questions
What is the difference between DNAT and SNAT?
SNAT changes the source address of a packet and DNAT changes the destination address. SNAT is usually used on outgoing traffic (internet access) and DNAT on incoming traffic (exposing a service).
Is port forwarding the same as DNAT?
Port forwarding is the use of DNAT that maps a specific port to an internal address. In practice the two terms often mean the same thing.
What is PAT?
PAT lets several internal devices share one public address by separating them with port numbers. It is mentioned together with SNAT.
Does traffic pass automatically after I write a DNAT rule?
No. The firewall must also allow the traffic separately. DNAT only translates the address.
Do I need to write a return rule for SNAT?
Usually not. The firewall tracks the connection and translates reply packets back to the right internal server automatically.
How do I set up DNAT and SNAT on izCloud?
DNAT and SNAT rules are defined from the panel. For step-by-step use, see the panel guide.