1. Home
  2. Linux
  3. Static ip address on linux network manager

How To Set A Static IP Address On Linux In Network Manager

Though many may not know this, your Linux desktop is perfect for hosting network applications. Things like a quick Linux gaming server, TeamSpeak, or a network share for other computers come to mind. The trouble with hosting a network share, is that you need a dedicated IP address. The easiest way to set up a static IP address on the Linux deskop is with the network management tool that comes with most desktop environments.

The Network Management tool is a tool that makes working with network settings on Linux way easier. Start off by finding the network icon in your system tray, panel, etc. Click on the icon, and find an option that says  “Network Connections”. Select the “Network Connections” option to open up a menu that shows different network devices.

In the menu, find your default network device. For example, if you’re using a Wifi connection, your default device may be “Wlan0”. Ethernet may be “Enp3s0”, or “Eth0”. Usually, there’s only one network device, so it won’t be difficult to find. Not sure which one is the right one? A good way to find out is to run this terminal command:

ip addr show

The network device that has a local IP address (like 192.168.X) is the one you want in network manager. Once you’ve determined the correct device to edit via terminal, move back to the Network Connections window, highlight the device and click the gear icon.

At this point, determine if your network is using IPv4 or IPv6. For the most part, consumer routers don’t take advantage of IPv6 yet, so it’s not likely you’re using it. Consult with your Router manual to be sure.

Move to the IPv4 tab and find the menu that says “Automatic”. Change it to “Manual”, then move down to the “Addresses” section. Click the “Add” button and start out by filling in the IP address you want to give your PC in the “Address” part.

Note: a good way to set up a static IP address on Linux is to make the one you already have permanent.  Run ip addr show again to find it.

After filling out an IP in “Address”, move to the “Netmask” section. To find your netmask, open up a terminal and run this command:

ifconfig | grep netmask

Enter the IP that shows after the red “netmask” text. An example of a netmask would be 255.0.0.0. When you finish filling out the “Netmask” section, move on to “Gateway”.

Typically, a Gateway is your router’s IP address. If you access your router’s web interface over the network with 192.168.1.1, that’s the IP that needs to go into the gateway. Not sure what your router’s IP address is? Look into the manual included with the router, as it will have information on it. Alternatively, look on the internet, or open up a terminal and try ip route.

Running ip route will tell you the route your current network connection is connected over. This is a great way to isolate information on your network Gateway, and etc.

ip route

The Gateway address is the IP address that appears after “default via”. Enter that information into the Gateway section of the Network Manager tool.

Filling out “Address”, “Netmask”, and “Gateway” are done so it’s time to set the DNS settings. Typically Linux uses DHCP to automatically determine network information and automatically assign everything, including DNS. Since the plan is to set a manual IP address, you’ll need to specify a local DNS server. Luckily, the local DNS server is the Gateway.

Under Additional DNS servers, fill out the IP address you added to the “Gateway” section. When all the information looks good, click the “save” button to finish up.

Finding Network Info

Using the above commands in the terminal to quickly figure out the Netmask, Gateway and local DNS may come across as complex. If you want to set up a static IP address, but don’t feel like dealing with the terminal, there’s an alternative way, via Network Manager.

To find this information, click the network icon in your panel, then select “Network Settings”. It will show all information on the side. It’ll show your internal IP address (IPv4/.IPv6), Gateway and DNS.

Enabling Changes

New network settings usually apply automatically within Network Manager. If you’ve clicked save and nothing happened, select the network icon once again, and click “Network Settings”.  This shows the network, as well as devices connected to things. Under the network device you set up a static IP address, look for an on-off slider. Click it in the off position to quickly turn off the device. Wait a couple seconds, then click it back on.

Turning the device on and off will force it to reconnect to the network and use the new settings. Alternatively, after setting up the new network connection settings, restart your Linux PC to start using the new settings.

Comments are closed.