Skip to content
Related Articles

Related Articles

Improve Article

Know your public and private IP addresses

  • Difficulty Level : Easy
  • Last Updated : 04 Dec, 2017


You might have used ifconfig command on your linux terminal to know different network configurations of your system.

ifconfig command shows hardware address(HWaddr) and network address(inet addr) for Ethernet or your wifi connection.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

 

ifconfig command don’t show your public IP address(if public and private are different). For that purpose, you can simple type in google search : what is my ip address, it will show your public IP address.



On linux terminal, you can use following commands to know your IP addresses:
Public IP :

curl ifconfig.me
      or 
curl ipinfo.io/ip

Private IP :

hostname -I

References :
linux man entry for ifconfig
know your public IP askubuntu

My Personal Notes arrow_drop_up
Recommended Articles
Page :