If I type ipconfig in my system, I am getting an ip address which is different from what I get from google(what is my ip). Which IP address needs to be considered?
The ipconfig command on Windows provides the actual address used by the computer.
Address given by 'what-is-my-ip' tool is the publicly advertised address of either the Proxy server or the Gateway Router via which the computer connects to the Internet.
{ Internet } --> what-is-my-ip sees
+ all computers behind gateway
| as 54.102.3.209
|
|
| 54.102.3.209 --> Public address of Gateway
+------+------+ Advertised to the internet
| Gateway |
| Router | --> NAT is performed by Gateway
+------+------+
| 10.1.1.254 --> Internal address known to LAN
|
|
+-----------+----------+
| | |
+---+---+ +---+---+ +---+---+
| host 1| | ..... | | host n|
+-------+ +-------+ +-------+
10.1.1.15 10.1.1.101 10.1.1.4 --> Actual addresses of computers in LAN
(shown by ipconfig)
IP Address uniquely identifies the computer in a network.
There are 2 kinds of addresses:
Public (Globally unique and need to be purchased),
Private (Locally unique and free)
(10.x.x.x, 172.16.0.0 to 172.31.255.255, 192.168.x.x)
It is usual practice for LANs (local area networks) to have private addresses for all computers, and only one public address for the Gateway Router.
This method of using private addresses for all computers and only one public address for Gateway provides these 2 major benefits:
Cost of owning IP Addresses can be reduced (all private addresses are free)
Depletion of IP addresses can be controlled
(Every device on Internet cannot get a unique public address, as the number of addresses supported by IPv4 format is far lower than the number of devices connected to the Internet)
Gateway Router is the device that connects the LAN or groups of LANs to the Internet.
The Gateway needs to have a public address, in order to allow the internet hosts to reach it.
The Gateway router uses the technique of Network Address Translation (NAT) to allow the computers behind it, which have private addresses, to reach the internet, via the gateway.
The internet sees the address of Gateway Router as the IP address of all computers with private addresses that are behind it.
ipconfig returns your local ip address. May be you are in some local network and connected to ani switch or router or mikrotik.
Ip address is returned from "what is my ip" is the ip addres of this router/switch/mikrotik.
If you type ipconfig you get your local address, which is typically not the public address seen on the Internet.
Just to explain you that, take a look at this picture:
https://www.devadmin.it/wp-content/uploads/2018/07/072418_1033_Accessoremo1.png
What does it mean?
You have an address to talk to your router.
Your router has another address to talk to your Internet Service Provider.
Typically, there are different scenarios, based on how the Internet Service Provider manages the IPs on the public Internet.
You can have a dynamic IP assigned only to your router. Please, take a look at the following image: https://www.devadmin.it/wp-content/uploads/2018/07/072418_1033_Accessoremo3.png
You can have a dynamic IP shared with other routers. Please, take a look at this image: https://www.devadmin.it/wp-content/uploads/2018/07/072418_1033_Accessoremo4.png
You can have a static IP. It means that your Home network is always reachable from outside with that IP. This typically needs a special contract with you ISP and you may pay more money to have this contract. Please, take a look at this image:
https://www.devadmin.it/wp-content/uploads/2018/07/072418_1033_Accessoremo2.png
When I say Dynamic IP, it means that your ISP can dynamically assign an IP on the Internet every time you connect to the Internet.
You should think about your internal IP as the room in your house where you are located (bedroom or kitchen) and your ISP's IP assigned to you is the building where you live (a street address).
If you live in a condominium, different people can have your same address.
In that case, think about the IP between your ISP and your router as the apartment number.
Your ISP knows the number of your apartment and knows how to deliver messages to you, no matter if you are in the bedroom or in the kitchen.
It is your private router that knows in which room of the apartment you are. Think about rooms as the devices you have in your flat (Computer, Tablet, Smartphone, etc.).
Your device only returns by ipconfig its actual IP address, not the public IP.
Sites like "What is my IP" cannot read your device internal IP and they see your public IP on the Internet.
Sorry for the examples, but I think this is a good way to understand the topic.
Related
Let's say that I have a home network of 5 computers. They all share the same external IP address.
Suppose a machine that is outside the network sends a request (as a client) to one of the 5 computers (this computer will be the server) in this home network. It sends its message to the external IP address. Then, how does the router know to what computer in the home network the message has to be routed to?
Typically when you talk about NAT, there are two main “flavours” - Source NAT & Destination NAT. There is another function called “PAT” (or Port Address Translation).
Source NAT is utilised when all your 5 computers are trying to reach out to the public (Internet) network. At this point your 5 computers get MASQUARADED with your public IPv4 address.
Destination NAT is what you’re asking for. In this case, you must configure your router/firewall (device that holds your public address & maintains your public connection) to “REDIRECT” or “DNAT” all incoming packets destined to a specific application (or port). For instance, if you have an HTTP server running on your private network server with address 10.0.0.3, you simply instruct your router to send all (or selective) TCP packets that have been sent to the public IP on ports 80/443 & send those to 10.0.0.3.
In DNAT scenario you must explicitly instruct your router/firewall about every type of expected, incoming connection. Another example can be that same public address is been used for SMTP server and thus sending all TCP packets received on port 25 to be sent to local server 10.0.0.4 this time. And so on and so forth
That’s in short how it works.
Network Address Translation (NAT) allows a single device, such as a router, to act as an agent between the Internet (or public network) and a local network (or private network), which means that only a single unique IP address is required to represent an entire group of computers to anything outside their network.
ADDRESS TRANSLATION (NAT) OVERLOAD allows your 5 computers to communicate with your router. Each computer has unique private IP address.
When computer1 tries to communicate with website, it sends packet to router.
Router replace the private IP address (example: 192.168.1.1) with single public IP address (example: 205.65.45.100) but uses same source port number (for example Port 5000) which is used by computer. It won’t change the source port number. And Router maintains entry in NAT table.
The reply from the (web server) internet arrives at your public interface of your router.
The router accepts packet and check the destination port entry. With the help of the NAT table, your router understands that it belongs to computer1. Router changes single public IP address (example: 205.65.45.100) with your internal private address (example: 192.168.1.1) and your computer receives it.
This process is applicable for all 5 computers.
Above scenario is only applicable if your computers act as a client. If your computer acts as a server then the solution is “Port forwarding”.
Port forwarding is needed when a machine on the Internet needs to initiate a connection to a machine that's behind a firewall or NAT router.
Refer video for detail information.
https://www.youtube.com/watch?v=-K6jMYBfuIY
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).
When i try to use [nc -l] command with my private IP address,i am able to create a client server model.But it doesn't work when i try to use my public IP address with the same port number.It gives me the following error:-
nc: Can't assign requested address
Why??
Your problem is that your public IP is the IP of your router, not your computer.
Simplified, your network probably looks like this (IP addresses are only examples):
+--------------+ +-----------------+----------------+
| PC |-----|Router (internal)|Router(external)|---... Internet
| 192.168.0.10 | |192.168.0.1 |123.132.122.133 |
+--------------+ +-----------------+----------------+
Your PC's internal address is 192.168.0.10, and that's the only address it knows. The router routes traffic to other networks; for that it has two interfaces, the internal one with the address 192.168.0.1 and the internet-facing one (123.132.122.133). On your PC, you can't listen on the latter address, since that's the router's address, not the one of the PC.
So the solution is to listen on the internal IP, and setup the router to forward traffic of the respective port to the corresponding port on your PC. Beware of the security implications, though! (E.g. leaving a root shell open to the internet might not be the best idea.)
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.
Was just wondering why I seem to get different values for my IP address from different sources. If I go to one of the many different 'what's my ip' sites on the net I get a completely different value from when I use ipconfig (on win7)
And no, it's not the subnet mask I'm looking at, these are the actual ipv4 addresses, why would they be resolving to different addresses? Are these 'what's my IP' sites only able to hit an exchange and not determine the IPs of my actual box itself?
If your PC is on a network and not directly connected to your ISP via a modem, there will be at least one router between your machine and the internet. That router will almost certainly be doing NAT (Network Address Translation) and possibly DHCP (Dynamic Host Configuration Protocol) too.
The router will have been assigned an address by the ISP when it established the connection. This address might be static (unchanging) or, more commonly, dynamic (changes periodically as the ISP sees fit). So your 'public' address - the one the router has been assigned and which is visible to the internet - may change from time to time.
Your PC will be connected to the router, and will either have a fixed IP address assigned to it (typically in the 192.168.x.x range) through your OS networking config, or will be given one by the router each time it connects (when you switch on or reboot) via DHCP. In this case, the address will be in whatever range the DHCP service has been told to use (again, the default is likely to be in the 192.168.x.x range).
So your PC has its' own internal address, and your router has its' public address. When you exchange internet traffic, the machine at the other end of the connection will see your public address, not your internal address - the router takes care of forwarding data to the right internal address automatically.
Depending on what IP-checker service you're using, it might display your public address (from the router, which may change if the ISP assigns dynamic addresses) or your internal address (typically when a script runs inside the browser and asks the machine directly).
The answer won't clarify anything, but I'll tell you anyway.
They're both right.
No, your machine doesn't really have two IP addresses, but the IP it shows as depends on who's looking, and from where.
•
What you're seeing is the result of what's called a NAT router. NAT stands for "Network Address Translation". The router manages the IP addresses on a LAN, or Local Area Network, and then translates to the appropriate IP address it was assigned on the external network, usually the internet.
details