4

So i just started learning about NAT and networking in general. As powerful as this technology may seem, it was specifically made for reducing the amount of IPV4 addresses used throughout the internet, so firstly

  1. Is there even another way to get public IPs besides using NAT and how is it done?

and secondly:

  1. If by pure coincidence, two devices were to configure static NAT and use the same public IP address, what'll happen ? Thanks again
1
  • 3
    You seem to mean the NAPT variant of NAT. NAT simply replaces either or both the source or destination address in an IPv4 packet header. NAPT takes that farther by including the transport address. NAPT is a kludge to extend the life of IPv4 until IPv6 is ubiquitous. See this answer about that.
    – Ron Maupin
    Commented Jun 26, 2021 at 19:09

3 Answers 3

6

As powerful as this technology may seem...

NAPT actually hamstrings IPv4 by breaking the IP paradigm of end-to-end connections, and only TCP, UDP, and ICMP work on NAPT. Even some applications and application-layer protocols are broken by NAPT. It also prevents development of new, more modern transport protocols.

I think you are confused and have things backwards. NAT or NAPT does not get public addressing, but you may or may not use NAT or NAPT with any public IPv4 addressing you do get (IPv6 does not have a NAT standard the way IPv4 does; it has an experimental NAT RFC, but it forbids NAPT).

is there even another way to get public ips besides using NAT and how it is done

IPv4 addresses are exhausted. IANA has run out of IPv4 addresses to assign to the RIRs, which, in turn, have run out of IPv4 addresses to assign to businesses.

There is now an open market for public IPv4 addresses where businesses with excess public IPv4 addresses can sell the excess to other businesses needing public IPv4 addresses, but a business still needs to qualify through its RIR to buy the addresses.

Another possibility is that one or more businesses to which a business connects may lease that business one or a block of IPv4 addresses.

This has nothing to do with NAT or NAPT.

if by pure coincidence, two devices were to configure static NAT and use the same public Ip address, what'll happen ?

Again, this question does not really relate to NAT or NAPT. Public addresses must be unique (excepting anycast). The businesses making up the public Internet will ostracize any business using IP addresses that it is not authorized to use.

5
  • I see i did had everything messed up lol thanks for the clarification !
    – Ninja
    Commented Jun 26, 2021 at 19:38
  • 1
    Part of the reason why they’re out of IPv4 space is because they allowed some of the companies to obtain /8 blocks that they didn’t actually need, and still don’t in some cases, and those companies refuse to give them up for smaller blocks.
    – Jesse P.
    Commented Jun 26, 2021 at 20:01
  • 3
    Remember that back in those days, the Internet was still a government experiment that forbade commercial use. In any case, it is so large now that the addition of even something as large as the 240.0.0.0/4 reserved block (1/16th of the total IPv4 address apace) will not affect it. There are several times the entire public address space of hosts, and NAPT would still be required.
    – Ron Maupin
    Commented Jun 26, 2021 at 20:07
  • @RonMaupin Yep. True, but I’m sure it didn’t help things for them to allow the assignment of such large blocks to private companies that didn’t actually NEED the space for any reason.
    – Jesse P.
    Commented Jun 26, 2021 at 20:45
  • 3
    As has been said many times, many places, even if every one of the legacy classful blocks were returned, it wouldn't change anything... we'd still run out of v4 space in a matter of months. Class E (240/4) has been debated over and over, but it too would make little difference and would require significant reprogramming of internet devices that have forbidden it's use for decades. Such efforts should be put towards IPv6 adoption.
    – Ricky
    Commented Jun 26, 2021 at 22:03
0

With the greatest respect to Ron Maupin, it's different in Europe.

Over the last 20 years, virtually all fixed line IPv4 Internet connections in Europe use NAT, largely because RIPE (the regional Internet registry) has tried hard to conserve the IPv4 address space by making it difficult to order multiple addresses.

When you order a home Internet connection, you will receive one dynamic public IP address on a router with firewall which typically presents 192.168.1.0/24 (an RFC1918 subnet)1) on its LAN ports and WiFi.

None of the devices on the home network are visible on the Internet for incoming connections (the router does not know which private address maps to its public address), but if you want to host a multiplayer game or view your security webcam remotely, you can configure the router with a static NAT and port entry.

Outgoing connections establish a dynamic NAT entry which maps the private address and port to a public address and port.

Business connections will use static public IP addresses (often more than 1) with one or two routers supplied by the ISP and one or more firewalls supplied by the customer. The firewall contains static NAT rules which, for example, can redirect incoming SMTP to the mail server and HTTPS to the web server, even for the same IP address.

Most applications work very well behind NAT (FTP being a notable exception, as in active mode the host IP address is sent in an FTP message). Without static IP and static NAT, peer-to-peer applications like Skype need to use a central server to establish the connection (normally, a dynamic NAT entry does not contain the destination address which caused its creation and can (firewall permitting) be used by a third public IP address for a peer-to-peer UDP connection). In general, a central relay server is used for applications such as TeamViewer to get round these limitations.

Apart from conserving IP address space, using NAT protects the devices on LAN from port scanning attacks and permits businesses to use many subnets to create private networks and to use multiple VLANs without involving the ISP.

Another use for NAT is when companies merge and find that they have the same private IP subnets. NAT can be used to enable company A users to access company B's servers without passing by the Internet.

2
  • 2
    The issue is that NAT or the NAPT variant do not assign a public address as the question assumes. You can use NAT or NAPT on a public address assigned to you, but NAT does not do the assigning. Also, home networking is explicitly off-topic here (use Super User for home networking). "Another use for NAT is when companies merge and find that they have the same private IP subnets." That problem really causes problems in companies, and that NAT is not NAPT, and is a temporary solution until readdressing can happen, but that can be a huge effort. The solution to that is IPv6.
    – Ron Maupin
    Commented Jun 27, 2021 at 12:58
  • 1
    Breaking the paradigm of end-to-end connections to alleviate the lack of available addresses comes at a price (performance, simplicity, reliability). NA(P)T was not designed as a security feature and it would be dangerous to rely on it. Especially when the IPv4 device may already be IPv6-enabled and directly exposed on the Internet. Filtering is the firewall's job. And in fact the depletion of IPv4 addresses is one reason why ISPs have resorted to CGNAT which is a problem trying to solve another problem but adds complexity and creates new issues (like data retention requirements).
    – Kate
    Commented Jul 2, 2021 at 22:00
0

if by pure coincidence, two devices were to configure static NAT and use the same public Ip address, what'll happen

There are two parts to using an address:

  1. Sending packets with the address marked as the source.
  2. Receiving the packets that have the address marked as the destination.

Of these, any computer can do 1. When a wrong address is set maliciously, it is called address spoofing. Some service operators will block outgoing packets that have unauthorized address.

However, who receives the packets is determined by the routing rules set by the service operators. At a single router, there is always a specific cable that receives packets with a specific address. There may be fallback routes that get activated if the primary one fails.

So if an individual subscriber configures wrong IP address for their NAT device, it will send packets with that address. They may or may not get through to internet, but any reply will always go to the place that has been configured in the routing tables of the service providers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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