What is my Ip address? How to know what is public and private IP addresses you are using?

An IP address is the network address of the device. A network underlying layer that is responsible for addressing and routing is the network layer. It is layer three as per the OSI model.  On the internet that uses TCP/IP, Internet Protocol(IP) implements the network layer.  So the address over a network is known as an IP address.

What is my public IP address?

When you browse a website or access a server.  You might be connecting via a LAN or could connect directly with the Internet Service Provider(IP).  But most of the time it’s over LAN. So there are two types of IP addresses are involved, one is a private IP  that your computer has and another public IP address that your ISP assigns.

The public IP address is similar to the postal address of your home.  The addresses are managed by IANA, which allocates the addresses and assigns them to the service providers of various countries. An ISP provider gets the ranges and uses them with the end users.

An end-user could be a company a shop or an individual user at home.  The public IP address is mapped on the modem/router that terminates the line from the provider. On another side, the model connects to the LAN.

How can I check my Public IP address?

From your local machine, you can not check the public IP address unless you have access to the router. In that case, you can use this portal. At the start, you can see your public IP address along with other details.

Why do we need to know what is my public IP?

While using the internet, one never cares about the public Ip assigned to the router. But if you need to access a client company’s system for ssh or telnet then it is important.

For security reasons, the client will allow your IP on the firewall to grant access. In that case, you need to find what public IP you are using and share will the client.

What is my private IP address?

The private IP address is the network address (e.g that your computer ethernet card has to configure to connect to a LAN. It could be a dynamic or static address. 
For dynamic IP, there should be a DHCP server running over the LAN, mostly the router runs a DHCP server too. For static, the user configures it, using a graphical interface or command-line interface.

On Linux, there are files for each network interface in /etc/sysconfig/network-scripts/ . A sample (e.g ifcfg-enp0s3) will look like following


On Windows, you can configure step by step.

  • Open the folder Control Panel\Network and Internet\Network Connections
  • Right-click on the network interface and select properties.
  • Choose to click on Internet Protocol Version 4.
  • Fill in the details of the private IP address.
Private IP configuration on Windows
Private IP configuration on Windows

How to check what is my private IP?

You can check the IP address of the machine using simple commands. Following are the example commands to check the IP address assigned to the Network Interface Cards.

On Linux – you can check using the ifconfig -a command

# ifconfig -a
 enp0s3: flags=4163  mtu 1500
         inet  netmask  broadcast
         inet6 fe80::a883:444a:b088:cb4c  prefixlen 64  scopeid 0x20

         ether 08:00:27:15:6b:9a  txqueuelen 1000  (Ethernet)
         RX packets 278369  bytes 31115387 (29.6 MiB)
         RX errors 0  dropped 0  overruns 0  frame 0
         TX packets 9642  bytes 1622982 (1.5 MiB)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 lo: flags=73  mtu 65536
         inet  netmask
         inet6 ::1  prefixlen 128  scopeid 0x10
         loop  txqueuelen 1000  (Local Loopback)
         RX packets 120  bytes 9416 (9.1 KiB)
         RX errors 0  dropped 0  overruns 0  frame 0
         TX packets 120  bytes 9416 (9.1 KiB)
         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

On Windows: execute the ipconfig command from cmd.

Ethernet adapter Ethernet:
 Connection-specific DNS Suffix  . :
    Link-local IPv6 Address . . . . . : fe80::28dc:7063:c575:27e4%18
    IPv4 Address. . . . . . . . . . . :
    Subnet Mask . . . . . . . . . . . :
    Default Gateway . . . . . . . . . :

How do my public and private IP work together?

Any request that goes out from the LAN towards the internet has the public IP. But how does that go back to my personal laptop? As my laptop has a private IP. This is done by the NAT, by mapping for the session.