How to check your IP address in Linux
Your Linux machine has an IP address assigned to it on your network — either by your router automatically or by manual configuration. You need to know this address to troubleshoot connection problems, set up port forwarding, or identify which device is which on your home network. The fastest way to find it is to open a terminal and run a single command that displays all your network information at once.
Linux offers several commands that show your IP address. The most straightforward is ip addr, which works on nearly all modern Linux distributions. Open your terminal (usually Ctrl+Alt+T on Ubuntu, Fedora, or Debian), type ip addr, and press Enter. The output will list every network interface on your machine, including your ethernet connection and WiFi adapter if you have one.
Each interface shows an inet line — that is your IPv4 address, the one you need for most home network tasks. It looks like four numbers separated by dots, such as 192.168.1.50. Ignore the inet6 line unless you are specifically working with IPv6 networking.
Key Takeaways
- The ip addr command displays all network interfaces and their IP addresses in one output.
- Look for the inet line under your active connection — that is your IPv4 address on your home network.
- If you use WiFi, your address appears under the wireless interface (usually named wlan0 or similar); ethernet shows under eth0 or enp.
- The hostname -I command shows only the IP addresses without extra details, useful when you want a quick answer.
- Your IP address may change if your router restarts or if you do not have a static address set up.
Understanding the output from ip addr
When you run ip addr, the terminal displays a block of information for each network interface. The first line shows the interface name and status — UP means it is active and connected, DOWN means it is not. Below that you will see the MAC address (a hardware identifier) and then the IP addresses.
The inet line is what you need. It shows your IPv4 address followed by a slash and a number, like 192.168.1.50/24. That number is the subnet mask in a different format — you can ignore it for basic home network tasks. The address 192.168.1.50 is what you write down or remember.
If you have multiple network interfaces, you may see several blocks. A typical home machine has at least two: lo (the loopback interface, which is your machine talking to itself) and one or more real connections like eth0 for ethernet or wlan0 for WiFi. Only the real connections matter for your home network — the loopback address is always 127.0.0.1 and you do not need it.
Quick commands for just the IP address
If the full output from ip addr feels cluttered, two simpler commands show only what you need. Type hostname -I and press Enter — this displays only the IP addresses, one per line, with no extra detail. It is the fastest way to get a single number you can copy or write down.
Another option is ip route, which shows your default gateway (the router) and which interface connects to it. This is useful if you are not sure which connection is actually active. The line starting with default via shows your router's IP address and the interface that reaches it.
On older Linux systems that do not have the ip command, you may need to use ifconfig instead. Type ifconfig and look for the inet addr line — the format is slightly different but the information is the same. Most modern distributions have moved away from ifconfig, but it still works if the newer commands are not available.
Finding your IP address through the graphical interface
If you prefer not to use the terminal, most Linux desktop environments let you view your IP address through settings. On Ubuntu with GNOME, click the system menu (top right corner), select Settings, then go to Network. Click the gear icon next to your active connection — ethernet or WiFi — and the details panel shows your IPv4 address.
On Fedora with GNOME, the path is the same: Settings > Network, then click the connection details. KDE Plasma (used by Kubuntu and other distributions) puts this under System Settings > Connections, where you can see all your network interfaces and their addresses.
The graphical method is slower than typing a command, but it shows the same information and some people find it easier to read. If you are new to Linux and the terminal feels intimidating, this is a perfectly valid way to find what you need.
What to do if your IP address keeps changing
Home routers normally assign IP addresses automatically using DHCP — a system that hands out addresses from a pool. This means your machine might get 192.168.1.50 today and 192.168.1.51 tomorrow, especially if you restart your router or leave your machine off for a while. If you are setting up port forwarding or need a stable address for troubleshooting, this becomes a problem.
The solution is to set a static IP address — one that does not change. You can do this in two ways. The easier method is to log into your router's admin panel (usually at 192.168.1.1 or 192.168.0.1) and tell it to always give your Linux machine the same address. Look for a section called DHCP reservations or static DHCP, enter your machine's MAC address (shown in the ip addr output), and assign a fixed address.
The harder method is to configure the address directly in Linux using a tool like NetworkManager or by editing network configuration files. This works but requires more steps and can break if you move your machine to a different network. For a home setup, the router method is simpler and more reliable.
Checking IP addresses for other machines on your network
Once you know your own IP address, you might want to see what other devices are connected to your network. The command arp -a shows all the machines your Linux computer has recently communicated with, along with their IP addresses and MAC addresses. This is useful for identifying unknown devices or finding the address of another computer you need to connect to.
A more thorough scan uses nmap, a network scanning tool that may not be installed by default. If you have it (or install it with your package manager), the command nmap -sn 192.168.1.0/24 scans your entire home network and lists every device that responds. Replace 192.168.1.0/24 with your actual network range — if your IP is 192.168.1.50, your network range is 192.168.1.0/24; if it is 192.168.0.50, use 192.168.0.0/24.
These tools are helpful for security checks — you can see if any unexpected devices are connected — but they are not necessary for basic home network setup. Start with ip addr to find your own address, and use the other commands only if you need to troubleshoot or audit your network.
Frequently Asked Questions
Why do I see multiple IP addresses when I run ip addr?
Each network interface gets its own address. If you have both ethernet and WiFi, you will see two addresses — one for each. Only the one on the interface you are actually using matters. If you are connected via WiFi, use the address under wlan0 or similar; if you are plugged in with ethernet, use the one under eth0 or enp.
Is 127.0.0.1 my real IP address?
No. That is the loopback address, which your machine uses to talk to itself. Your real address on the network is the one under your actual network interface — ethernet or WiFi. The loopback address is the same on every machine and is not useful for connecting to your device from elsewhere on the network.
What is the difference between IPv4 and IPv6?
IPv4 addresses look like 192.168.1.50 and are what most home networks use. IPv6 addresses look like fe80::1 and are the newer standard, but most home routers still rely on IPv4. Unless you are specifically setting up IPv6, ignore the inet6 lines and use the inet address instead.
Can I change my IP address manually in Linux?
Yes, but it is usually not necessary. If you need a stable address, set a DHCP reservation in your router instead — it is simpler and survives reboots better. If you must configure it in Linux, use NetworkManager (graphical) or edit /etc/netplan files (command line), but this approach can cause problems if you move the machine to a different network.
Why does my IP address start with 192.168 or 10?
Those are private address ranges reserved for home and office networks. Your router uses them internally so devices can talk to each other. Your public IP address — the one the internet sees — is different and is assigned by your internet service provider. You do not need the public address for home network setup.