difference private IP and public IP

2019-05-07 06:02发布

问题:

Can anybody explain me why I got two different IP-addresses?

So if I type on terminal ipconfig I get my network information where my Ip-adress is like 192.168.###.###. So I know that this is in private IP-range (private IP).

But if I for example google after myipadress I got as result something like this: 84.112.###.###.

And this is in my opinion the public IP-adress and after the website information the location of the ip-address (ISP) is about 3.3 km away from my current location...

So what would you answer if somebody asks after your IP-address??? which one would you say to him?

And the second question (or my own opinion) how can I determine my public IP without googling? What is technique behind that?

I think thats easy for this kind of websites because they get of course your public IP in the IP-frame if you go on their website and therefore that is not a problem.

And finally why do I have a private address at all? I know behind a network/interface there can be about 255 devices. In this case my modem must be able to grant up to 255 devices to the internet by giving a private(dynamic) address to everyone. The last 3 numbers of the IP-address can differ.

Can I say that my wlan-modem is a router?

I'm really confused about the IP-adresses can anybody help me?

thanks before

回答1:

  1. You would tell them the 84 address as this is what is visible to the world.

  2. The wlan-modem that you describe (it sounds like you are on a home network) acts as a translator between the one public address that your internet provider assigns you and the many devices in your house. You can usually point your web browser at the wlan-modem and it will tell you its public address. You would point your browser to http://192.168.XXX.YYY where XXX.YYY is what your computer lists as its gateway. In most cases it works like this: your computer's address is 192.168.1.100, and it will have a gateway of 192.168.1.1.

  3. Why private addresses? There are two reasons, first is your ISP has a limited number of public addresses that is can give out to users (and only wants to give you one), and second is that by putting your computer on a private network its not directly accessible to the internet (picture your computer behind a one way mirror). All non-private IP's are like phone numbers, they are unique, nobody else has your number, while private IP addresses act more like internal extensions in a business.

What's special about the private 192.168.XXX.YYY vs 84.5.XXX.YYY ranges? Nothing really, other than a group of people said this set of addresses isn't global and can be used privately. https://tools.ietf.org/html/rfc1918

The technical term for what your wlan-modem is "Network Address Translation" (NAT) device. This is a device that sits between a private and public network and rewrites network traffic to make everything look like it originated from one public address.



回答2:

Your modem (yes, you can call it a router) creates a private address space. Every device behind the router receives a private address in the 192.168.x.x network. 192.168 is a special address space reserved for private networks. (There are other blocks reserved for private networks, but your router uses 192.168, which is common.)

Your Internet Provider only allocates one public IP address to your router, which can then share it with all its connected devices. This strategy is called Network Address Translation.

It has a few purposes, some security-related, but the primary purpose of NAT is to allow multiple devices to share a single public IP address.

If someone is asking for your IP address, give them your public IP address if they are outside your network because that's what they see. Or if they are connected to the same router as you, they will want to know the private IP because that's what they see.



回答3:

As you know "IPv4" can handle maximum 4.3 billion unique IP (name as public IP or valid IP) for us (one of the reason that nowadays we change to IPv6 is this). So we need to use private IP to control usage of valid one. you can see PRIVATE IP on your router or DSL modem or any other devices connect you to IPS (that you can change it to any private IP that you need on your network , Local Area Network). You have IP pool on this device (modem) that can assign to other devices on your LAN so your modem change to position of a router here and have a table like CAM table on a router that you can see on your modem configuration (or GUI).

Now what happen too this IP addresses on your LAN when your data packets want to access to other network (like downloading and uploading)?

Here we have a technology name as "NAT" that change your Private IP to valid IP that can access to other network on internet (WAN) so we use many many many private IP in our network but maybe other networks know us just with one Public IP but (big but) we can't use this Public IP forever(it is not assign for us) because our IPS (our internet provider service) maybe use this public IP for many of its customer.

So what can we do?

You can rent a Public IP address for yourself and pay for that to use it just for yourself (that many of big company have Public IPs for themselves to connect directly without NAT)

for yourself to know more you can test it like that I do below :

C:\Users\EliAs>tracert google.com

Tracing route to google.com [173.194.40.197] over a maximum of 30 hops:

1---- 1 ms 1 ms 2 ms 192.168.1.1

2---- 41 ms 58 ms 162 ms 85-15-16-105.shatel.ir [85.15.16.105]

3---- 54 ms 103 ms 43 ms 85-15-16-97.shatel.ir [85.15.16.97]

4---- 47 ms 47 ms 49 ms 85-15-2-9.shatel.ir [85.15.2.9]

5---- 67 ms 44 ms 43 ms 85-15-0-1.shatel.ir [85.15.0.1]

6---- 44 ms 41 ms 43 ms 85-15-0-58.shatel.ir [85.15.0.58]

7---- 48 ms 43 ms 42 ms 78.38.255.89

8---- 53 ms 44 ms 93 ms 10.10.53.197

9---- 88 ms 121 ms 84 ms 10.201.22.102

10---- 43 ms 43 ms * 10.10.36.218

11---- * * * Request timed out.

12---- 182 ms 188 ms 217 ms ae0-xcr1.fra.cw.net [195.2.30.25]

13---- 191 ms 184 ms 266 ms xe-0-0-1-xcr1.fix.cw.net [195.2.28.202]

you can see your private IP add on NO.1 and change of IP on other NO.