Tecmint: Linux Howtos, Tutorials & Guides

How to Set Static IP Address and Configure Network in Linux

If you are a Linux system administrator, time will come when you will need to configure networking on your system. Unlike desktop machines where you can use dynamic IP addresses, on a server infrastructure, you will need to setup a static IP address (at least in most cases).

Read Also: How to Set or Change System Hostname in Linux </p

This article is meant to show you how to configure static IP address on most frequently used Linux distributions.

For the purpose of this tutorial, we will use the following Internet Protocol version 4 (IPv4) details:

Configure Static IP Address in RHEL/CentOS/Fedora:

To configure static IP address in  RHEL / CentOS / Fedora , you will need to edit:

Where in the above "ifcfg-eth0" answers to your network interface eth0 . If your interface is named “ eth1" then the file that you will need to edit is "ifcfg-eth1" .

Let’s start with the first file:

Open that file and set:

Note : Make sure to open the file corresponding to your network interface. You can find your network interface name with ifconfig -a command .

In that file make the following changes:

You will only need to edit the settings for:

  • DNS1 and DNS2

Other settings should have already been predefined.

Next edit resolve.conf file by opening it with a text editor such as nano or vi :

Once you have made your changes restart the networking with:

Set Static IP Address in Debian / Ubuntu

To setup static IP address in Debian / Ubuntu , open the following file:

You may see a line looking like this:

Change it so it looks like this:

Save the file and then edit /etc/resolv.conf like this:

Restart the networking on your system with:

Your static IP address has been configured.

Conclusion:

You now know how to configure a static IP address on a Linux distro. If you have any questions or comments, please do not hesitate to submit them in the comment section below.

Previous article:

Next article:

Photo of author

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Related Posts

Extract Linux Tar Files Different or New Directory

How to Extract Tar Files to Specific or Different Directory in Linux

Debian Goodies Utilities to Manage Debian Packakges

8 Useful ‘Debian Goodies Utilities’ for Package Management

Delete User Accounts with Home Directory in Linux

How to Delete User Accounts and Their Home Directories in Linux

Find and Kill Running Processes in Linux

How to Find and Kill Running Processes in Linux

Set System Time, Date and Timezone in Linux

How to Set Time, Timezone and Synchronize System Clock in Linux

FFMPEG Command Examples in Linux

15 Must-Know FFmpeg Commands for Video, Audio & Image Conversion

32 thoughts on “How to Set Static IP Address and Configure Network in Linux”

The time will come when you will need to configure networking on your system. Unlike desktop machines where you can use dynamic IP addresses, on a server infrastructure, you will need to set up a static IP address (at least in most cases).

Terrible – and my ‘ linux distro ‘ isn’t the same as yours, there’s no ‘ /etc/sysconfig/ ‘ folder.

In Ubuntu 20.04 there is no interfaces file they switch to netplan . If you can update this article to include the new change it will help a lot.

thanks Raouf

Well, this isn’t correct. Just trashed my Linux mint distro

Is it public Static IP? or can I use to access data from other networks?

Failed to restart network.service: Unit network.service not found.

I’m asking a question on a fairly old thread, but just in case, is it possible to do this on a WIFI network?

For example, when using the first command (# nano /etc/network/interfaces ) in Ubuntu, the result I see is:

There isn’t an “ eth0 ” on my server because it is connected by WIFI only. Will it still work using another option?

Yes it will work I think so, just change the settings in the interfaces file as explained in this article.

I set the static IP in ifcfg-eth0, added HWADDR and UUID, but on reboot system does not associate the IP to eth0.

This is VM. Any idea why its happening and steps to troubleshoot.

I think you need to make sure that you select “ manual ” and the correct IP address, subnet mask, and gateway and save the configuration as explained in the article. Also, I personally would select a new and different IP address, so that you can really check if it has been saved by opening the terminal and typing:

after a restart.

If i set ip address as static am not able to ping google.com why and also packages are not installed.

Please give me reply as soon as possible.

@Rajeshkar,

Please add the DNS Name servers in your /etc/resolv.conf file..

@Ravi Saive thanks for your reply , yes i did /etc.resolv.conf also but getting the same problem

@Rajesekar,

The file is /etc/resolv.conf , in this file add your DNS name servers for example.

When I enter the /etc/resolv.conf file, what is it supposed to look like? And when you say “edit” do you mean delete what’s there and write what you’ve provided, or just add new lines?

Hello Marin, Thank you very much for this article. It was a major help in my class project. This is my first time using a vm and it is an awesome learning experience. I’m really glad I ran into this article, it was well written and easy to follow.

Just wanted to say a million thank you’s for this well-written, comprehensive and easily-understood article! Awesome stuff! A real lifesaver too, as I had to quickly configure a static IP for myself to get access to remote computing. Thank you! :-D

A question from a linux newbie. Does this instruction apply for both ubuntu running on my desktop PC as well as debian linux on an embedded board?

Yes, the instructions will works on any Debian/Ubuntu based distribution without any issues..have you tried on your embedded board? does these instructions worked? let us know.

Hi Ravi, thanks for your reply.

Default the folder /etc/sysconfig does not exist on my embedded system. Of Course i could create it as well as the files mentioned, but it would be out of the context of this instructions.

Thanks, Rob

I found here very good stuff! You are doing an excellent job and I like your site! Thanks!

Thanks for finding this site very useful and thanks for appreciating our work, Keep visiting for more such useful articles…

Great job, I was I actually looking for an article like this one. So thank you so very much. Keep up the good work.

Thanks for appreciating and finding this article useful, keep connected to Tecmint for such wonderful articles…:)

What if I have 2 NICs on my server one for LAN & one for WAN and I want to set one of them (WAN) as default gateway? How to configure this server as gateway and as a router.

The easiest way to add default gateway using route command as shown:

Don’t forget to replace the gateway IP address and interface-name in the above command.

One can also use following command to setup static IP on eth0 interface for example. # ifconfig eth0 192.168.1.1 netmask 255.255.255.0 up # route add default gw 192.168.0.1 # service network restart

Thanks for the tip, but I think setting IP address directly from the commandline using ifconfig and route will only allow you to set temporarily, once you reboot, these settings disappears. So, the best option to set static IP address permanently in network configuration files only….

wipe on reboot, so that best option is to set permannetly

Hello Ravi, What is difference between the service “NetworkManager” and “network”

@Augustine,

This article will help you to understand the difference between and NetworkManager and Network: http://askubuntu.com/questions/1786/what-is-the-difference-between-network-manager-and-ifconfig-ifup-etc

Why do we need to specify DNS in both ifcfg-eth0 and resolvlf.conf?

Hello Augustine,

Actually if you have added the DNS servers in the ifcfig-eth0 file the DNS servers will be automatically added to /etc/resolv.conf. You can skip defining the DNS servers in the ifcfig-eth0 file, but then you will need to have them set in /etc/resolv.conf manually. It’s a good practice to make sure that the DNS servers are specified correctly in both files, this is why the article says to set them in both files.

Got something to say? Join the discussion. Cancel reply

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.

Save my name, email, and website in this browser for the next time I comment.

How-To Geek

How to set a static ip address in ubuntu.

When static is the way forward.

Quick Links

What is a static ip address, setting a static ip in ubuntu, set a static ip in ubuntu with the gui, connection convenience, key takeaways.

After gathering your connection name, subnet mask, and default gateway, you can set a static IP address in the terminal using the nmcli command. Or, in the GNOME desktop, open your connection settings and click the + icon, then enter the info for your static IP address there.

Your home network relies on IP addresses to route data between devices, and sometimes on reconnecting to the network a device's address can change. Here's how to give an Ubuntu Linux computer a permanent IP address that survives reboots.

Everything on your network home network, whether it's using a wired connection or Wi-Fi, has an IP address . IP stands for Internet Protocol. An IP address is a sequence of four numbers separated by three dots. Each IP address that is unique within that network.

IP addresses act as numeric labels. Your router uses these labels to send data between the correct devices. Usually, your router assigns IP addresses. It knows which IP addresses are in use and which are free. When a new device connects to the network, it requests an IP address and the router allocates one of the unused IP addresses. This is called DHCP, or dynamic host configuration protocol .

When a device is restarted or powered off and on, it may receive its old IP address once more, or it might be allocated a new IP address. This is normal for DHCP and it doesn't affect the normal running of your network. But if you have a server or some other computer that you need to be able to reach by its IP address, you'll run into problems if its IP address doesn't survive power downs or reboots.

Pinning a specific IP address to a computer is called allocating a static IP address . A static IP address, as its name suggests, isn't dynamic and it doesn't change even if the computer is power-cycled .

Nmcli is the command-line network manager tool , and can be used to change your IP address, configure network devices, and --- relevant to our purposes --- set up a static IP in Ubuntu.

We're demonstrating this technique on Ubuntu 22.04 LTS, but it ought to work on any Linux distribution, including Ubuntu 23.04. The nmcli tool was released in 2004, so it should be present on just about any standard distribution.

Let's take a look at the network connections that already exist on the computer. We're using the connection command with the show argument.

nmcli connection show

Using nmcli to list network connections

This displays some information about each connection. We only have a single connection configured.

The details of a single network connection displayed by nmcli

The output is wider than the terminal window. This is the information that we're shown.

  • Name : Our network connection is called "netplan-enp0s3."
  • UUID : The universally unique identifier Linux uses to reference this connection internally.
  • Type : This is an ethernet connection.
  • Device : This connection is using the "enp0s3" network interface. It's the only network card in this computer.

We can use the ip command to discover the IP address this computer is using.

The output of the ip addr command showing the ip address of the computer

In the output we can see the "enp0s3" entry, and its current IP address, 192.168.86.117. The "/24" is a shorthand way of saying that this network uses a 255.255.255.0 subnet mask . Take a note of this number, we'll need to use it later.

We need to choose the IP address we're going to set as our static IP address. Obviously, you can't use an IP address that is already in use by another device. One safe way to proceed is to use the current IP address assigned to the Ubuntu system. We know for certain that nothing else is using that IP address.

If we want to use a different IP address, try pinging it. We're going to test whether IP address 192.168.86.128 is in use. If everything else on your network uses DHCP and you get no response to the ping command, it should be safe to use.

ping 192.168.86.128

Using ping to determine if an IP address is in use

Even if another device had previously used that IP address, it'll be given a new IP address when it next boots up. Nothing responds to the ping requests, so we're clear to go ahead and configure 192.168.86.128 as our new static IP.

We also need to know the IP address of your default gateway , which will usually be your broadband router. We can find this using the ip command and the route option, which we can abbreviate to "r."

Using the ip command to find the IP address of the default gateway

The entry that starts with "default" is the route to the default gateway. Its IP address is 192.168.86.1. Now we can start to issue commands to set up our static IP address.

The first command is a long one.

sudo nmcli con add con-name "static-ip" ifname enp0s3 type ethernet ip4 192.168.86.128/24 gw4 192.168.86.1

Creating a new connection with the nmcli command

Taken in small chunks, it's not as bad as it looks. We're using sudo . The nmcli arguments are:

  • con : Short for "connection."
  • add : We're going to add a connection.
  • con-name "static-ip" : The name of our new connection will be "static-ip."
  • ifname enp0s3 : The connection will use network interface "enp0s3."
  • type ethernet : We're creating an ethernet connection.
  • ip4 192.168.86.128/24 : The IP address and subnet mask in classless inter-domain routing notation . This is where you need to use the number you took note of earlier.
  • gw4 192.168.86.1 : The IP address of the gateway we want this connection to use.

To make our connection a functioning connection, we need to provide a few more details. Our connection exists now, so we're not adding anything, we're modifying settings, so we use the mod argument. The setting we're changing is the IPv4 DNS settings. 8.8.8.8 is the IP address of Google's primary public DNS server , and 8.8.4.4 is Google's fallback DNS server.

Note that there is a "v" in "ipv4." In the previous command the syntax was "ip4" without a "v." The "v" needs to be used when you're modifying settings, but not when adding connections.

nmcli con mod "static-ip" ipv4.dns "8.8.8.8,8.8.4.4"

Using the nmcli command to set the DNS servers for a connection

To make our IP address static, we need to change the method which the IP address obtains its value. The default is "auto" which is the setting for DHCP. We need to set it to "manual."

nmcli con mod "static-ip" ipv4.method manual

Using the nmcli command to set an IP address to static

And now we can start or "bring up" our new connection.

nmcli con up "static-ip" ifname enp0s3

Using the nmcli command to start a network connection

We didn't get any error messages which is great. Lets use nmcli to look at our connections once more.

nmcli con show

The details of two network connections displayed by nmcli

Here's the output:

Our static-ip connection is active and using device "enp0s3." The existing connection "netplan-enp0s3" is no longer associated with a physical network interface because we've pinched "enp0s3" from it.

Click the icons at the far-right end of the system bar to show the system menu, then click on the "Wired Connected" menu option. If you're using a wireless connection, instead click the name of your Wi-Fi network.

The available connections are displayed. A dot indicates which is in use. Click the "Wired Settings" or "Wi-Fi Settings" menu option. The details of the active connection are displayed.

If you followed our previous instructions the new connection will be the active connection. We can see our new "static-ip" connection has the IP address, default gateway, and DNS servers that we set for it.

The system menu with the

To create a new connection using the "Settings" application, click the " + " icon on the "Networks" page, above the list of wired connections.

The wired connection section in the Network tab of the Settings app

A dialog appears. We need to provide a name for our new static IP connection.

Giving a name to a new connection profile in the

We're calling our new connection "static-2." Click the "IPv4" tab.

Supplying the IPv4 connection details to a new connection profile in the

Select the "Manual" radio button, and complete the "Address", "Netmask", and "Gateway" fields. Also complete the DNS field, and then click the green "Apply" button. Note the comma between the DNS entries.

Our new connection is listed in the "Wired" connections pane.

A newly-added connection in the wired connection section of the Network tab of the Settings app

You can swap between the available connections by clicking directly on their names.

If you want to modify a connection after you create it, click the cog icon. In this case, we'll enter the settings for the "static-ip" connection.

The wired connection section in the Network tab of the Settings app

A dialog box opens. Click on the "IPv4" tab.

The IPv4 tab of the connection settings dialog

Because we set our new IP address to be static, the "Manual" radio button is selected. You could change this back to DHCP by selecting the "Automatic (DHCP)" radio button, and clicking the green "Apply" button.

Using the nmcli command or the GNOME desktop and apps, you can hop between network connections very easily and very quickly.

It's more convenient to have a selection of connection profiles and move between them as you need to, rather than to have one that you keep editing. If something goes horribly wrong with the connection you're editing or adding, you can always fall back on one of the existing connections.

Setting a Static IP in Ubuntu – Linux IP Address Tutorial

In most network configurations, the router DHCP server assigns the IP address dynamically by default. If you want to ensure that your system IP stays the same every time, you can force it to use a static IP.

That's what we will learn in this article. We will explore two ways to set a static IP in Ubuntu.

Static IP addresses find their use in the following situations:

  • Configuring port forwarding.
  • Configuring your system as a server such as an FTP server, web server, or a media server.

Pre-requisites:

To follow this tutorial you will need the following:

  • Ubuntu installation, preferably with a GUI.
  • sudo rights as we will be modifying system configuration files.

How to Set a Static IP Using the Command Line

In this section, we will explore all the steps in detail needed to configure a static IP.

Step 1: Launch the terminal

You can launch the terminal using the shortcut Ctrl+ Shift+t .

Step 2: Note information about the current network

We will need our current network details such as the current assigned IP, subnet mask, and the network adapter name so that we can apply the necessary changes in the configurations.

Use the command below to find details of the available adapters and the respective IP information.

The output will look something like this:

image-14

For my network, the current adapter is eth0 . It could be different for your system

  • Note the current network adapter name

As my current adapter is eth0 , the below details are relevant.

It is worth noting that the current IP 172.23.199.129 is dynamically assigned. It has 20 bits reserved for the netmask. The broadcast address is 172.23.207.255 .

  • Note the subnet

We can find the subnet mask details using the command below:

Select the output against your adapter and read it carefully.

image-15

Based on the class and subnet mask, the usable host IP range for my network is: 172.23.192.1 - 172.23.207.254 .

Subnetting is a vast topic. For more info on subnetting and your usable IP ranges, check out this article .

Step 3: Make configuration changes

Netplan is the default network management tool for the latest Ubuntu versions. Configuration files for Netplan are written using YAML and end with the extension .yaml .

Note: Be careful about spaces in the configuration file as they are part of the syntax. Without proper indentation, the file won't be read properly.

  • Go to the netplan directory located at /etc/netplan .

ls into the /etc/netplan directory.

If you do not see any files, you can create one. The name could be anything, but by convention, it should start with a number like 01- and end with .yaml . The number sets the priority if you have more than one configuration file.

I'll create a file named 01-network-manager-all.yaml .

Let's add these lines to the file. We'll build the file step by step.

The top-level node in a Netplan configuration file is a network: mapping that contains version: 2 (means that it is using network definition version 2).

Next, we'll add a renderer, that controls the overall network. The renderer is systemd-networkd by default, but we'll set it to NetworkManager .

Now, our file looks like this:

Next, we'll add ethernets and refer to the network adapter name we looked for earlier in step#2. Other device types supported are modems: , wifis: , or bridges: .

As we are setting a static IP and we do not want to dynamically assign an IP to this network adapter, we'll set dhcp4 to no .

Now we'll specify the specific static IP we noted in step #2 depending on our subnet and the usable IP range. It was 172.23.207.254 .

Next, we'll specify the gateway, which is the router or network device that assigns the IP addresses. Mine is on 192.168.1.1 .

Next, we'll define nameservers . This is where you define a DNS server or a second DNS server. Here the first value is   8.8.8.8 which is Google's primary DNS server and the second value is 8.8.8.4 which is Google's secondary DNS server. These values can vary depending on your requirements.

Step 4: Apply and test the changes

We can test the changes first before permanently applying them using this command:

If there are no errors, it will ask if you want to apply these settings.

Now, finally, test the changes with the command ip a and you'll see that the static IP has been applied.

image-17

How to Set a Static IP Using the GUI

It is very easy to set a static IP through the Ubuntu GUI/ Desktop. Here are the steps:

  • Search for settings .
  • Click on either Network or Wi-Fi tab, depending on the interface you would like to modify.
  • To open the interface settings, click on the gear icon next to the interface name.
  • Select “Manual” in the IPV4 tab and enter your static IP address, Netmask and Gateway.
  • Click on the Apply button.

image-16

  • Verify by using the command ip a

image-18

In this article, we covered two methods to set the static IP in Ubuntu. I hope you found the article useful.

What’s your favorite thing you learned from this tutorial? Let me know on Twitter !

You can read my other posts here .

I am a DevOps Consultant and writer at FreeCodeCamp. I aim to provide easy and to-the-point content for Techies!

If you read this far, thank the author to show them you care. Say Thanks

Learn to code for free. freeCodeCamp's open source curriculum has helped more than 40,000 people get jobs as developers. Get started

setting a static ip linux

How to configure a static IP on Linux

By default, upon installation, any Linux system uses DHCP  for its network configuration. This implies that it automatically obtains an IP address from a router or a DHCP server in a network.  However, there are certain instances that require configuration of a static IP.  A good example is where you have a server, e.g a web server or an  FTP server. You definitely don’t want its IP to keep changing once the DHCP lease time is over. This will definitely cause loss of service once the IP changes.

Let’s see how we can configure a static IP  in different distros.

Configuring a static IP in Fedora 27, CentOS and RHEL 7

Firstly, list the IP of all interfaces

Sample Output

Above, we can observe that our IP address is 192.168.43.160 and netmask is 255.255.255.0 We are going to configure this statically.

Navigate to the following path to view interface statistics of interface enp0s3

The sample output should contain the following parameters:

This tells the system to start networking service at boot time.

To set a static IP, modify the following settings:

Restart the networking service

Verify the settings.

Also, check the nameservers

using nmtui utility

nmtui, short for Network Manager Text User interface is a GUI tool that painlessly allows you to configure your network interface without having to touch the command line. It can be installed both on RPM and Debian based distributions.

For Centos & RHEL 7

Launching nmtui

nmtui static IP

Select an interface to configure

nmtui-2 static IP

Press ‘Tab’ key to navigate to the other options. Hit edit.

nmtui-3 static IP

Navigate to IPV4 and select ‘show’

nmtui-4 static IP config

Hit Okay. Go back and select Quit

nmtui-quit static IP

Finally, restart networking service.

Configuring a static IP in Ubuntu 14.04, 16.04

Navigate to the network interface configuration file

DHCP settings

To configure a static IP, remove DHCP and append ‘static’ to ‘inet’ and enter your preferred address, netmask, gateway and dns-name servers

Restart networking

Verify the settings using ifconfig command and cat /etc/resolv.conf

Wrapping up

Your thoughts about this article are highly welcome. Feel free to get back to us for any clarifications.

' src=

About James

Related articles.

  • How to fix the repository is not signed error on Ubuntu 20.04
  • How to Create Additional FTP Accounts on VestaCP
  • How to restrict SSH access only to specific IPs
  • LAMP on CentOS 6

setting a static ip linux

Learn Ubuntu

Static IP in Ubuntu

Set static IP in Ubuntu using Terminal

Pratham Patel

Table of Contents

Normally, the router's DHCP server handles assigning the IP address to every device on the network, including your computer.

The DHCP server may also give you a new IP address occasionally. This could cause a problem if you have a home lab or server setup that works on a fixed IP address.

You need to set a static IP address on your Ubuntu system to avoid problems.

Please enable JavaScript

Step 1: Identify the correct network interface

The first step is always to know the name of your network interface.

"But why?" you might ask. That is because since Ubuntu 20.04, the network interfaces are named using predictable network interface names . This means your one and only ethernet interface will not be named 'eth0'.

Ubuntu Server and Ubuntu Desktop use different renderers for 'netplan', they are 'systemd-networkd' and 'NetworkManager', respectively. So let's go over their differences.

Ubuntu Server

To see available network interfaces on Ubuntu Server, run the following command:

Doing so will show a similar result:

The output enumerates network interfaces with numbers.

From this, I can see that the ethernet interface is 'enp1s0'.

Ubuntu Desktop

The advantage (at least in my opinion) of having Ubuntu Desktop is having NetworkManager as the renderer for netplan .

It has a pretty CLI output :)

Run the following command to view the available network interfaces:

That will give you the device name, type, state and connection status.

Here is what it looks like on my computer:

This is more readable at first glance. I can make out that my ethernet interface is named 'enp1s0'.

setting a static ip linux

Step 2: See current IP address

Now that you know which interface needs to be addressed, let us edit a file .

Before I change my IP address/set a static one, let us first see what my current IP address is .

Nice! But let's change it to '192.168.122.128' for demonstration purposes.

Step 3: See the gateway

A gateway is a device that connects different networks (basically what your all-in-one router is). To know the address of your gateway, run the following command:

The gateway address will be on the line that begins with "default via".

Below is the output of running the ip command on my computer:

On the line that starts with "default via", I can see that my gateway address '192.168.122.1'

Make a note of your gateway address.

Step 4: Set static IP address

Now that you have detail like interface name and gateway address, it is time to edit a config file.

Step 4-A: Disable cloud-init if present

The easiest way to know if cloud-init is present or not is to check if there is a package with that name.

Run the following command to check:

If you get an outupt, you have 'cloud-init' installed.

Now, to disable could-init, create a new file inside the /etc/cloud/cloud.cfg.d directory. The name does not matter, so I will call it '99-disable-cloud-init.cfg'.

Add the following line to it:

Please reboot your Ubuntu system now so that cloud-init does not interfere when we set our static IP address in the next step. :)

Back to Step 4

Once the 'cloud-init' related configuration is complete, we must now edit the netplan configuration to add our static IP address.

Go to the /etc/netplan directory. It is better if there is one file (easier to know which one to edit), but in some cases, there might also be more than one file with the extension '.yml' or '.yaml'.

When in doubt, grep for the name of your network interface. Use the following command if you are not comfortable with grep:

Since the name of network interface for my ethernet is 'enp1s0', I will run the following command:

running this command shows that the file I am looking for is '00-installer-config.yaml'. So let us take a look at it.

You might have noticed a line that says 'ethernet' and our network interface name under that. Under this is where we configure our 'enp1s0' network interface.

Since we do not want DHCP assigned IP address, let us change that field from true to no .

Add a field called addresses . Write the IP address you wish to assign your computer along with the network prefix. So I will write 192.168.122.128/24 in the addresses field.

Finally, we also need to specify DNS nameservers. For that, create a new field called nameservers and under that, create a field called addresses which contains the IP address for your DNS servers . I used Cloudflare's DNS servers but you can use whatever you want.

This is what my '00-installer-config.yaml' file looks like after editing it to my liking.

To apply the settings, run the following command:

This will take only a few seconds, and the IP address will be updated once it is done.

You can check the IP address using the hostname -I command.

Perfect! The IP address has now changed successfully.

setting a static ip linux

I know that it feels complicated but this is the proper procedure when you are trying to assign static IP via the command line in Ubuntu.

Let me know if you are stuck at some point or encounter any technical issues.

You might also like

How to Open and Edit bashrc file in Ubuntu

How to Open and Edit bashrc file in Ubuntu

Sagar Sharma

How to Quit the Terminal in Ubuntu

How to Find SSH Keys in Ubuntu

How to Find SSH Keys in Ubuntu

  • Embedded/IoT
  • Open Source
  • System Administration
  • Certification
  • What is Linux?

Linux.com

  • Training and Tutorials

Setting Static IP address in Linux

To assign a static IP address, just open the terminal and type the following sudo ifconfig eth0 your_ip_adddress

Here eth0 is the name of your NIC(Network Interface Card). You need super user privileges to do static IP assignment. Its recommended that the IP you assign is in the range 10.xx.xx.xx or in the range 192.168.xx.xx.

RELATED ARTICLES MORE FROM AUTHOR

setting a static ip linux

Learn More in ’24 & Save up to 35%

35% Discount on Training & Certification Ad

Give the Gift of Learning With 35% Discount on all Training & Certification

Last Chance CyberMonday Deals

Cyber Monday Deals Extended Until Dec. 6th!

setting a static ip linux

Hacking the Linux Kernel in Ada – Part 3

Hacking the linux kernel in ada – part 2.

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

How do I set a static IP in Ubuntu 20.04.3 LTS?

I'm trying to set up a lab computer as a ssh server following this guide . One of the steps is setting up a static IP address. So, I was glad to find this answer . Following it, I created /etc/netplan/50-cloud-init.yaml file, pasted

where my_ethernet_num == enp9s0 . Buuuut, after this ip a showed no ip address for the Ethernet:

and sudo lshw -C network yielded *-network DISABLED . Then I tried to use that guide (section 'Static IP Address Assignment'). I created /etc/netplan/99_config.yaml , pasted the necessary code, run sudo netplan apply . Nothing changed except that I STOPPED SEEING wired connections in network settings... I tried the answer from here , and the 'Wired' section returned. But I can't change anything (for example, I can't pick 'Manual' option).

Screenshot

So, the questions are: how can I return the ability of changing it (in order to follow one more guide ), or is there any other solution that will succeed in setting static ip address?...

--EDIT from 12/05/2021--

Here are all of my .yaml files showed by ls -al /etc/netplan :

01-network-manager-all.yaml:

50-cloud-init.yaml:

99_config.yaml:

  • network-manager

Serg's user avatar

  • 1 Probably you should delete/revert all changes that you have made, to get back to the original configuration. Then just use "Manual" option from the GUI. No need to mess with configuration files manually. –  raj Nov 29, 2021 at 12:44
  • @raj, thank you for your comment! If I only knew how to revert all the changes... By the way, after rebooting, I suddenly found out that I can make changes to the settings! So, I'll try the the GUI option and write about results :) –  TopCoder2000 Nov 29, 2021 at 13:31
  • Why does your .yaml use enp0s3, when your interface is enp9s0? Are you using a Server or Desktop installation? –  heynnema Nov 29, 2021 at 23:37
  • @heynnema, because it was in the answer for 'How do I set a static IP in Ubuntu?' . As we can see, enp0s25 is used in the question, but then enp0s3 is used in the answer, so I thought that it always must be enp0s25. > Are you using a Server or Desktop installation? I would like to use a Desktop installation, but I don't know concretely which one I was using... Is there any difference? I tried to follow Desktop installation but I could get confused. –  TopCoder2000 Dec 1, 2021 at 19:31
  • @TopCoder2000 Your network can't possibly be working with enp0s3 in the .yaml file. It needs to be enp9s0. But if you're using a Desktop installation, then your .yaml is all wrong anyway. A Desktop installation has a GUI, a Server installation is CLI only. Also, your self-accepted answer doesn't really make a lot of sense. –  heynnema Dec 1, 2021 at 19:37

Pick ONE of the following two configurations...

Server installation with static IP...

Delete /etc/netplan/01-network-manager-all.yaml

Delete /etc/netplan/50-cloud-init.yaml

Edit /etc/netplan/99_config.yaml to look EXACTLY like this...

Note : regarding 192.168.0.116, make sure this address is outside of the DHCP range set in your router, and is not already used elsewhere.

Note : For DNS nameservers, settle on servers from one source... Google, Cloudflare, OpenDNS, etc. (3 max).

sudo netplan generate

sudo netplan apply

Desktop installation with static IP...

Delete /etc/netplan/99_config.yaml

Edit /etc/netplan/01-network-manager-all.yaml to look EXACTLY like this...

Note : Use the NetworkManager GUI to setup your static IP for "Wired Connection".

Note : See https://netplan.io/examples/ for examples and design info about netplan.

heynnema's user avatar

  • Thank you for your answer and netplan examples! Now ip a shows correct output. But how do I setup a static IP with NetworkManager GUI? –  TopCoder2000 Dec 6, 2021 at 18:28
  • @TopCoder2000 Firstly, you can't use both parts of my answer at the same time. It's part 1 or part 2. If you're using part 2, then my answer says "Use the NetworkManager GUI to setup your static IP for "Wired Connection"" . See the IPv4 tab. Click on the manual button. Fill in the address, mask, gateway, and DNS servers, and turn off DNS Auto. –  heynnema Dec 6, 2021 at 18:44
  • yes, I remember! I'll accept it as soon as I don't have any questions :) Yes, I'm using the second option. But you also wrote yesterday that 'Static IPs should be set to be outside of the DHCP range set in the router'. But how do I know that set? For example, the second answer from here says that we have to check DHCP server configuration... –  TopCoder2000 Dec 7, 2021 at 6:51
  • @TopCoder2000 You must log into the admin page of your router and find the DHCP server settings. For your computer's static IP, you'll need to pick an address outside of the DHCP server's range of addresses. –  heynnema Dec 7, 2021 at 15:01
  • Ah, good! Thanks! –  TopCoder2000 Dec 9, 2021 at 7:07

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged networking 20.04 network-manager ethernet ..

  • The Overflow Blog
  • Exploring the inclusive tech revolution sponsored post
  • Would you trust an AI bot to find the fix for vulnerabilities in your code?
  • Featured on Meta
  • Site maintenance - Saturday, February 24th, 2024, 14:00 - 22:00 UTC (9 AM - 5...
  • Upcoming privacy updates: removal of the Activity data section and Google...

Hot Network Questions

  • Is it a bad idea to install a bathroom vent in a drop ceiling without external exhaust?
  • How can I convert the Multiply Add node in Blender 2.79?
  • Doctor won't let me self-pay because I've "already presented" them my insurance card?
  • What is the technical definition of "clone" that makes the K1810VM88 (К1810ВМ88) not a clone of the 8088?
  • Notation in NFA, DFA diagrams and language
  • Showing prefix of token in error message?
  • Parallel resistors with polarised capacitor
  • What is this equivalence relation on topological spaces: there are bijective continuous maps in both directions
  • How to find unspoofed MAC address of NIC
  • May one chemically castrate animals
  • Translate between ibrav and space_group Quantum Espresso inputs
  • Book Identification -- young adult novel witch
  • Where Is My Home?
  • Transmission Time - What exactly is it?
  • Converting Schengen visa to other visa type in Germany for extended stay as a specialist?
  • How to make the segmentation function automatically draw the correct function image at the break point?
  • Debian create persistent network bridge
  • "What are their values?" what is the subject in sentences like this?
  • Accidental colonists on Mars survive being stranded because Mars plants grow and provide the necessities of life
  • Cayley Table Sudoku
  • Lenghten the vertical lines in a table
  • Example of a point that is not the limit of any sequence in a connected topological space
  • How to connect fridge to existing water line
  • number of combinations for distributing 20 grades (between 0 and 100) with a a difference of at least 4 between every 2 grades

setting a static ip linux

The Make Sphere (themakersphere) logo

Quick Guide: Linux Set Static IP Address On Command Line Using nmcli

A command line terminal showing some of the Linux set static IP address commands on it.

A common topic most Linux users search for at some point is “Linux Set Static IP.” Having a static IP address is almost mandatory for some applications such as any network IoT device, HTPCs, etc. There are a bunch of benefits to running a static IP address on Linux, and really, any other operating system.

The quickest way to achieve “Linux set static IP address” is going to be by using nmcli. This guide will show you how to quickly accomplish your Linux set static IP address concerns by showing you, step-by-step, how to set a static IP address on Linux using the command line. By utilizing the aforementioned nmcli, it takes only 3-4 minutes to quickly set a static IP address on Linux/Unix.

Table of Contents

Linux Set Static IP Address Benefits

Setting a static ip address improves network stability.

One of the biggest advantages of setting a static IP address on Linux, or any other operating system, is the network stability it provides. A static IP address never changes, unlike a dynamic IP address which will (typically) change each time your machine is restarted or turned on. By having a static IP address, you eliminate the risk of that machine being unreachable due to a misconfigured IP address.

Efficient Remote Access and Hosting

Another one of the great benefits of having a static IP address is in regards to remote access. With a static IP address, you can easily connect to your Linux machine without having to worry about changing the remote access configuration due to having a dynamic IP address. Having a static IP address ensures that your Linux machine, and any services running on it, are easily accessible, remotely!

Enhanced Security

One thing Linux is known for is there focus on security. By using a static IP address, you increase your network security greatly. By giving your Linux device a static IP address, you can create much more strict firewall rules and restrictions to protect yourself, your network and your device. This also allows for having much tighter security when authenticating with the device remotely so you can ensure only authorized users can access the Linux box.

Linux Set Static IP Address Step-by-Step Guide

This ‘Linux Set Static IP Address’ guide will be using the command line and a utility called nmcli and assumes you already have your preferred connection type set up. If you are currently using an Ethernet connection and would like to use WiFi, but are unsure of how to set that up on the command line, please refer to this Set Up WiFi on Linux Using the Command Line guide.

If you already have nmcli installed, you can skip ahead to the Linux Set Static IP Address With nmcli section.

Installing nmcli

First we will begin by installing nmcli. Start by typing the following command in your terminal:

After a few seconds, go ahead and install the network-manager by typing the following:

Set Linux Static IP Address With nmcli

Now that nmcli is installed, or was already installed, we want to get a list of all of our network adapters and indentify the correct one to assign the static IP address to. Begin by typing:

You should see an output similar to mine as shown below. For my device, I am using WiFi, so I want to configure the device of wlx74da38661d72 with a static IP address. Make note of whatever device you are going to be configuring as we will be using this to actually set the static IP address. Again, for my, the device is wlx74da38661d72 .

Now that you have the device, we want to find the current IP address using that device so we can keep that current IP address as the IP address forever, or until we change it again in the future. Go ahead and run the following command:

Using this command, you will get an output for all of your network adapters. Within this list, we want to identify the correct one with the device we made note of earlier. The device I am looking for, that I made note of, was wlx74da38661d72 . So the information I am looking for in my output is 3: wlx74da38661d72 . On that device, look for the inet IP address. Given the output below, for me, that is 192.168.1.105/24 . This is my current WiFi adapter’s IP address and the IP address that I want to be static. Make note of your IP address. I will make note of 192.168.1.105/24 and use it within the next few steps.

Now that we have our Linux device’s IP address, we need to find our default gateway. This is your router’s IP address. You can quickly get this by using this command in your terminal:

Using this command, you will see the default gateway. Again, please make note of this as we will be using it in the next few steps. For me, my default gateway is 192.168.1.1 .

Now we are going to enter some commands to input our values we made note of before. First, lets set the IP address. Do this by entering the following command:

Next, we will do the gateway:

Third, we need to set the DNS in the configuration. If you are unfamiliar with DNS and unsure of what to use for this value, go ahead and use 8.8.8.8 as I do.

The final configuration command we need to run is setting the method. Since we are wanting a static IP address, the value will be manual . Run the following command:

After entering those 4 configuration commands, we want to make sure these values are saved and bring up our new static connection. Do that by entering:

After that, you’re done! You have now successfully completed your set Linux static IP address.

Final Thoughts

I hope my ‘Linux Set Static IP Address’ guide was quick and easy to follow. You should now be all set with a static IP address on your Linux device and no longer need to worry about the IP address changing every time the device boots up. If you have any questions, concerns or comments, please let me know in the comments. Have a great day and happy tinkering!

You May Also Enjoy

Non HP Chip Detected – Quick Fix

A photo showing the Non HP Chip Detected error message on my HP OfficeJet Pro 6978

A quick and simple solution for apply the Non HP Chip Detected fix to your HP Printer!

Setting Up WiFi on Ubuntu Command Line

A command line prompt for setting up WiFi on Ubuntu CLI

A quick step-by-step guide for setting up WiFi on Ubuntu using the command line.

Fixing the DaVinci Resolve Media Offline Error

An image showing the DaVinci Resolve program with the red 'Media Offline' messages on the video files. Over that is the white text reading 'DaVinci Resolve Media Offline Fix'.

A quick and simple guide for fixing the DaVinci Resolve Media Offline error.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

  • The Maker Sphere

About the Author

' src=

Donnie is a technology enthusiast who loves to tinker with things and build DIY projects. He enjoys 3D printing, creating 3D models, woodworking, and is a big fan of the game Magic the Gathering. A lot of his DIY projects have been inspired by MTG and its lore.

Latest Articles

arctis 1 wireless battery replacement featured

Popular Articles

3d printed lithophane lamp 3d printed picture frame featured

How to Set Static IP Address on Ubuntu Server 22.04

In this post, we will cover how to set static ip address on Ubuntu server 22.04.

It is highly recommended to have a static ip on linux server because it would be persistent across the reboot. Static IP plays an important role for servers like Mail Server, Web Server and File server etc.

Prerequisites

  • Minimal Installed Ubuntu Server 22.04
  • Regular User with sudo admin rights

In Ubuntu server 22.04, networking is controlled by netplan utility , so we will use netplan to configure static ip address on Ubuntu server.

Note: we cannot use nmcli utiltity as it is not the part of default installation on Ubuntu server.

Setting up Static IP address on Ubuntu Server 22.04

Login to your Ubuntu server 22.04, look for the netplan configuration file. It is located under /etc/netplan directory.

Run below cat command to view the contents of ‘00-installer-config.yaml’

Note: Name of configuration file may differ as your per setup. As it is an yaml file, so make sure to maintain the indentation and syntax while editing.

Default-Content-netplan-ubuntu-server

As per above output, it says that we have ens33 interface and it is getting ip from dhcp server. Alternate way to view interface name is via ip command.

Now, to configure static ip in place of dhcp, edit netplan configuration file using vi or nano editor and add the following content.

save and close the file.

Updated-Netplan-Config-File-Content-Ubuntu-Server

In the above file we have used following,

  • ens33 is the interface name
  • addresses are used to set the static ip
  • nameservers used to specify the DNS server ips
  • routes used to specify the default gateway

Note: Change the IP details and interface name as per your environment.

To make above changes into the effect the apply these changes using following netplan command,

Run following ip command to view the ip address on interface,

To view the default route, run

Output of above commands,

ip-addr-route-command-output-ubuntu-server

Perfect, above commands’ output confirms that static ip and route has been configured successfully.

That’s all from this post. Kindly do post your queries and feedback in below comments section.

11 thoughts on “How to Set Static IP Address on Ubuntu Server 22.04”

How do I use Netplan to set up a static IP address on WIFI?

change the network device “ens33” to something else, it will be listed when you run “ip a”; it;s probably wlan0 but that’s not guaranteed.

there will be a config file for the wifi interface. look for something like 00-installer-config-wifi.yaml

Hey! thanks I had problems before setting up the DNS and none config would work! This one did and you made this post really simple to follow!

Your text for configuring a static IP address does not work in my Ubuntu 20.04.5 server’s NIC. No matter how I space or tab the indentations, I get “Ivalid YAML: inconsistent indentation: addresses:

I’ve been at the problem for a couple of weeks, with no fix in site; no spacing or tabbing change I make fixes it. Can anyone please advise me? Thanks.

try paste the YAML into here ‘https://www.yamllint.com/’

Copy paste not work here, you should try typing instead or if you paste, try to delete all the space before each line and tab key until the same format

The spacing must be done with the space key. If you try to make spaces in a yaml file with the tab key it will not work. Also you should let yamllint.com correct the file for you

Your article is quite nice and clear! but after followed, following error occurred when ping google.com: “temporary failure in name resolution”, meanwhile localhost can be visited. Is anyone facing this issue as well? I’ll quite appreciate it if can get some advise.

can we use default DHCP ip configuration along with another static ip in ubuntu 22.04 ? i already have ens33 then i added eth0 as static ip , netplan apply did not thrown any errors but unable to see my static ip , when i do ifconfig 🙁 even after reboot its not applying, any suggestions..

i successfully set up my static ip but I cant ping to 192.168.1.1 why

Leave a Comment Cancel reply

XDA Developers

How to set a static internal IP in Ubuntu

Quick links, how to set static internal ip in ubuntu using the gui, how to set static internal ip in ubuntu using the terminal and text editor.

There comes a time when you might have to configure Ubuntu or any other Linux distribution with a static IP address. While you can't change your external static IP address, since it's the one your internet service provider provides, you can change your internal one. This is the IP address used on your network inside your home or office.

Though many tasks on Ubuntu usually require you to visit the terminal app and deal with lines of text, changing your internal IP is easy. You can do this through the settings app and the Graphical User Interface (GUI). Of course, if you want, you can also swap things out by going through the terminal. Here's how.

Without any technical know-how or knowledge, you can set a static IP in Ubuntu through the settings app. Just note, you will have to use the terminal once to find a range of IP addresses that you can assign. Once you do that, you just tap the Windows Key or the Superkey on your device and search for Settings . Once the app is open, proceed with the steps below.

  • If you're connected to the internet via Wi-Fi, choose Wi-Fi . If you're connected via Ethernet, select Network.
  • Once the interface is open, click the settings icon next to the network you're connected to.
  • From the list of tabs at the top, choose IPv4.
  • Under ipv4 method, be sure to choose Manual.
  • Under Addresses, enter the IP address, the Netmask, and the Gateway you want to use. For finding IP addresses that'll work on your network, you can proceed with the steps below.
  • Open a terminal session. With Ctrl, Alt, and T. Install net-tools with the command sudo apt install net-tools.
  • In this case, we have an inet of 192.168.1.176 and a netmask of 255.255.255.0. We can enter those numbers and can calculate the usable range using this website .
  • When you've calculated the usable range of addresses, choose a valid IP address that falls within this range. Then, you can click Apply at the top.

Any changes you apply will automatically go into effect. If you want, you can also use the terminal to confirm your IP address. Launch it with Ctrl, Alt, and T on your keyboard. Once launched, enter the command ip addr or ip a . You should see an interface IP address listed.

If you're a bit more technical and want to set a static IP in Ubuntu using the terminal, that is possible. You'll have to edit some lines of text and go through a few extra steps, but here's how:

  • Display information about your network. Use the command nmcli connection show. You'll see a network name, a UUID, a Type, and a Device. If this package isn't installed (though it should be, as it comes preinstalled with Ubuntu), then run sudo apt-get install network-manager
  • Note down the range of IP addresses you'll be able to use. Use the command ip addr to find out your machine's current IP address. This tutorial assumes that your network adapter is called enp0s3. If it isn't, then look for the correct one and also change the interface names in the subsequent commands. In the above example, we have an inet of 10.0.2.15, with the /24 denoting that the network uses a 255.255.255.0 subnet mask. In most cases, your usable network range will be whatever is in the first three places of the internal IP address, and then any unused number on your network between 1 and 255 in the last section. For example, we can use 10.0.2.16. If you're unsure, you can enter the subnet mask and your internal IP address into this website to calculate the usable range.
  • Note the IP address of your default gateway with the command ip r. In our example, it's 10.2.2.2.
  • Next, we'll add a new static connection option. Run the following command, making sure to change the numbers after "ip4" and "gw4" depending on your network conditions. These are the IP address you want to change your machine to and the current default gateway, respectively. sudo nmcli con add con-name "static" ifname enp0s3 type ethernet ip4 10.0.2.13/24 gw4 10.0.2.2 In our case, we do the following.
  • Set your DNS, manual DHCP (so, a static IP), and enable the connection. You can do that by running the following commands in succession. nmcli con mod "static" ipv4.dns "1.1.1.1,8.8.8.8" You can swap out the DNS servers above for whatever you want, they are in order of primary and secondary. nmcli con mod "static" ipv4.method manual; nmcli con up "static" ifname enp0s3 Once done, you can run nmcli con show to see if the new connection is enabled. If the output above looks like yours, then you're ready to go!

Setting complete

That's all you need to set up a static IP in Ubuntu. It doesn't take much effort. Remember, we're always writing about Linux, so you can check out our guide to the best Linux laptops should you need one.

How to set a static internal IP in Ubuntu

FOSS Linux

@2023 - All Right Reserved.

How to configure static IP address on Linux Mint

configure static ip address on linux mint

B y 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. Additionally, a static IP address is required if you wish to connect to any external shared device, such as a printer.

Configuring static IP address on Linux Mint

Three methods are available for configuring a static IP address:

  • Configuration via a graphical user interface
  • Configuration through the use of a terminal
  • Configuration via modifying a network configuration file

Configuring static IP address using GUI

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.

network

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.

static ip configuration

Static IP configuration

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

automatic dhcp

Automatic DHCP

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.

ipv4 manual configuration

IPv4 Manual configuration

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

network configuration

Network configuration

Configuring static IP address using the terminal

You can configure static IP addresses via the command-line interface (CLI). To do so, execute the following command:

This will open up a new window with various options; you must click the first one, “Edit a Connection,” to implement the new settings shown below.

edit a connection

Edit a connection

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

manual

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

edit connection

Edit connection

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

activate a connection

Activate a connection

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.

deactivate

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

Verify network settings

Verify network settings

As you can see in the above screenshot, the freshly assigned IP address is currently live and functional, as indicated by the “ens33” field, a network interface containing IPv4 information.

Configuring static IP address on Linux Mint via 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:

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.

nano add commands copy

Nano add commands

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

Configuration file

Configuration file

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

  • Installing and using Snap packages on Linux Mint
  • How to install Linux Mint on VirtualBox
  • How to update and upgrade Ubuntu or Linux Mint offline

New route

By default, your Linux Mint OS is configured to use DHCP, which means that the IP address assigned to your machine may change dynamically to a different available IP address. However, there are situations when a static IP address is required, such as connecting with a server. This is where static IP comes into play; it prevents your IP address from changing frequently and will remain the same unless it is changed by another party or restored to DHCP. I hope this article was helpful. If yes, please leave a remark below. Thanks for reading.

You may also like

My linux journey: why i always choose linux..., 15 cool things to do in linux mint, how to install and try different linux kernels..., how to launch chrome with a keyboard shortcut..., top 20 linux mint keyboard shortcuts for beginners, complete guide to installing a lamp server on....

'  data-srcset=

nice job – helped me a lot

Leave a Comment Cancel Reply

Save my name, email, and website in this browser for the next time I comment.

fl_logo_v3_footer

ENHANCE YOUR LINUX EXPERIENCE.

FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

MORE FROM US

  • Ubuntu (309)
  • Downloads (245)
  • Learn Linux (241)
  • Beginner's Guide (179)
  • Terminal Tuts (167)
  • Featured (125)
  • Linux Mint (98)
  • Server (95)
  • Fedora (80)
  • Privacy Policy
  • Terms of Use
  • GDPR Policy
  • Linux Careers

A PART OF VIBRANT LEAF MEDIA COMPANY.

“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.

  • Beginner’s Guide
  • Terminal Tuts
  • Learn Linux

IMAGES

  1. How to Configure Static IP Address on Linux System

    setting a static ip linux

  2. Linux: Setting up a Static IP

    setting a static ip linux

  3. How To Set A Static IP Address On A Network Interface In Linux

    setting a static ip linux

  4. How to Configure Static IP on Linux Debian

    setting a static ip linux

  5. Configure a static IP address in Ubuntu

    setting a static ip linux

  6. How to Configure Static IP Address on Ubuntu 20.04

    setting a static ip linux

VIDEO

  1. Add Static IP address in linux with nmcli

  2. How to Configure Static IP Address on Ubuntu 22 04

  3. Setting Openmediavault IP address to static #short

  4. OpenBSD Static IP

  5. How To Configure Static Ip In dlink Router

  6. 08.Static IP Linux server

COMMENTS

  1. Manual Network Configuration in Linux and How to Set a Static IP

    Manual Network Configuration in Linux and How to Set a Static IP Address Last updated: January 22, 2024 Written by: Hiks Gerganov Administration Networking ip systemctl 1. Introduction Many Linux distributions come with a network manager. In theory, it should help during the networking setup.

  2. How to Set Static IP Address and Configure Network in Linux

    How to Set Static IP Address and Configure Network in Linux Marin Todorov Last Updated: July 13, 2023 Linux Commands 32 Comments If you are a Linux system administrator, time will come when you will need to configure networking on your system.

  3. How to Set a Static IP Address in Ubuntu

    After gathering your connection name, subnet mask, and default gateway, you can set a static IP address in the terminal using the nmcli command. Or, in the GNOME desktop, open your connection settings and click the + icon, then enter the info for your static IP address there.

  4. Setting up static IP address for Linux: Easier than you think

    Add or modify the configuration below : BOOTPROTO=static IPADDR=192.168..1 NETMASK=255.255.255. GATEWAY=192.168..1 DNS1=8.8.8.8 DNS2=8.8.4.4

  5. Setting a Static IP in Ubuntu

    Step 1: Launch the terminal You can launch the terminal using the shortcut Ctrl+ Shift+t. Step 2: Note information about the current network We will need our current network details such as the current assigned IP, subnet mask, and the network adapter name so that we can apply the necessary changes in the configurations.

  6. How to Configure Static IP Address on Ubuntu 20.04

    The first step toward setting up a static IP address is identifying the name of the ethernet interface you want to configure. To do so, use the ip link command, as shown below: ip link The command prints a list of all the available network interfaces. In this example, the name of the interface is ens3:

  7. How To Configure Static IP Address In Linux And Unix

    Configure Static IP Address In Linux 1.1. Assign Static IP address In Fedora, RHEL, CentOS, AlmaLinux, Rocky Linux 1.1.1. Set Static IP Address By Editing Network Configuration File 1.1.2. Set IP Address Using Nmtui 1.1.3. Set IP Address Using Nmcli 1.2. Configure Static IP Address In Debian, Ubuntu 1.2.1. Set Static IP Address In Debian 1.2.2.

  8. How to configure a static IP on Linux

    How to configure a static IP on Linux 21890 views 1 min , 50 sec read 12 By default, upon installation, any Linux system uses DHCP for its network configuration. This implies that it automatically obtains an IP address from a router or a DHCP server in a network. However, there are certain instances that require configuration of a static IP.

  9. Linux Basics

    Step 1: Configure the network interface Step 2: Configure the DNS servers Step 3: Restart networking Configure the Hostname This tutorial explains how to set up a static IP address on an Ubuntu system from the command line.

  10. How to configure a static IP address on RHEL 8 / CentOS 8 Linux

    Method 1 - modifying interface configuration file manually For each network interface managed by the NetworkManager daemon, a configuration file is created inside the /etc/sysconfig/network-scripts directory. The name of the file is composed by the ifcfg- prefix plus the name of the interface.

  11. Linux Static IP Address Configuration

    Edit /etc/sysconfig/network as follows, enter: # cat /etc/sysconfig/network Sample static ip configuration: NETWORKING=yes HOSTNAME=server1.cyberciti.biz GATEWAY=192.168.1.254

  12. Set static IP in Ubuntu using Command Line

    How To Set static IP in Ubuntu using Terminal Pratham Patel Dec 5, 2022 Table of Contents Normally, the router's DHCP server handles assigning the IP address to every device on the network, including your computer. The DHCP server may also give you a new IP address occasionally.

  13. Setting Static IP address in Linux

    To assign a static IP address, just open the terminal and type the following sudo ifconfig eth0 your_ip_adddress Here eth0 is the name of your NIC (Network Interface Card). You need super user privileges to do static IP assignment. Its recommended that the IP you assign is in the range 10.xx.xx.xx or in the range 192.168.xx.xx.

  14. How do I set a static IP in Ubuntu 20.04.3 LTS?

    One of the steps is setting up a static IP address. So, I was glad to find this answer. Following it, I created /etc/netplan/50-cloud-init.yaml file, pasted network: ethernets: enp0s3: addresses: [desired_ip_address/24] gateway4: my_router_ip_address dhcp4: no nameservers: addresses: [1.1.1.1,8.8.8.8] optional: true version: 2 and run

  15. Quick Guide: Linux Set Static IP Address On Command Line Using nmcli

    The quickest way to achieve "Linux set static IP address" is going to be by using nmcli. This guide will show you how to quickly accomplish your Linux set static IP address concerns by showing you, step-by-step, how to set a static IP address on Linux using the command line. By utilizing the aforementioned nmcli, it takes only 3-4 minutes ...

  16. How to Set a Static IP Address in Linux

    Configuring a static IP can be difficult in Linux because it's different based on the distro and version you're using. This guide will show you how to configure a static IP address on the most popular Linux distros.

  17. How to Set Static IP Address on Ubuntu Server 22.04

    Setting up Static IP address on Ubuntu Server 22.04. Login to your Ubuntu server 22.04, look for the netplan configuration file. It is located under /etc/netplan directory. Run below cat command to view the contents of '00-installer-config.yaml'. Note: Name of configuration file may differ as your per setup. As it is an yaml file, so make ...

  18. How to set a static IP Address from the Command Line in GNU/Linux using

    Assuming you want to make the following changes to the network device eth0. Change the IP to the static value 192.168.1.2; Set the Subnet Mask to 255.255.255.0; Set the Default Gateway for the device to be 192.168.1.1; and you want to avoid using ifconfig and route that are obsolete you can perform these changes using the following two commands. sudo ip addr add 192.168.1.2/24 dev eth0; sudo ...

  19. Setting a Static IP Address in Ubuntu 24.04 via the Command Line

    Verify the New Static IP Address; Conclusion. Setting a static IP address on Ubuntu 24.04 involves identifying the correct network interface, editing the Netplan configuration file with the new IP settings, securing the file permissions, and applying the changes. This process ensures your server can communicate consistently and securely on your ...

  20. How to configure a static IP address on CentOS 7 / RHEL 7

    Verify new IP settings using the ip command for the NIC named eth0: # ip a s eth0 Verify new routing settings: # ip r Next, verify DNS servers settings using the cat command or grep command to query the /etc/resolv.conf file as follows: # cat /etc/resolv.conf Finally verify the internet connectivity using the ping command: # ping -c 3 cyberciti ...

  21. How to set a static internal IP in Ubuntu

    If you're connected to the internet via Wi-Fi, choose Wi-Fi.If you're connected via Ethernet, select Network.; Once the interface is open, click the settings icon next to the network you're ...

  22. How to Add Static Entries to the Hosts File on Linux

    For example, to map the "example.com" domain to the IP address "10.0.1.69," the final version should look like this: Mapping a domain name to the IP address in the "/etc/hosts" file on Linux. After adding your entries, save the changes and exit the editor. Now, it's time to test your changes.

  23. How to configure static IP address on Alpine Linux

    Setting a static IP address on your Alpine Linux server is required for various reasons. For instance, Alpine Linux is configured as a DHCP server or KVM server to host multiple VMs. Static IP address makes it easy to work with port forwarding, firewalling, and HTTPS server too.

  24. How to configure static IP address on Linux Mint

    Configuring static IP address using the terminal. You can configure static IP addresses via the command-line interface (CLI). To do so, execute the following command: nmtui. This will open up a new window with various options; you must click the first one, "Edit a Connection," to implement the new settings shown below. Edit a connection.

  25. configure linux box to have a static ip

    Let you Linux box on dhcp. Log on to router setting page. There should be a setting page to assign static ip to a given MAC address. This is available on Linksys router. If your doesn't support than see if you can flash your router with dd-wrt/open-wrt/tomato. these firmware definatly support this feature.