1

is public IP unique? I mean that we have two kind of IP: private and public and if public IP belongs to router,does every one connect to one router have a single IP address or not?

  • 1
    On the internet, every IP address is unique. – Paul Aug 3 '15 at 6:48
  • so whats difference between public and private IP? and what is public IP? – amin gholami Aug 3 '15 at 6:51
  • 3
    Please edit your question if it didn't cover what you wanted to know, rather than using comments to discuss. – Paul Aug 3 '15 at 6:53
13

In general terms the answer is yes, public IPs are globally unique.

In the IPv4 context, the IPs (v4) known for not being unique are the private IPs, these are found in the following ranges:

  • From 10.0.0.0 to 10.255.255.255.
  • From 172.16.0.0 to 172.31.255.255.
  • From 192.168.0.0 to 192.168.255.255.

    see rfc1918

The IP your home router has on the "internet side" interface is public, given by your ISP. The IPs you use in your home's WiFi side or Ethernet Lan connection those are private, so they are not unique but it's not a problem because those never leave your home before being NATed or translated by the NAT.

EDIT:

Now, as mentioned on the comments below, there is an exception to what I just said. There are some techniques that allow us to be more flexible about the one-to-one communication original internet protocol paradigm to allow one-to-nearest. These techniques are used for example when talking about services that need high availability, redundancy or low latency like DNS, or CDN services. Given a certain IP (IPv4 or IPv6),there might be more that one server in the world configured to answer to that IP, nevertheless only one will be answering.

see rfc4786

Moreover, IPv6 introduced a new addressing system that copes with these "new needs", and it defined the "Anycast Address"

IP Version 6 (IPv6) defines a new type of address, known as an "anycast" address, that allows a packet to be routed to one of a number of different nodes all responding to the same address [2, 3]. The anycast address may be assigned to one or more network interfaces (typically on different nodes), with the network delivering each packet addressed to this address to the "nearest" interface based on the notion of "distance" determined by the routing protocols in use.

see rfc2526

About IPv6 Anycast Address

An anycast address is an address that is assigned to a set of interfaces that typically belong to different nodes. A packet sent to an anycast address is delivered to the closest interface (as defined by the routing protocols in use) identified by the anycast address. Anycast addresses are syntactically indistinguishable from unicast addresses, because anycast addresses are allocated from the unicast address space. Assigning a unicast address to more than one interface makes a unicast address an anycast address. Nodes to which the anycast address is assigned must be explicitly configured to recognize that the address is an anycast address.

see cisco source

  • 4
    You could say that private IPs are unique as well. They cannot be accessed from outside the network, and within that local network they are unique. So no matter where you are, the private IP is unique as well for your setup. – SPRBRN Aug 3 '15 at 7:40
  • 4
    The actual public IP may be a NAT though, where many customers share the same public IP. This is sometimes the case with IPs that don't allocate static IPs to individual customers without paying extra. – phyrfox Aug 3 '15 at 7:45
  • 3
    Nitpick. The three RFC1918 ranges which you specified and 127/8. – Hennes Aug 3 '15 at 7:55
  • 3
    Nitpick 2: and 169.254.0.0/16, per RFC 3927. (Link-local IP) – MSalters Aug 3 '15 at 9:38
  • 2
    @Reyssor: Yes, that is called anycast, where more than one network has the same IP block. See Daniel B's answer – 小太郎 Aug 3 '15 at 11:25
7

No, it’s not. This is in fact quite common. The technology behind this is called Anycast and used by many content-distribution networks, like CloudFlare.

Anycast is a network addressing and routing methodology in which datagrams from a single sender are routed to the topologically nearest node in a group of potential receivers, though it may be sent to several nodes, all identified by the same destination address.

Then, there’s also the possibility to (temporarily) steal others’ IP addresses. This is relatively easy if you’re an Autonomous System operator. You can simply announce that you’re hosting some IPs and traffic will magically be directed to you. Of course, the legitimate owner also broadcasts these announcements, so the effect is temporary and incomplete at best.

Only in unicast addressing is an IP address unique.

4

Public IP is the one you are visible with in the Internet.

Private IP is the one you are visible with in your private network, like behind router.

Everyone who connects to router has a single private IP, but in most common configuration they all share single public IP which, in common case, is assigned to the router, not computer.

It is possible to assign public IP for every single computer, but you have router which allows so and you must own enough of public addresses to assign. You have to buy them first.

0

Your public IP is unique by definition. It it was not unique, it could not be a public address, as it would be impossible to determine where to route your traffic.

In other words: your public IP address is the external (Internet-facing) address of the router closest to you which is still unique world-wide. That may or may not be your own router at home, although it usually is.

As pointed out though, some ISPs use NAT to conserve IPv4 addresses, in which case your home router's external address may not be a unique one and your public IP address belongs to a router further along, at your ISP (and you share it with other customers of the ISP).

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.