IP allocation in gprs - ip

I have been searching on internet about IP allocation in gprs device, every time it says hour mobile device gets a private IP but when I am connecting my mobile to internet via gprs I am getting public IP 100.106.x.x which changes every time I switch off and on mobile data.
Can anyone help me with that ???

The public IP address is actually not of your own device, the public IP address is of the device which gives you a NAT IP to your mobile device.

Related

Public IP address vs Private IP address

Good day to all,
I am trying to study networking basics. Watched a ton of videos, researched abit and understood better. However I can't find answers to what I am curious about. Forgive me, I am just a beginner in this IT thing.
A computer has a Public IP address (which is sensitive), and obtains a Private IP address after it is connected to a router.
A router has a Public IP address and also a Private IP address (192.168.1.1 for linksys). It will then assign all the devices connnected to it which its own Private IP address, for example 192.168.1.102.
So here is something I don't quite understand (even after researching online);
Mobile phones uses its own public ip address to connect to the internet via Mobile Data, is that right?
Desktop does not uses its public address at all since it is always connected to a router which assigns it a private ip address?
When a computer outside the network wants to connect to a computer inside a network, does the connection happen directly between computer to computer or does it have to connect through the router where the router will then pass the connection to the computer inside the network?
I can't seem to find any explanation how computer IP public address are utilised since it is always connected to a router where it has its own private IP address.
Forgive me, I am just a beginner. Thank you in advance.
1.) Yes(Mobile Phones are connected via radio masts which are provided by your provider.)
2.) Yes, Desktop Computers same as Mobile Phones which are connected to the router via wifi use the routers IP Adress.
3.) If a computer outside the networks needs data from a computer inside your network it sends a request to your router which forwards it to your computer (which request are forwarded determines the firewall of your router). Also if you request data from a computer outside your network you send a request to your router and the router sends a request to the network of the other computer.

IP address Dynamic or static

I have a laptop and a mobile phone both connected to a common wifi. I need to send data from phone to laptop using MQTT protocol. I would like to know whether my laptop's IP will change or will it be the same . If IP will change, then each time I need to change IP address in the program.
If you use the same modem or router to access the internet, it will give you the same IP adres until you are away for an x amount of time (usually weeks or months if not configured).
Unless you're not using an open wifi network, you're good to go!

Different IP address error?

I had connect my laptop and phone under a same router/modem.
But the IP addresses that shown on my laptop and phone are different, why???
I'm quite newbie for it, please help me
IP addresses are different inside your network. When you send data outside the network your router uses NAT (Network Address Translation) to assign your Internal(LAN) address your External(WAN) address for the duration of that communication. If they had the same Internal IP address then you would have an error like this http://compnetworking.about.com/od/workingwithipaddresses/f/ip_conflict.htm

why my IP address is public but not private?

In my work, I have a desktop that is connected to internet with ethernet.
It does not have a private IP address but a public one: 172.16.30.208.
My laptop which is connected wireless has IP address which is again NOT private: 128.208.138.125.
when I ping my laptop from the desktop (packets received)
ping 128.208.138.125,
PING 128.208.138.125 (128.208.138.125): 56 data bytes
64 bytes from 128.208.138.125: icmp_seq=0 ttl=59 time=83.788 ms
64 bytes from 128.208.138.125: icmp_seq=1 ttl=59 time=24.384 ms
64 bytes from 128.208.138.125: icmp_seq=2 ttl=59 time=120.292 ms
but when I ping my desktop from laptop (no response)
ping 172.16.30.208
PING 172.16.30.208 (172.16.30.208): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
The questions are:
why the IP address on both the computers are not private? (anything starting with 192.X.X.X and 10.X.X.X are private I suppose)
why I was able to ping from desktop to laptop but not other way?
I understand that both desktop and laptop are in different network.
Addresses in the range 172.16.0.0 to 172.31.255.255 are also reserved, like 192.168.x.x and 10.x.x.x, and are not routed externally. http://en.wikipedia.org/wiki/Reserved_IP_addresses. So the DHCP settings on the ethernet router in question don't match the more common 192.168.x.x or 10.x.x.x defaults, but the router isn't handing out public addresses.
Edit - because the comments are getting long:
The desktop can successfully ping the laptop because of NAT (http://en.wikipedia.org/wiki/Network_address_translation). This is how any machine with an internal IP is able to get data from outside the local network. Continuing with the example from this question: The desktop assembles a ping request packet with the laptop's public IP as the destination. When the local router sees that the destination is external but the source is internal, it swaps the source address for the router's own public address before sending. That means the laptop just replies directly to the router. However, when the router gets the response, it remembers which local device actually requested the ping and swaps the destination address on the response from the router public address to the correct internal address before passing it through to the internal network.
Edit - Elaborating on the laptop side
Quick disclaimer: The public/private question of the laptop IP is pretty specific to the UW network setup, which I haven't actually worked with, so much of the following is conjecture based on my links from the comments.
The short answer:
128.208.135.125 is a public IP address that is owned by UW. It will only be assigned to one device at a time (i.e. your laptop right now).
The long answer:
The UW network runs a different type of NAT that they call "Masquerading". Each NAT setup comes with its own lists of pros and cons; I will only be highlighting a few considerations. The key difference here lies in this step from my previous NAT overview, "[the router] remembers which local device actually requested[...]". Normally, the router "remembers" by keeping a table of local addresses and the recent requests made by the associated devices so it knows which replies go to whom. With this setup, the address translation must always be done to route data between internal and external devices. In the masquerading version, each device has both a public and private address and the table no longer has to track requests; it just maps between the public and private addresses. This means the address translation can be optional depending on the context, and hosts connected to the UW network in this fashion can communicate among themselves using either private or public addresses depending on how the host would like the packets to be treated by the router(s) and firewall(s). However, any device outside the masquerading section of the network needs to use the public address. This also allows an optimization, that UW has taken advantage of, where the table can be implied by convention. In this case, the address translation will always be changing the leading "128" in the address to "10" or vice-versa, so the table doesn't need to be stored anywhere. Your laptop's private address will be 10.208.135.125.

Getting the host ID and network ID from an IP address

I'm learning about IP addressing, and I'm still a bit confused. I know that an IP address consists of a network and host ID. To test this in the real world, I googled "what is my IP address" on my tablet and smartphone, both connected to my home wireless network and I got the same IP address. Shouldn't they be different since they are two different hosts? I suspect this has to do with public and private IP addresses, but then, my bigger question is how does data really get to my individual device?
To the outside "internet", your IP address is just the IP of your router, provided by your ISP. Within your home network, you have a set of private addresses assigned by your router. The way that programs know to communicate with the correct device is usually through a custom reply-to port that the router re-assigns to packets from each device. This is called NAT.
For example, if you are browsing on port 80 from your tablet and your laptop at the same time, your reply-to port may be set to 3245 for the tablet and 3246 for the laptop. When the router receives a packet going from port 80 to port 3245, it changes 3245 to 80 and sends it to your tablet. If the port is 3246, it sends it to your laptop instead. The key point here is that the website you are communicating only knows the IP of your home router. As far as those sites are concerned, there are no other devices.
To test this in the real world, I googled "what is my IP address" on my tablet and smartphone, both connected to my home wireless network and I got the same IP address. Shouldn't they be different since they are two different hosts?
No, because of NAT.
I suspect this has to do with public and private IP addresses, but then, my bigger question is how does data really get to my individual device?
Thanks to NAT.

Resources