To find the IP address of an Ubuntu server, use ip a or hostname -I in the terminal. These commands display network interface details, including the primary IP address, often denoted by
inet followed by the address and subnet mask. [1, 2, 3]Common Methods to Find Host Addresses:
ip a: Displays all network interfaces and their assigned IP addresses.hostname -I: Provides a concise list of IP addresses only.- ifconfig -a: An older command that still works to show all network interfaces.
- ip neigh: Shows the ARP table, which lists other IP addresses on the network. [1, 2, 3]
Configuration and Verification:
- Static IP Setup: Modify the netplan configuration file in
/etc/netplan/to set a static IP, then apply with sudo netplan apply. - Loopback Address: The default loopback address is
127.0.0.1, which is used for the localhost. - DHCP Check: The server's IP address can often be found in the network router's DHCP settings. [1, 2, 3]
Notes on Specific Scenarios:
- Virtualization: Virtual machines might have their IP address listed in the host software (e.g., Proxmox).
- Interface Names: Network interface names can be found using
ip a(e.g.,enp0s3). - Network Troubleshooting: The ping command can be used to test network connectivity to external addresses. [1, 2, 3, 4, 5]