🌐

Linux IP Address Checking Methods

Jul 17, 2025

Overview

This lecture explains different methods to check the private and public IP addresses of a Linux machine, using both command-line tools and the graphical interface.

Finding Private IP Address via Command Line

  • Use ip addr to display IP addresses of all network adaptors, including Ethernet, Wi-Fi, and any virtual adaptors.
  • ifconfig shows connection info for all devices; IPs are listed by adaptor names, and identifies loopback (127.0.0.1) addresses.
  • hostname -I displays the machine's private IP address; hostname -i shows the loopback/internal IP.
  • nmcli provides network info; nmcli -p device show shows IPs by device.

Checking IP Address via Linux GUI

  • Open the Application menu, search for “Settings”, and select it.
  • In Settings, choose "Network" and click "Settings" for your wired or wireless connection.
  • The displayed details include both IPv4 and IPv6 addresses.

Finding Public IP Address

  • curl -s https://icanhazip.com outputs your public IP address from the command line.
  • wget -O - -q https://checkip.amazonaws.com fetches your public IP address.
  • Websites like https://icanhazip.com and https://www.whatismyip.com also show your public IP.
  • Public IP addresses identify your device on the Internet and are tracked by your ISP.

Key Terms & Definitions

  • IP Address — Unique identifier for a device on a network.
  • Private IP Address — IP used within a local network, not visible to the Internet.
  • Public IP Address — IP used to communicate outside the local network, visible to external sites.
  • Loopback Address — Special IP address (127.0.0.1) redirecting traffic to the same computer.
  • Adaptor — Network interface hardware (Ethernet, Wi-Fi, Virtual).

Action Items / Next Steps

  • Practice using each command (ip addr, ifconfig, hostname -I, nmcli, curl, wget) to check your Linux device’s IP addresses.
  • Use the GUI steps to find IP addresses if using Ubuntu or any GNOME-based Linux distro.