Changing the IP address of your Ubuntu Linux system can be necessary for various reasons, such as setting up a static IP for a server, troubleshooting network issues, or simply experimenting with network configurations. In this blog post, we’ll cover how to change your IP address using both graphical and command-line interfaces in Ubuntu Linux.
Table of Contents
- Introduction
- Changing IP Address via GUI
- Changing IP Address via Command Line
- Configuring Static IP via Network Configuration File
- Conclusion
1. Introduction
IP addresses are crucial for network communication. An IP (Internet Protocol) address allows devices to locate and communicate with each other on a network. Ubuntu Linux, like other operating systems, supports both dynamic (DHCP) and static IP configurations.
Prerequisites
- Basic knowledge of Linux commands.
- Administrative access to the system.
2. Changing IP Address via GUI
If you’re using a desktop version of Ubuntu, you can easily change your IP address through the graphical user interface (GUI). Here’s how:
Steps:
- Open Network Settings:
- Click on the network icon in the system tray (top-right corner).
- Select “Settings” from the dropdown menu.
- Select Network Interface:
- In the “Network” settings window, choose the network interface you want to configure (e.g., Wired, Wi-Fi).
- Click on the gear icon next to the connected network.
- IPv4 Settings:
- Go to the “IPv4” tab.
- Change the “Method” to “Manual”.
- Set Static IP Address:
- Enter your desired IP address, Netmask, and Gateway.
- Optionally, configure the DNS servers.
- Apply Changes:
- Click “Apply” to save the changes.
- Restart the network interface or reboot your system for the changes to take effect.
3. Changing IP Address via Command Line
For those who prefer using the terminal, changing the IP address via the command line is straightforward.
Steps:
- Open Terminal:
- You can open the terminal by pressing
Ctrl + Alt + T
.
- Identify Network Interface:
- Run the following command to list all network interfaces:
- Note the name of the interface you want to configure (e.g.,
eth0
, enp3s0
).
- Assign New IP Address:
- Use the following command to assign a new IP address to the interface:
sudo ip addr add 192.168.1.100/24 dev enp3s0
- Replace
192.168.1.100/24
with your desired IP address and subnet mask.
- Remove Old IP Address:
- If needed, remove the old IP address using:
sudo ip addr del 192.168.1.101/24 dev enp3s0
- Verify Changes:
- Confirm the new IP address with:
4. Configuring Static IP via Network Configuration File
For persistent IP configuration, editing the network configuration files is the most reliable method.
Steps:
- Open Network Configuration File:
- Edit the appropriate network configuration file using a text editor, for example:
sudo nano /etc/netplan/01-netcfg.yaml
- The file might be different on your system; common locations include
/etc/netplan/
or /etc/network/interfaces
.
- Configure Static IP:
- Modify the file to include your static IP configuration. For example:
network:
version: 2
ethernets:
enp3s0:
dhcp4: no
addresses: [192.168.1.100/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
- Apply Configuration:
- Verify Changes:
- Check the new configuration:
5. Conclusion
Changing the IP address on an Ubuntu Linux system can be done easily through both the GUI and the command line. Whether you need a temporary change or a permanent static IP configuration, the steps outlined above will guide you through the process. Always remember to verify your changes to ensure the new settings are applied correctly.
0 Comments