How to change my IP address to static in Linux Mint?

Viewed 21

I have already tried to configure the /etc/network/interfaces file and change network configurations in graphical interface and nothing worked, the IP address still the same. Is there any file or configuration that I'm forgetting to do?

2 Answers

By default, your system relies on DHCP, a dynamic host control protocol whose purpose is to assign you an IP address automatically. As a result, each device is assigned a unique number that enables it to communicate with other networks using DHCP, and as an outcome, your device’s IP address may change from time to time.

However, there are situations when a static IP address is required, and it is essential to maintain a similar IP address for an extended time. For instance, if you set up your system as a server, static IP addresses are required for communication. If you want users to download files from your computer, you must ensure that your machine’s IP address never changes.

Configuring static IP address on Linux Mint

1. Configuration via a graphical user interface

Static IP configuration on your Linux mint OS is pretty straightforward using this technique. First, pick network settings from the menu and click on the network icon, as seen below.

enter image description here

After navigating to the network settings, you’ll notice the basic information about your currently created network and the IP address issued via DHCP. Thus, by clicking on the settings tab on the bottom, you can modify that to a static IP address.

enter image description here

Now you must change the address from “automatic (DHCP)” to “Manual.”

enter image description here

After choosing the manual option, you will be prompted to enter the desired network settings, as illustrated below. You must enter the values and click the apply button afterward to save the changes. The static IP address would be 192.168.114.100; the gateway and network mask would be configured.

enter image description here

You must return to the network settings’ main window to view the freshly implemented settings.

enter image description here

2. Configuration through the use of a terminal

You can configure static IP addresses via the command-line interface (CLI).

nmtui

This will open up a new window with various options; you must click the first one, “Edit a Connection,”

enter image description here

The following step is to change the “IPv4 CONFIGURATION” setting from automatic to manual and enter the essential info to make it work.

enter image description here

We used the identical network variables as in our first example.

enter image description here

Now, save these changes, return to the main screen, and choose the second option from the list below.

enter image description here

The first option allows you to modify your network settings, while the second option, “Activate the connection,” applies those modifications. You must open it, click the “Deactivate” button, and click “Activate” again to restart your network and apply the new settings.

enter image description here

Therefore, if you want to verify that the updated network parameters have been applied, you can run the following command in the terminal.

ip a

3. Configuration via modifying a network configuration file

You can also set static IP addresses by making changes to the network configuration file; to do so, open the file with your preferred editor:

sudo nano etc/network/interfaces

We’re using a nano editor in the above command, and after loading this file, you’ll need to enter a few lines specified below and then save the file.

auto enp0s3

iface enp0s3 static

address: 192.168.114.100

netmask: 255.255.255.0

gateway: 192.168.114.2

dns-nameservers 8.8.8.8

enter image description here

You should now be able to view your newly configured network settings, which you can confirm by typing this command again:

ip a

Additionally, you can verify whether or not the new route parameters have been implemented by typing:

route -n

I now solved my problem, I just forgotten to restart the network manager to refresh the IP address.

Related