3

We all know that PCs on a LAN use private IP addresses such as 192.168.2.3, etc.

Now my question is, how can a PC say mine having a private address of 192.168.2.3 communicate with other LAN PC having a private address of say 192.168.2.5 because not every PCs have public addresses.

To make it more clear let's say I want to ping to your PC having an IP address 192.168.2.5.

So how will my PC or the router know to which PC it must send the message to as there can be many PCs with that same private IP address of 192.168.2.5.

  • 3
    "We all know that PCs on a LAN use private IP addresses such as 192.168.2.3 etc." That is not completely accurate. Many LANs use private addressing, but many use public addressing, and with IPv6 most will use public addressing to restore IP end-to-end connectivity that NAT breaks, which is the crux of the problem you raise. – Ron Maupin Aug 2 '17 at 14:15
  • 1
    There is a situation where multiple devices on the Internet do have the same public IP address. This is Anycast and the most well known implementation is in the geographic distribution of the root nameservers for the Domain Name System. Anycast (in IPv4) takes advantage of internet routing protocols to provide clients access to the best (usually fastest or nearest) node of the group. – Goldfish Sandwich Aug 2 '17 at 19:14
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer. – Ron Maupin Feb 19 '18 at 17:06
8

A PC in a private IP range can't be acccesed from the public internet.

Devices in private range connecting to internet use a proxy or router/NAT device that replaces the local source IP for a single public IP address that redides in your router/NAT.

However, you can make an exception to that, opening a port in the router and allowing that traffic directed to your public IP adddress and that specific port (for example, 80) get through the router and finally to your PC.

Now your PC is public at least on port 80. Internet knows how to get to your PC using the public address and the router translate that public Ip to the private that your device uses.

An example:

Your PC has the private IP address 192.168.2.3 and is connected to an internet router that has the public IP 54.239.25.200.

Now, if you open the port 80 in the router then anyone in the public internet could connect to your PC using the URL http://54.239.25.200:80

The public internet doesn't know your private IP, they know your public IP address.

  • 1
    Of course, ping (the protocol in question) uses ICMP, which doesn't have ports. – Ron Maupin Aug 2 '17 at 14:16
  • Thanks buddy.. I appreciate for ur time.. I sometimes get some crazy doubts don't mind – RRHS Aug 9 '17 at 17:36
2

If you really want to fully communicate with the remote PC/network, ping etc. you'll need a tunnel, usually a VPN connection.

  • I didn't know you can do that.. I'll look into that.. Thanks for the time – RRHS Aug 9 '17 at 17:36
1

I think the best way to do this, is creating a VPN as Zac67 says, but your question is a bit generic so it is difficult to answer without a topology with the devices involved. Basically you would need to configure a public peer for each host, so you will have a private ip and a public peer wich would be the face on the internet. Besides it would be a more safe way because all the trafic would be encrypted. Opening ports like http/80 on a router and acces it over inet is not recommended.

  • I can understand.. My bad.. I didn't frame the question properly.. Anyways thanks for your time.. I appreciate it – RRHS Aug 9 '17 at 17:37

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.