- by x32x01 ||
Changing your IP address in Ubuntu might sound complex, but it’s actually quite easy once you understand how it works. Whether you’re setting up port forwarding, hosting a media server, or just managing your network configuration, Ubuntu provides simple tools to help you out.
In most cases, your router assigns IPs dynamically through DHCP. However, if you want a static IP for stability or configuration reasons, you can change it either through Netplan (via Terminal) or using Ubuntu’s Graphical User Interface (GUI). Let’s explore both methods 👇
This command lists all network interfaces and their current status.
Inside the file, you’ll find your current configuration. Replace it with something like this:
To confirm your new IP:
✅ You’ve successfully changed your IP address using Netplan!
Now, enter:
So next time you need to configure your IP manually, you’ll know exactly what to do! 🚀
In most cases, your router assigns IPs dynamically through DHCP. However, if you want a static IP for stability or configuration reasons, you can change it either through Netplan (via Terminal) or using Ubuntu’s Graphical User Interface (GUI). Let’s explore both methods 👇
🖥️ Method 1: Change IP Address via Terminal Using Netplan
Ubuntu uses Netplan to handle all network configurations. It interacts with systemd-networkd and NetworkManager, which apply the changes to your network interfaces.Step 1: List Your Network Interfaces
Open the terminal using Ctrl + Alt + T, then type:ip linkThis command lists all network interfaces and their current status.
Step 2: Edit the Netplan Configuration File
Now open your Netplan YAML file: Code:
sudo nano /etc/netplan/*.yaml Inside the file, you’ll find your current configuration. Replace it with something like this:
Code:
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
dhcp4: no
dhcp6: no
addresses: [192.168.2.2/24]
gateway4: 192.168.2.2
nameservers:
addresses: [8.8.4.4, 8.8.8.8] - enp0s3 → your network interface name
- addresses → the static IP you want
- gateway4 → your router gateway
- nameservers → DNS servers (e.g., Google DNS)
Step 3: Apply the Configuration
Now apply your new settings with: Code:
sudo netplan apply To confirm your new IP:
ip addr show✅ You’ve successfully changed your IP address using Netplan!
🖱️ Method 2: Change IP Address via Ubuntu GUI
Prefer a visual method? No problem! Ubuntu makes this easy too.Step 1: Open Network Settings
Go to Settings → Network, then click the gear icon ⚙️ next to your network connection.Step 2: Switch to Manual Configuration
In the IPv4 tab, change the setting from Automatic (DHCP) to Manual.Now, enter:
- IP Address
- Netmask
- Gateway
- DNS Servers
Step 3: Verify the Change
Go to the Details tab to confirm your new static IP address.🌐 Why Change Your IP Address?
Here are some common reasons why you might need to change your IP on Ubuntu:- Improve network stability or avoid IP conflicts.
- Set up port forwarding for servers or applications.
- Connect to a different subnet for specific network setups.
- Enhance privacy and control over network connections.
🧭 Conclusion
Changing your IP address in Ubuntu - whether via Terminal (Netplan) or GUI - is straightforward once you know the process. Both methods help you gain better control over your network configuration and connectivity 🔌.So next time you need to configure your IP manually, you’ll know exactly what to do! 🚀
Last edited: