Public IP address vs Private IP address - networking

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.

Related

Does NAPT include port forwarding?

I've got difficulties in understanding NAT, NAPT, and port forwarding.
I got what NAT does. But when I try to describe port forwarding, NAT's concept becomes too vague.
I found NAPT and there is only a vague assumption that port forwarding is related to this.
Is port forwarding related to NAPT? If not, what is the difference?
NAPT stands for Network Address Port Translation and it specifically is in reference to be able to have many private IP addresses (ie - inside your building) all able to share a single public IP address (that would be assigned to your router from your ISP).
Think of it like this ... your public IP Address which is visible to the entire Internet exists on the ethernet port that you have connected to your Internet service.
Then, the other ports on your router / firewall / WiFi are all on a different network entirely - that's called your PRIVATE network.
In order to get all of those IP addresses on the inside private network to be able to have autonomous access to the Internet, your router/firewall does what we traditionally call NATting - Network Address Translation. So lets say that you and three other people access the same web site from inside your house... your firewall will see those requests to access that web site on your three different private IP addresses and it will assign to that browsing session, a unique session ID to that datastream and it will then go out and contact that web server but that unique session id rides with that datastream so that when packets come back from the web site the router knows which private IP address to send them to ... it acts as a facilitator for the internet packets going to and from the private IP addresses inside your building.
And a private IP address can be assigned to computers, tablets, cell phones, printers etc. etc.
PORT ADDRESS TRANSLATION is the exact same thing, only in reverse.
You do NOT want anyone on the Internet to be able to access any of the devices on your private network, so by default, your router/fireall denys any requests coming from somewhere on the internet that might be trying to access your public IP address.
But there are times when you have something running on one of your private IP devices ... like a gaming console, or maybe a remote desktop session that you need someone to access from the Internet ... what we typically do, is go into the routers configuration settings, and we create a PAT rule that says, "Allow any attempts to access my public IP address ON this specific port number and send those requests back to this specific private IP address." - in a nut shell.
NATting is when traffic is generated from the inside of your private network and it is going out to the Internet where PATting is for traffic coming FROM the Internet into your private network.
Hope that help clarify things a little ...
Edit: I should point out, that these days, when a device or some software running on your computer needs to allow traffic from the Internet to reach it, there is a feature in most home routers called UPNP (Universal Plug And Play) that, when enabled, devices like XBOX and other software can create - on the fly and without you having to give it any thought at all - PAT rules inside your firewall. UPNP was created because most home users don't remotely understand how network traffic works so trying to teach the non-tech person how to create PAT rules was becoming an issue, so UPnP was invented... it has its issues, but for the most part it's fairly reliable and nothing to worry about.

How can I ping my home computer from outside?

I'm trying to wrap my head around networking and the internet. This is a very big subject, and it is not my goal to understand all of it. However, I want to know how to use it for... stuff... which right now means I want to find a specific computer. I'm going for my home computer. I know the IP adress is alpha and omega when it comes to finding something online, so I have looked it up, by typing "my ip" into google. So far, so good.
However, I did the same on my phone, which is connected to the same wireless router, and lo and behold, it has the same IP address, according to google. So, if I am on a different computer, on a different network, and I try to ping that IP address, my best bet is that I'll reach that wireless router and that's that (I've checked in the router settings that that is indeed my router's IP address as well). How can I send a ping (as in, using the sommand ping, either on linux or windows) from somewhere else that goes out on the internet, and specifically finds my computer, instead of just the router controlling my home network?
Your home router has a single IP address. The router's job is to use a network address translation (NAT) to figure out which computer or device on your home network sent which requests so that all the devices on your router can use the same external IP address.
The router also has port forwarding settings that you can look up so you can, for example, set up a game server or web server that directs all outside network traffic trying to use that port to that one specific computer. You can also DMZ a specific computer but that leaves that device open to attacks.
To keep it simple: the devices in your home network do have an IP address, but it is a private IP address. In order to be able to reach your phone from the internet, it should have a public IP.
Unless you try to mess with the router, you can't reach any device from outside your network.
Your PC lives underneath the router on a smaller network called your LAN. The internet cannot see it, it can only see your router, which in this case is serving as a gateway.
Pinging is difficult behind a router depending on whether your router uses PAT or NAT. In order to forward traffic to a specific port you can change a setting in your router to forward incoming traffic on that port to the local machine.

where to get address like 10.0.2.0 in android?

I am trying to get IP address of Android Phone and it shows something like 192.168.0.0.But i need some thing like 10.0.2.0.Are both same?.Can anyone tell me what is the difference and How to get that address?
Thank you
Are you using AVD?
The AVD receives its network address and configuration on the private network from a DHCP server that is integrated into Virtual. The address which the virtual Device receives is usually on a completely different network to the host. As more than one card of a virtual device can be set up to use NAT networking, the first card is connected to the private network 10.0.2.0, the second card to the network 10.0.3.0 and so on.
It is highly unlikely that you have an IP with a 0 at the end because they are mostly used as the Network ID, especially with the 192.168.0.0 adress. The 10.0.2.0 and the 192.168.0.0 Adress are both IP Adresses that are in the private Range, so they are not public. I assume that you get your IP via DHCP so it depends on that DHCP Server what IP you will get. In the end of the day it doesn't really matter if you have an 10.0.xx.xx or a 192.168.0.xx Adress. Maybe I could help you a little more if you tell me why you need a 10.0.2.0 adress?
10.0.0.2 is an IP address found on many local computer networks, particularly business networks.Internet Protocol (IP) version 4 defines certain sets of IP addresses as restricted for private use (not available to be assigned to Web servers or other Internet hosts).

Why is my IP adress different when displayed by different methods

I am new to all this, so I am sorry if the question is stupid. I am learning about networking and I want to find out IP address of my own computer.
When I try to display it through ipconfig, my router's configuration page and by simply googling, I see different IP-address
Thank you in advance for help
in ip-config it starts with 10. ...
in router's conf page 192.168.1. ...
when googling 213. ...
ipconfig will give you the address of your machine. This will be some private IP address. Your router will have two IP address - One public and one private. All machines in your local network (house probably) will talk to the router via its private address, while everything out in the Internet talk to your router via its public address.
So, ipconfig provides the address of your computer, your router's config page shows its private address, and Google will show you your router's public address.
Some terms to look up: Look up Public vs Private IP addresses and how NAT works and this will all make more sense.

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