Let's say I have a bunch of hosts connected to a typical router (which is in fact a switch + router) that has a public global IP assigned by my ISP.
The hosts use private IPs that are non-routable addresses, and need to be translated using NAT to the public one so that it can talk with the rest of Internet.
Now, my router is connected to a network of my ISP. It has some IP address in that network, but that address is different than what my public IP address is, right? - it follows from the article linked above:
by this command:
ip nat inside source static 192.168.0.10 192.0.2.10
which assigned a public IP (in other words, inside global IP)
192.0.2.10 to the host
192.168.0.10. That's quite weird, because you usually give a public IP to all devices in your network, not to just one host.
If the inside global IP address is indeed my public IP address, can't I just change my public IP? I guess it has to be configured in the NAT of my home router. If it's not possible, is it just because the router firmware doesn't provide a way to change that IP?
Basically I've seen two ways of doing NAT:
Translating private IP of my host to the public IP of my router with a special port number (that allows the inverse translation back to my private IP to happen when the other host sends a reply).
Translating private IP of my host to a public IP that's different from the public IP of my router. The problem is - how does my NAT router know that his public address used for translation isn't already used by some other host on the Internet?
Do these two methods have different names?