difference private IP and public IP - networking

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

You would tell them the 84 address as this is what is visible to the world.
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.
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://www.rfc-editor.org/rfc/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.

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.

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.

Related

How to perfrom subnetting for class B private IP address?

Suppose you are assigned to design a LAN for an office having 8 departments. Each department will have 28 computers located in different rooms. Perform subnetting assuming class B private IP address.
I suggest using VLAN for each department, you can use this documentation
how to configure VLAN network and also you can view here example architecture.
Once the VLAN configured you can now use the Class B IP addresses depending on your network setup, you can also use this link IP Address and Subnetting Guide.
The question wants you to understand the Class B allocation of private addressing within RFC1918. RFC1918 allocated a single class A, 16 class Bs and an entire block of 256 class Cs. To answer this question (i'm not doing what is clearly your homework for you) You need to seach for all of the address space set aside in RFC1918 and figure out which is class B.
Then, using some of that address space, create subnets sufficient for networks containing 28 hosts on each network. I'm not sure if your professor/instructor is expecting you to make subnets that are just big enough to support that many users or if you are expected to allow for a resonable amount of growth. You might want to clarify.

how to find the maximum of simultaneous TCP connections supportable by a system?

I was wondering, admitting an address system translation which uses public address in order to offer an access to Internet to 15 computers, how could I find the maximum of simultaneous TCP connections supportable by this system please?
I am beginner with network and not able to find an answer to that, although I was thinking, a TCP connection can handle 65 535 simultaneous connections, since there is 15 computers then I get : 65 535/15 = 4369, is that correct?
Thanks a lot in advance
The things you called "address system translation" always named as NAT(Netowrk Address Translation) devices such as routers.
A network connection is checked by the tuple of five elements: Source IP, Source Port, Destination IP, Destination Port, and Protocol. So the limitation of connection numbers is decided by these elements.
You said 65536 connetions, this is the limitation of ports.
For a Circumstance like you said, 1 router with 1 external IP, for every one of the 15 PC inside of the NAT LAN, the circumstances is like:
Source IP is the router's external IP
Source Port has at max 65536 choices
Destination IP is limited by the IPV4 or IPV6 address length
Destination Port is limited by 65536
Protocol can choose TCP/UDP
So you can see, in theory we can have millions of connections for every PC. But the thing is that we need to consider the limitation of hardware, OS and virtual memory, so we can't have so much.

Can a pure peer-to-peer network reassemble itself after all the nodes have been rebooted?

The setup is this:
We have a group of computers that have public ip addresses assigned to them so that they can access the internet. these computers are connected together forming a pure (trackerless) peer-to-peer network.
My understanding of the public ip address system is that those addresses are not unique to each router meaning that a router can have an ip address today and have a totally different one tomorrow or in the next hour or maybe a week from now.
The problem is what happens if nodes in the network have had their public ip address changed to a new one while they were not connected to the network. how are these nodes supposed to rejoin the network?? should each node maintain a list of all the public ip addresses of the all the nodes in the network and try to open a connection to each one of theme?? if yes what if the network has a million nodes, what about timeouts if the ip address is still the same but the connection failed for some reason??
Another problem arises when all the nodes have had their ip addresses changed simultaneously. how are they supposed to reassemble the network without any working ip addresses??
it would be appreciated if you could recommend books, articles or videos that explain how peer-to-peer apps like trackerless file sharing apps function on a more technical level (Nat traversal, and initial bootstrapping to the distributed hash table).
The fix is either to have a registrar at a well known address (i.e. not a peer) or seed each node with address of a number of peers (say, 10 or 100). I seem to recall a paper on this and it's was a relatively small number to find a live node in practice. When a peer boots up try to each peer till you find the network. Once you find one, you can get a current seed list and figure out which peers you want to connect to.
The other question that also comes up (along with NAT) is how do you connect to node behind a firewall. The term you want to look up is Hole punching.
If your nodes are on a lan you have broadcast options. This is how DHCP works for instance. You might want to check out Zero-configuration networking. Multicast might be an option on wan.

Peer-to-peer chat

im wondering if it's possible to create p2p chat application without server(so there is no need in external static ip.Is it true?)?
EddieC is right if the computers are located inside the same sub-network (LAN) or if the computers'ip is their interface to the Internet (WAN public ip). In that case, you can just use the ip's and ports directly.
However, usually, knowing the computers ip is not enough because the machines are located behind routers inside sub-networks. Thus, because the computers are hidden behind the routers, you will have to configure the routers to foward the packets to the right computers as function of the ports used.
Have a look at : http://wiki.vuze.com/w/Port_forwarding
If you do not want to use ip's because they are dynamic, you can configure urls with Dynamic DNS services.
Good luck
It is possible. But you must have someway for one computer to tell the other computer what their IP number is. You could email it to your friend or call them on the phone or post it on a message board.
If this program only has to work on a local network (LAN), there is something called broadcasting which might be of interest to you. It allows a packet to be sent out to every device on the network without having to know their IPs (then other instances of your program could reply with the IP of their machines so you could set up proper connections).
This won't work over the internet, though (imagine being able to broadcast to every computer connected to the internet!).

How to check if its a Router or a Switch? Address in packet from a host in private lan?

I'm in a campus network, Where the network has an hierarchy. We connect to internet using Proxy servers. All our computer IPs are something like 10.*.*.*.
10.1.*.* => Dept 1 (mathematics)
10.1.1.* => 1st floor of this dept.
10.1.1.2 => Default gateway for this floor1
10.1.2.* => 2nd floor of this dept.
10.1.2.2 => Default gateway for this floor2
10.1.3.* => 3rd floor of this dept.
10.1.3.2 => Default gateway for this floor3
Similarly for other department
10.2.*.* => Dept 2 (computer science)
10.2.1.* => 1st floor of this dept.
10.2.1.2 => Default gateway for this floor1
10.2.2.* => 2nd floor of this dept.
10.2.2.2 => Default gateway for this floor2
10.2.3.* => 3rd floor of this dept.
10.2.3.2 => Default gateway for this floor3
etc.. This goes on for 30 such deparments. I hope you got the picture. Now, I've following queries:
I want to know if the hardware (which is hanging in the corridor of each floor) that is used as "Default Gateway" is a Router or a Switch? I've its physical address "00:07:0d:e2:57:fc" / Cisco_e2:57:fc. Well, I don't have any kind of access to inspect the hardware. Its locked inside a box and hanging at a height of 3 meters.
I'm wondering what would be the src address in the IP Header of a packet that is sent from my computer (my IP is 10.3.2.47) and received by say google.com. Will it be my local IP address? Wouldn't that cause problem? How would google.com again send a reply packet to me? Because my computer is not visible outside my campus.
What if I want to send a packet from my machine( 10.3.2.47) to a computer in another private lan like mine. Say to a guy in mathematics deptartment in university of china. He may have IP address like (10.3.2.57) or even my IP address ( 10.3.2.47).
I'm really curious about how the communication occurs between a computer in private lan and outside world.
I can't answer whether that hardware is Router or Switch, but I will answer the other questions. Private IP address conflicts like the one you are suggesting in #3 are resolved by Network Address Translation. For question #2, as your request is sent to the internet, the IP address is translated into one that is suitable for the internet. The router or proxy that is doing this remembers your request and when the response comes back, it reverses the translation and sends it to you on the LAN at your private IP address.
EDIT:
Let me clarify that both of these scenarios use NAT, but a proxy server does not do NAT exactly, they have a similar method.
You can try talking to the router on its telnet or http port. It probably won't let you in but its "go away" message might give you some information of its device type.
Answers 2 and 3 are as Segfault said; the Wikipedia page is worth a read.
Some hardware performs both switch and router services (eg if there's 4 ports, 2 of them are for one vlan and 2 of them are for the other, it acts as a router between the two vlans but it also switches between the 2 ports on the same vlan). It can be difficult to tell where switches are without physically inspecting the network, but a lot of routers identify themselves if you start tracerouteing across them.
The IP headers of the packet received by google.come will be generated by a machine doing NAT somewhere on the edge of your network (more than likely your internet gateway machine). Thus the src address will be whatever public IP address the private address is mapped to in the NAT configuration.
In the case of the two different vlans within your organizations LAN, your traffic will traverse them unmolested, except for a decremented TTL. In the case of traffic going to a different host on the same vlan, it will probably be unchanged all together.
You cannot route between two different private LANs ove the internet directly. That's kind of the point of the private addressing ;). Any packets to/from a reserved private address range (eg. 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8) will be dropped on the floor by any respectable internet router. You can, however, create a tunnel between two private networks over the internet using any one of a number of VPN/tunneling solutions.

Resources