To find an Ubuntu Server’s IP address, open a terminal and run ip addr; look for an inet address under the active network interface. For a quick list of assigned addresses, use hostname -I, but remember that these commands usually show the server’s local network address, not necessarily its public internet address.
Quick Commands to Find an Address
The ip command is the standard starting point on Ubuntu. Run:
ip addr
To make the output shorter and easier to scan, use:
ip -brief addressshows each interface and its assigned addresses in a compact format.hostname -Iprints the IP addresses assigned to the machine, separated by spaces.ip -4 addrshows IPv4 addresses only.ip -6 addrshows IPv6 addresses only.
These commands normally work without administrator privileges. In the output, an interface marked UP is enabled, but that alone does not prove it has a working network connection. Check for an address on the same interface. For example, a short output might look like ens3 UP 192.168.1.24/24. Here, 192.168.1.24 is the IPv4 address, and /24 describes the network prefix.
Another useful command is ip route. It shows routing information, including the default route when one exists. To see which source address Linux would use for a particular destination, try ip route get 1.1.1.1. The result may include a field such as src 192.168.1.24. This is useful when the server has several interfaces, although it depends on having a route to that destination.
How to Read the Command Output
Ubuntu lists network interfaces separately. Common names include enp0s3, ens160, and eth0 for Ethernet devices, and wlp2s0 for a wireless device. Names vary according to hardware and system configuration, so do not assume your interface will be called eth0. The loopback interface, usually lo, is for communication within the machine and commonly has the IPv4 address 127.0.0.1. That is not the address other computers use to reach the server.
In detailed output, an IPv4 address appears after inet, while an IPv6 address appears after inet6. For example, inet 10.0.0.15/24 means the host address is 10.0.0.15. The slash suffix is prefix-length notation: /24 corresponds to a subnet mask of 255.255.255.0 for IPv4. Do not include the slash and prefix when entering only the host address into a client application.
You may see multiple addresses on one interface. A machine can have IPv4 and IPv6 addresses at the same time, temporary IPv6 addresses, or more than one address configured for a particular network. An address marked 127.0.0.1 or ::1 is loopback. Addresses beginning with fe80:: are IPv6 link-local addresses, usable only on the local network segment and generally not suitable as a standalone remote connection address.
Local, Private, and Public IP Addresses
The address shown by ip addr is an address configured on a local interface. On a home or office network, it is often a private IPv4 address such as one beginning with 192.168., 10., or 172.16. through 172.31.. Private addresses are intended for use within private networks. A router may translate connections between these devices and the public internet using network address translation, or NAT.
This distinction matters when you want to connect to the server. A computer on the same local network can often connect to the server’s private address. Someone outside that network usually cannot reach that address directly. A cloud virtual machine, by contrast, may have a private address on its virtual network and a separate public address assigned or mapped by the cloud provider.
To check the public IPv4 address visible to an external service, a server with outbound internet access can run curl -4 https://icanhazip.com. For IPv6, try curl -6 https://icanhazip.com. These requests depend on DNS, outbound connectivity, and the service being reachable. They report the address seen by that external service; they do not show every address configured on the Ubuntu machine. If the server is behind a router, the result may be the router’s public address rather than the server’s private one. Avoid relying on an external lookup service if your network policy prohibits it.
Choose the Address for Your Connection
The correct address depends on where the client is and how the network is set up. Before copying an address, identify the client’s location and the interface through which traffic should pass. Useful questions include whether the client is on the same LAN, connecting over a VPN, or coming from the public internet, and whether the server has more than one network interface.
- Same local network: Use the server’s private address on the shared network, such as
192.168.1.24. - Connected by VPN: Use the address reachable through the VPN, which may be different from the LAN address.
- Cloud server: Use the provider’s assigned public address for access from outside, subject to firewall and security-group rules.
- Behind a home or office router: External access may require router configuration, such as port forwarding, and a public address that is reachable from the internet.
For SSH, for instance, a client on the same subnet might connect with ssh username@192.168.1.24. A client on a different network cannot assume that command will work just because the server has that private address. The route, firewall, SSH service, and any NAT or cloud access rules must also permit the connection.
Find the Interface and Its Route
If the output contains several interfaces, start with ip -brief address to compare them. The interface with the relevant non-loopback address is often the one you need, but a server may be connected to separate management, storage, or application networks. An address alone does not tell you which route will be used for a connection.
Run ip route to inspect IPv4 routes. A line beginning with default identifies the default gateway and usually names the outgoing interface after dev. For a specific destination, ip route get 8.8.8.8 can show the chosen route and source address. This is more informative than simply selecting the first address in a command’s output when multiple network paths exist. For IPv6 routing, use ip -6 route.
If the server uses NetworkManager, nmcli device status lists devices and their state, and nmcli device show displays detailed connection information. Ubuntu Server installations commonly use Netplan to describe network configuration, often with systemd-networkd as the renderer, but configurations vary. These tools help explain how an address was obtained; they are not required just to read the current address.
Dynamic and Static Addresses on Ubuntu Server
Many servers receive an address automatically through DHCP. A DHCP server, often the local router or a cloud network service, leases an address and supplies network settings. The address may remain the same for a long time, but a lease can change. If another machine or service must reliably find the server, check whether the network provides a DHCP reservation or another stable naming method.
Ubuntu Server generally uses Netplan configuration files under /etc/netplan/. A file can describe DHCP or a static address and select a networking renderer. Before changing it, inspect the existing files and confirm the interface name with ip -brief address. A typo in the interface name, address prefix, gateway, or DNS settings can interrupt remote access. Configuration syntax and valid values depend on the network, so do not copy a static example without adapting it.
After making a planned Netplan change, administrators commonly validate it with sudo netplan try before applying it permanently. This command offers a chance to confirm the configuration and can revert if it is not confirmed, which is especially valuable over a remote session. Keep a fallback console or other recovery path when changing networking remotely. A static address must also be coordinated with the network administrator or DHCP configuration to avoid conflicts with another device.
When You Are Connected Remotely or Using Cloud Hosting
If you are already logged in through SSH, run the same commands in that session. The address used in the current connection may help identify the route, but it is not always the server’s only address. In an SSH session, the environment variable SSH_CONNECTION can show connection details, including the client and server addresses for that session. The server-side address in that value is the address used for that particular connection, not necessarily a public address or a permanent identifier.
On a hosted virtual machine, the Ubuntu guest may show only a private interface address even when the provider makes the machine reachable through a public IP. Some providers implement public addressing outside the guest operating system. Check the instance’s networking page or provider documentation to identify its public address, then verify that the relevant inbound rule allows the required service. Do not open broad access merely to test an address; allow only the ports and source ranges that are needed.
For a server that changes addresses, a DNS name can be easier to remember than a numeric address. DNS records must point to an address clients can actually reach, and updates may take time to be reflected due to caching. A hostname is not a substitute for working routing, firewall permissions, or a correctly running service.
Common Problems and Safe Troubleshooting
If hostname -I prints nothing, or ip addr shows no usable address on the expected interface, check whether the interface exists and is up. Use ip -brief link to see link state. A disconnected cable, disabled virtual network adapter, failed DHCP request, or incorrect Netplan configuration can prevent an address from appearing. On a physical machine, check the cable and switch; in a virtual machine, check that its virtual network adapter is connected.
If there is an address but you cannot connect, test the problem in layers rather than repeatedly changing the address:
- Confirm that you selected the address reachable from the client’s network.
- Check the route with
ip routeorip route get. - Verify that the target service is running and listening on the expected port.
- Check Ubuntu’s firewall rules, for example with
sudo ufw statusif UFW is in use. - For cloud or routed networks, check provider firewall rules, router NAT, and VPN routes as applicable.
A successful ping is not a complete test: ICMP traffic may be blocked even when SSH or another service is reachable. Conversely, an address being displayed does not prove that the server accepts incoming connections. Avoid posting full network output publicly if it reveals private topology, interface identifiers, or other information you do not want to disclose. Never share passwords or private SSH keys while troubleshooting.
Frequently Asked Questions
What is the fastest command to get the Ubuntu Server IP?
Run hostname -I for a quick list of assigned addresses. Use ip -brief address if you also want to see which interface each address belongs to.
Why does Ubuntu show more than one IP address?
The server may have multiple interfaces, both IPv4 and IPv6, or several addresses on one interface. Ignore loopback addresses for remote access and choose the address associated with the network your client can reach.
Is the address from ip addr my public IP?
Not necessarily. It is assigned to a local interface and may be private. A router or cloud platform can provide public access through a separate address or NAT mapping.
How do I find my Ubuntu Server IP from another computer?
Check the router’s connected-device list, your cloud provider’s instance details, or a network administrator’s inventory. If the computers share a LAN, a DHCP lease list can help identify the server, but confirm the result before relying on it.
Does the Ubuntu Server IP change after a reboot?
It can, especially when assigned by DHCP, though many networks keep the same lease for a device. Use a DHCP reservation or a properly configured static address when you need a stable address, and coordinate static settings to prevent conflicts.