Featured Article

How to Set a Static IP Address in Linux: A Step-by-Step Guide

Alan Jun 16, 2026

Setting a Static IP Address on Linux: A Comprehensive Guide

Fast & Easy Linux Set Static IP Address Guide
Fast & Easy Linux Set Static IP Address Guide

In the world of networking, having a static IP address can provide numerous benefits, including improved security, easier network management, and better compatibility with certain applications. If you're a Linux user looking to set a static IP address, you've come to the right place. In this guide, we'll walk you through the process step by step, ensuring you understand each step along the way.

Linux Basics - Set a Static IP on Ubuntu
Linux Basics - Set a Static IP on Ubuntu

Understanding Static IP Addresses

Before we dive into the process, let's briefly discuss what a static IP address is. Unlike dynamic IP addresses, which can change each time you connect to the internet, a static IP address remains the same. This is particularly useful in scenarios where you need to access your device remotely or run a server.

Network Configuration in RHEL -  NetworkManager & nmcli Commands Explained
Network Configuration in RHEL - NetworkManager & nmcli Commands Explained

Why Set a Static IP Address?

  • Remote Access: A static IP address allows others to connect to your device remotely.
  • Server Hosting: Many services require a static IP address to function correctly.
  • Network Configuration: Static IP addresses simplify network configuration and troubleshooting.
How to Set Static IP Address and Configure Network in Linux
How to Set Static IP Address and Configure Network in Linux

Preparation: Gather Required Information

Before you begin, you'll need to gather some information about your network and the device you want to configure:

  • IP Address: The static IP address you want to set. Ensure this address is within your network's range and not already in use.
  • Subnet Mask: The subnet mask for your network. This is usually 255.255.255.0 for home networks.
  • Gateway: The IP address of your router. This is typically 192.168.1.1 or 192.168.0.1 for home networks.
  • DNS Servers: The IP addresses of your DNS servers. You can usually use your ISP's DNS servers or opt for public ones like Google's (8.8.8.8 and 8.8.4.4).
How to set static IP in Linux when you are using Mobile Hotspot
How to set static IP in Linux when you are using Mobile Hotspot

Setting a Static IP Address on Popular Linux Distributions

While the process of setting a static IP address can vary slightly between Linux distributions, we'll provide guidance for some of the most popular ones.

Ubuntu

Setting a Static IP address on Ubuntu using Netplan
Setting a Static IP address on Ubuntu using Netplan

In Ubuntu, you can set a static IP address using the netplan utility, which is a modern network configuration tool.

First, create a new configuration file:

How to Set a Static IP Address in Ubuntu - Make Tech Easier
How to Set a Static IP Address in Ubuntu - Make Tech Easier
Setting a static IP address in Ubuntu 18.04
Setting a static IP address in Ubuntu 18.04
Different Linux Distributions Explained (Beginner Guide)🚀
Different Linux Distributions Explained (Beginner Guide)🚀
Methods to Set a Static IP Deal with in Ubuntu | howthingsworks.in
Methods to Set a Static IP Deal with in Ubuntu | howthingsworks.in
the linux file system is shown with numbers and symbols in each column, which are labeled
the linux file system is shown with numbers and symbols in each column, which are labeled
Linux Basics for Beginners 2026 | Complete Starter Guide
Linux Basics for Beginners 2026 | Complete Starter Guide
Ultimate Linux Commands Cheat Sheet for Beginners
Ultimate Linux Commands Cheat Sheet for Beginners
the differences between windows and linuxs are shown in this graphic above it is an image of
the differences between windows and linuxs are shown in this graphic above it is an image of
the linux file system is shown in this diagram
the linux file system is shown in this diagram
Linux System Logs Explained: /var/log Guide for Beginners & Sysadmins
Linux System Logs Explained: /var/log Guide for Beginners & Sysadmins
the ubuntu chat sheet is shown in orange and black, with text
the ubuntu chat sheet is shown in orange and black, with text
the linux file perissions explanation is shown in this diagram, which shows how to use
the linux file perissions explanation is shown in this diagram, which shows how to use
💎 The Secret Resource Collection For Developers
💎 The Secret Resource Collection For Developers
How to Configure Static IP Address on Linux System
How to Configure Static IP Address on Linux System
the linux file system diagram is shown in this graphic style, with several different types of data
the linux file system diagram is shown in this graphic style, with several different types of data
The Linux Cheat Sheet Every Beginner Ends Up Needing
The Linux Cheat Sheet Every Beginner Ends Up Needing
🖥️
🖥️
the diagram shows how linux works
the diagram shows how linux works
an image of a computer screen with the text readme and other words on it
an image of a computer screen with the text readme and other words on it
noob vs pro
noob vs pro

sudo nano /etc/netplan/01-netcfg.yaml

Then, add the following content, replacing the placeholders with your gathered information:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens33: # replace with your network interface name
      addresses: [192.168.1.100/24] # replace with your IP address and subnet mask
      gateway4: 192.168.1.1 # replace with your gateway
      nameservers:
        addresses: [8.8.8.8,8.8.4.4] # replace with your DNS servers

Finally, apply the new configuration:

sudo netplan apply

CentOS/Fedora

In CentOS and Fedora, you can use the nmcli command-line tool to set a static IP address. Here's how:

sudo nmcli con modify "your_connection_name" ipv4.addresses 192.168.1.100/24 ipv4.gateway 192.168.1.1 ipv4.dns "8.8.8.8 8.8.4.4"

Replace your_connection_name with the name of your network connection. You can find this by running nmcli connection.

Arch Linux

In Arch Linux, you can use the netctl service to manage network profiles. Here's how to create a new profile with a static IP address:

sudo nano /etc/netctl/profile

Add the following content, replacing the placeholders with your gathered information:

Description='My static IP profile'
Interface='eth0' # replace with your network interface name
Connection='wireless' # or 'ethernet' depending on your connection type
IP='static'
Address='('192.168.1.100'/24)' # replace with your IP address and subnet mask
Gateway='192.168.1.1' # replace with your gateway
DNS('8.8.8.8' '8.8.4.4') # replace with your DNS servers

Then, enable and start the new profile:

sudo systemctl enable netctl@profile
sudo systemctl start netctl@profile

Verifying Your Static IP Address

After configuring your static IP address, you can verify it using the ip command:

ip addr

Look for your network interface (e.g., eth0 or wlan0) and ensure the IP address matches the one you set.

Conclusion

Setting a static IP address on Linux can be a straightforward process once you understand the basics. By following this guide, you should now be able to configure a static IP address on your preferred Linux distribution. Happy networking!