Setting a Static IP
This article will walk you through setting a static IP.
What is a static IP?
Every device has an IP address. It’s that devices ’name’ on your network. We use it to SSH into machines or visit pages on that machine. But by default, the device’s IP can change when reconnecting to your network or rebooting. This can be annoying, as you have to figure out the IP every time it changes.
Here’s where a static IP comes in handy. Instead of your device using the routers DHCP system, your device can ignore that and decide it’s own IP. This makes it so the IP stays the same after rebooting or reconnecting. This is a static IP.
Setting a static IP with NMTUI
NMTUI Stands for the ‘NetworkManager Text User Interface’.
First of all, make sure you have the necessary package installed that includes NMTUI:
sudo apt install network-managerCheck the corresponding package name for different package managers. We can now start setting a static IP:
sudo nmtuiYou will be greeted with a menu. Select Edit a connection.
If using Wi-Fi, select the correct SSID. If using ethernet, just select the Wired connection tab.
The IPv4 configuration is set to Automatic by default. Press this tab and change it to Manual.
Let’s start with the new IP of your device. In the Addresses tab, enter a desired IP. We’ll use 192.168.178.250/24.
Make sure you’re using the right IP range.
The next tab contains the Gateway IP. This is the first IP in your range, so for us, 192.168.178.1.
The last tab we’re going to edit is the DNS servers tab. We’ll use 1.1.1.1 and 1.0.0.1, Cloudflare’s DNS servers.
Go all the way down and press OK. In the menu, click Back. In the first menu we saw at the beginning, go all the way down to OK and press it.
Reboot to make sure the new IP has been assigned. Congrats, you’ve set a static IP with NMTUI!