But sometimes, you need a static IP address, and it is required to maintain the same IP address for an extended period. For example, if you configure your system to make it a server, static IP is necessary for communication purposes. You need to make sure that your computer’s IP address never changes if you want people to download files from it. Also, static IP is necessary if you want to access any external shared device such as a printer.
A static IP address can be configured in three ways:
- Configuration using GUI
- Configuration using a terminal
- Configuration through modifying the network configuration file
Configuration of Static IP using GUI on Linux Mint
Configuring static IP on your Linux mint OS by this method is quite simple, and for that, you need to select the network settings from the menu and click on the network icon as shown below.
After going into the network settings, you will see the basic details of your currently established network and the IP address assigned by the DHCP network. So you can change that to a static ip address by clicking on the settings tab available on the bottom left.
Now you need to change the “automatic (DHCP)” address to” Manual”.
After selecting the manual option, it will ask you to enter the new network settings that you desire, as displayed below. You need to input the values and then click on the apply button to implement those settings. The IP address 192.168.114.100 would be the static IP, also set network mask and gateway.
Now you need to go back to the main window of the network settings to see newly applied settings.
Configuration of Static IP using terminal on Linux Mint
You can also configure static IP using command-line interface (CLI), and for that, you need to type the command:
This will open a new window with various options, and then you need to select the first one, “Edit a Connection” to apply the new settings that can be seen below.
The next step is to change “IPv4 CONFIGURATION” from automatic to Manual and then you need to provide the necessary details to make this work.
We have applied the same network values that we have used in our first scenario
Now save these settings, go back to the main window, and select the second option below.
The first option is used to change your network settings, and the second option of “Activate the connection” is used to apply those settings. You need to open it, click on the “Deactivate” button, and then “Activate” it again which will restart your network so that the new settings can be applied.
So if you want to verify whether the new network settings have been implemented, you can do that by typing the below-mentioned command in the terminal.
You can see from the above image that the newly applied IP address is currently active and working that you can see on the “ens33” field, which is a network interface where the information of Ipv4 resides.
Configuration of Static IP through network configuration file on Linux Mint
You can also set static IP by doing some modifications on the network configuration file and for that, you need to open this file with an editor of your choice:
From the above command, we are using a nano editor, and after opening this file, you need to write a few lines described below, and after that, you need to save the file.
iface enp0s3 static
address: 192.168.114.100
netmask: 255.255.255.0
gateway: 192.168.114.2
dns-nameservers 8.8.8.8
Now you should be able to access your newly applied network settings and verify this by typing again.
You can also verify if the new route settings have been implemented or not by typing.
Conclusion
Your Linux Mint operating system is configured to DHCP by default, which means that your machine’s IP address might change automatically to a different accessible IP address. However, there are times when you require a constant IP address, such as when communicating with a server. So, this is where static IP comes into play; with it, your IP address will not change automatically and will remain the same until it is altered by someone else or reverted to DHCP.