0

If SNAT is used to map internal private IP addresses directly to a non-changing public IP address, why not simply assign the public IP addresses directly to each host itself? What advantage dose SNAT have over the classic setup where every host gets its own public IP?

In a nutshell im asking, what problem is SNAT trying to facilitate or solve?

7
0

As commented, SNAT commonly refers to source NAT (usually NAPT, see RFC 2663) and shouldn't be used lightly for static NAT.

Static NAT is used when the originating host is using a private IP address and you want to map a dedicated public IP address for Internet communication on a one-to-one basis.

Static NAT is commonly used in server hosting, when the hoster allocates a public IP subnet for the customer servers but the customer doesn't want to use those public addresses directly, especially by routing (and translating) through a firewall first. The one-to-one mapping has the advantage of easily identifying the originating host (and possibly application) on the public side.

0

In a subnet you may have addresses allocated for a number of reasons.

  1. The network and broadcast address, which are essentially wasted.
  2. Addresses for hosts that need full access to the internet.
  3. Addresses for hosts that need outbound connection to the internet but don't need incoming from the internet.
  4. Addresses for hosts that don't need internet access at all.
  5. Addresses for routers on the network
  6. Addresses kept for future expansion
  7. Addresses unused because the subnet must have a power of two size.

So lets say we have a subnet with.

  • A couple of webservers that serve webpages to the public internet.
  • A couple of database servers that provide the databases for the webservers.
  • A couple of servers that download data from another site for processing.
  • A redundant pair of gateways to the outside world with a virtual IP to serve as the default gateway.

That adds up to 9 addresses, 6 for the servers, 2 for the physical gateways, 1 for the virtual gateway IP. To actually allocate an address block to the subnet we also need a network and broadcast address taking the total to 11. The next power of 2 after 11 is 16.

So if we address the subnet with public IPs directly then we need a block of at least 16 public IPs, if we want to allow for future expansion we may want to allocate a bigger block, say 32 public IPs.

Yet only two of the addresses on the subnet actually need to be reachable from the Internet. The rest could manage just fine behind a one to many NAT or don't need connectivity to the public internet at all.

Scale this up to a larger network and you can save a massive number of public IP addresses by allocating individual public addresses to the machines that actually need them rather than allocating big blocks of public IPs to subnets.

There are a couple of ways to do this, one is to use secondary IP addresses on the servers with static /32 routes to deliver traffic to them. Another is to use Static NAT to map the public IP addresses to private ones at the network border. There are pros and cons to both approaches.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.