A Static IP Address is useful for servers, remote access, or network configurations where a fixed address is needed instead of a dynamically assigned one. This guide explains setting a static IP in Ubuntu using the GUI and terminal.
Let us follow the steps:
Method 1: Set a Static IP Using the GUI (Ubuntu Desktop)
If you are using Ubuntu Desktop, follow these steps:
- Open Settings: Click on the network icon in the top-right corner and select Settings.
- Select Network Interface: Choose Wired (Ethernet) or Wi-Fi, then click on the gear icon next to the connection.
- Go to IPv4 Settings: Select the IPv4 tab.
- Switch to Manual Mode: Under “Method,” select Manual instead of “Automatic (DHCP)”.
- Enter Static IP Details:
- Address: (e.g., 192.168.1.100)
- Netmask: (e.g., 255.255.255.0)
- Gateway: (e.g., 192.168.1.1)
- DNS Servers: (e.g., 8.8.8.8, 8.8.4.4)
- Save and Apply: Click Apply and restart the network connection.
Method 2: Set a Static IP Using the Terminal (Ubuntu Server)
For Ubuntu Server (or if you prefer CLI), follow these steps:
- Find Your Network Interface
Run:ip a
Look for the interface name (e.g., eth0 or ens33).
- Edit the Netplan Configuration File
Ubuntu uses Netplan for network configurations. Open the config file:sudo nano /etc/netplan/00-installer-config.yaml
- Modify the File to Set a Static IP
Replace the existing DHCP settings with the following (modify accordingly):network: ethernets: eth0: addresses: - 192.168.1.100/24 gateway4: 192.168.1.1 nameservers: addresses: - 8.8.8.8 - 8.8.4.4 dhcp4: no version: 2Replace eth0 with your interface name.
Adjust 192.168.1.100, 192.168.1.1, and DNS servers as per your network. - Apply Changes.
Save the file (CTRL + X, then Y, then Enter) and apply the new configuration:sudo netplan apply
- Verify the New Static IP
Check if the new IP is assigned:ip a
This way, you can configure a Static IP Address in Ubuntu. Hope you liked our article.
After setting up your static IP, you may need to clear your DNS cache. See our related guide: How to flush the local DNS cache in Linux server.
With Linux VPS Hosting, you can customise IP settings, manage routing and optimise connectivity for your applications and services.
Related Articles
When to Upgrade Your Dedicated Server
How to Keep Your Linux Server Secure: Updating the Kernel, System Packages & Key Services
