This is Part 17 of azure tutorial. In this video, we'll discuss the difference between
public IP address and private IP address, and more importantly, why do we need two different
IP addresses. Well, we need both private and public IP addresses to connect and do anything
on the internet. For example, when you fire up your favourite browser like google chrome
and then navigate to pragimtech.com, how does the internet know it has to deliver the content
from this website to your laptop and not to someone else's laptop or phone in your office
or home network? Well, this is made possible by public and private IP addresses working together.
For example, let's say in your home you have two computers and three mobile phones, all these
devices connected to the same network. Now, the router which you use to connect to the internet
assigns a private IP address to each device on your home network, in our example for the two
computers and three mobile phones. The router itself gets a public IP address assigned to it
from the internet service provider like BT that is British Telecom or Virgin Media, if you're in the
United Kingdom or Comcast for example if you're in the United States. If you're in a different
country, you may have different internet service providers. The important point to keep in mind is,
it is the internet service provider that assigns a public IP address to your router and it is
the router that assigns private IP addresses to all the devices on your home or office network.
Now, with this setup let's say, from one of our computers we request an article from a website
like pragimtech.com on the internet. The internet knows your router public IP address, this is how
the internet identifies your computer, so it sends the response from this website pragimtech.com
to your router using this public IP address. Your router in turn knows the private IP addresses
of each of your devices that are connected to your home or office network. So the router
then forwards that response to that respective device. In our example, we have five devices - two
computers and three mobile phones. So, all the five devices have the same public IP address, but
a unique and different private IP address. This is how the router is able to send the response it
received from the internet to the device that made the request. Now, there are different terms that
people use interchangeably to refer to private and public IP addresses. Private IP address
is also commonly known as internal IP address or LAN IP address. By the way, LAN stands for
Local Area Network and public IP address is also known as external IP address or WAN IP address.
WAN stands for Wide Area Network. Now, if you're wondering how do I find my private and public
IP address. Well, there are several ways. One of the easiest ways, to find your private IP address
is from the command prompt. So, to launch command prompt, in the run window type this command "cmd"
and then click ok. In the command prompt, type this command "ipconfig" and then press the enter
key. There we go, IPv4 address, that's my laptop private IP address. I intentionally masked part of
the private IP address for security reasons. Now, we also have something here called default gateway
IP address. This is the private IP address of our router. Remember, every device that is connected
to your home or office network has both private and a public IP address. Public IP address is same
for all the devices including the router whereas the private IP address is different and unique
for each device that is connected to your home or office network. So, the point to keep in mind is,
this default gateway IP address is the IP address of your router. Make a note of it, we'll be using
it shortly to find the public IP address. Fire up your web browser and in the address bar
type your router's private IP address. Remember, this is the default gateway IP address, that
we have seen on the command prompt. So http:// your router private ip address in my case it is
192.168.1.254 and then press the enter key. This is the router admin page. Notice,
in this box "Internet Access", we see WAN IP address. This is my public IP address. Remember
public ip address is also called WAN IP address. Again, for security reasons I have
masked part of my public IP address. Another easy way to find your public IP address is,
to simply navigate to this website "wanip.info". It displays your public IP address. Now,
here are some important points to keep in mind about public and private IP addresses. Public
IP address is also commonly called as internet IP address. It is by this public IP address your
computer is identified on the internet. If you connect to the internet from an airport or hotel,
your public IP address changes. Private IP address is private to your home or office network. The
internet or the external world does not know about your private IP address. Private IP addresses are
generated by your internet router. Now, if you're wondering, why are we talking about private and
public IP addresses in Azure course. Well, that's because, to understand some of the azure concepts,
it's very important we understand the difference between private and public IP addresses.
For example, I have a virtual machine here in azure. The name of the virtual machine,
as you can see is "vm-pragimtech", and on this virtual machine, I have JIT VM access enabled,
that is, just in time virtual machine access. If you are new to the concepts of virtual machines
and JIT VM access, we discussed them in detail in our previous videos in this course. Now,
I want to connect and remotely log into this virtual machine in azure. For that, we need to
request access. Let's request access from Azure Security Center. To get to azure security center,
click on the "Configuration" tab and then click this link "Open azure security center". Select
the virtual machine and then click this button - Request Access. To be able to remotely connect,
we want this port 3389 to be opened up. So, let's click "ON" and then I want to allow connection
to this azure virtual machine only from my laptop. So, I've selected "My IP" here. So,
the laptop that I'm currently using and logged into azure portal, so we want to allow connection
from my laptop only. So, I selected "MyIP" and then, let's click this button - "Open ports".
Request approved. Now, let's go back to our virtual machine. Click on this "Networking" tab.
Notice, when we requested access, it automatically added this inbound port rule. So, basically,
it is allowing access to this port 3389 for RDP access, that is, Remote Desktop Protocol access
from this source, from this IP address. Remember, when we requested access, we selected "My IP",
that is my laptop IP address, but if you take a look at command prompt,
notice my laptop IP address starts with 192, but what we have in azure here,
starts with 82. They are different IP addresses. I am confused. Well, if you have understood the
difference between private IP address and public IP address, what we see here in the azure portal
is my public IP address, and we can confirm this by navigating to this website
"wanip.info". Notice, my public IP address, just like in the azure portal, starts with 82.129.
Remember, the external world like azure in this case knows about my public IP address but
not about my private IP address. That's it in this video. Thank you for listening.