3 ways to configure the network
Starting and stopping interfaces, reinitialize new network setup, network interface names, using dhcp to automatically configure the interface, configuring the interface manually, setting the speed and duplex, bringing up an interface without an ip address, the resolv.conf configuration file, the resolvconf program, dns configuration for networkmanager, dhcp client configuration, bridging without switching, manual config, network init script config, bridges and vlans, caveats when using bridging and vlan, network config, bonding with active backup, /etc/network/interfaces, how to set the mtu (max transfer unit / packet size) with vlans over a bonded interface, legacy method, iproute2 method.
- The interfaces configuration file at /etc/network/interfaces (this page): for basic or simple configurations (e.g. workstation)
Setting up an Ethernet Interface
Upgrading and network interface names.
- Identify the interface in question (it will often be eth0). Adjust the remainder of these instructions accordingly.
- Reboot the machine to make sure it comes up correctly, and be prepared to intervene manually (e.g. Ctrl-Alt-Del and then boot into single-user mode from GRUB or LILO) if things don't work.
Defining the (DNS) Nameservers
- DHCP clients
- Choose a connection (from the Wired or Wireless tab) and click Edit.
- Click on the IPv4 Settings tab
- Choose 'Automatic (DHCP) addresses only' instead of just 'Automatic (DHCP)'.
- Enter the DNS servers in the “DNS servers” field, separated by spaces (e.g. 22.214.171.124 for OpenDNS).
- Click “Apply.”
Setting additional DNS Servers
Setting additional search domains, howto use vlan (dot1q, 802.1q, trunk) (etch, lenny), howto create fault tolerant bonding with vlan (etch - stretch).
Multiple IP addresses on one Interface
NetworkConfiguration ( last modified 2023-02-14 17:29:06 )
- Powered by MoinMoin and Python , with hosting provided by Metropolitan Area Network Darmstadt .
- Utility Menu
IT Support Blog
Office of information technology.
The College of Natural Sciences The University of Texas at Austin
How to Set a Static IP on a Linux Machine
Here’s a little primer on static Internet Protocol (IP) Addresses. Computers usually have the ability to grab a Dynamic Host Configuration Protocol (DHCP) address by default. Most networks are set to give out these dynamic IP addresses to any device that gets on the network and says, “I’m here! Give me an IP address so that I can use Google!”
The trouble with DHCP addresses is that they are dynamic. When a DHCP “lease” runs out, the computer or device may grab another available DHCP IP address. Normally this is ok and allows seamless Internet access to any computer; however, sometimes the need arises to statically assign an IP address for remote access, file transfers, or any other number of reasons.
To get a static IP address for your computer, submit a help ticket at http://cns.utexas.edu/help . Once you receive an IP assignment, follow the instructions below to get the IP Address and additional needed information onto your computer’s network connection.
NOTE: To make these changes, you must have an account with administrative rights on the machine. You will either need to login as root, or be able to use the "sudo" command on your machine. In the following, we assume you are logged in as root.
NOTE: Since the graphical interfaces change so much between Linux distributions, we're only going to show command line configuration here. While the command line interface does change between Linux distributions, it changes less than the graphical interfaces.
NOTE: We provide directions below for the most popular Linux distributions in CNS. If you use another distribution (like Gentoo, OpenSUSE, etc), you can contact the CNS Help Desk at http://cns.utexas.edu/help/ for additional instructions or help. There is also a tremendous amount of helpful information on the Internet on this topic. If the steps here do not work for you, Google for it. You'll almost certainly be able to find the procedure for the particular distribution of Linux you are running.
NOTE: Since part of the process described below is restarting the networking, you should always execute these commands from a local login to the machine, and not a remote sessions such as via ssh, vnc, etc.
How to add a static IP Address to a Linux computer
1) setting your system's hostname.
You should first set your system's hostname to the Fully Qualified Domain Name assigned to it. Assuming the assigned hostname for your machine is "pluto.cns.utexas.edu", you would use the following commands to set the hostname:
2) Edit your /etc/hosts file
Next, you should edit your /etc/hosts file to add a line containing your assigned IP address and FQDN. Assuming again your hostname is "pluto.cns.utexas.edu" and your IP address is 126.96.36.199, you can do this using the following command (all versions):
3) Setting the actual IP address
The first step is to figure out the name of your connected network interface. Run the command:
from the command prompt. It will output something like:
Now you need to set the IP address and additional information needed. The file and contents vary somewhat by Linux distribution. We assume the connected network interface name is em1 here – use whatever you determined to be your network name in the step above if it is different.
Debian and Ubuntu :
Edit the file /etc/network/interfaces and make the changes needed to specify your assigned IP address, Gateway, and Subnet Mask. The file should have comments in it to help you identify what needs to be done. Assuming again we are assigned 188.8.131.52 and pluto.cns.utexas.edu, and the network is a /24 network, then the file would read:
You would then restart the network interface using the commands:
Red Hat 7, CentOS 7, Scientific Linux 7, Fedora 22+:
These instructions are only for the newest versions of these operating system. See below for older versions.
On Red Hat based systems, each interface has its own configuration file /etc/sysconfig/networking-scripts/ifcfg- INTERFACE , where INTERFACE is the name of the interface. To configure em1, for example, you would edit the file /etc/sysconfig/networking-scripts/ifcfg-em1, and set it to something like the following:
Then you would restart the network interface using the commands:
On Arch Linux, the configuration file for network interface is /etc/netctl/ INTERFACE , where INTERFACE is the name of the interface. To configure em1 , for example, edit /etc/netctl/ em1 , and make it look like this:
Then start the network interface and enable the interface to start automatically at boot with the commands:
netctl restart em1 netctl enable em1
Red Hat, CentOS, Scientific Linux, Fedora
If you are not running one of the newer versions shown above, then you would edit the file /etc/sysconfig/networking-scripts/ifcfg-INTERFACE as follows:
Then restart the network interface using the command:
4) Configure your DNS servers if necessary
How to Set a Static IP on a Windows Machine How to Set a Static IP on a Mac OS X Machine
Written by CNS OIT staff Questions or comments? The best and easiest way to contact us is via the CNS Help Desk form .
- April 2018 (2)
- March 2018 (4)
- February 2018 (4)
- January 2018 (3)
- December 2017 (3)
- November 2017 (4)
- October 2017 (7)
- September 2017 (4)
- August 2017 (4)
- July 2017 (5)
- June 2017 (5)
- May 2017 (7)
- April 2017 (4)
- March 2017 (4)
- February 2017 (4)
- January 2017 (3)
- December 2016 (3)
- November 2016 (4)
- October 2016 (5)
- September 2016 (4)
- August 2016 (5)
- July 2016 (4)
- June 2016 (4)
- May 2016 (5)
- April 2016 (4)
- March 2016 (5)
- February 2016 (5)
- January 2016 (1)
- December 2015 (2)
- November 2015 (5)
- October 2015 (4)
- September 2015 (4)
- August 2015 (5)
- July 2015 (4)
- June 2015 (5)
- May 2015 (4)
- April 2015 (6)
- March 2015 (2)
- Browser (5)
- Classroom (1)
- E-Mail (14)
- General (49)
- Hardware (3)
- Hosting (11)
- ISO Alerts (23)
- Skip to primary navigation
- Skip to main content
- Skip to primary sidebar
- Skip to footer
Your Friendly Hosting Provider
- Domain name
- Domain extensions
- Webhosting Solutions
- Webhosting Complete
- WordPress Webhosting
- WooCommerce Webhosting
- Reseller Hosting
- Managed Cloud VPS
- Managed Pure Performance VPS
- Managed Azure VPS
- Managed Dedicated Servers
- Pure Performance VPS
- Enterprise Dedicated Servers
- Budget Dedicated Servers
- Server Upgrades
- Add-on Solutions
- Operating Systems
- Microsoft 365
- Support Portal
- Contact Support
- Write for Snel.com
- Free Moving service
- Data Center
- Payment Methods
- Monthly terminable
- ISO 27001 Certified
- Service Level Agreement
- Affiliate Program
- How to Configure Static IP on Debian 10
In a typical network, there are two ways to assign IP addresses. One is using DHCP and another is static IP assignment. DHCP or Dynamic Host Control Protocol dynamically assigns an IP address to an interface. It requires a DHCP server running in the network. In the static IP assignment, we manually assign the IP address, routing gateway, and DNS resolvers. Static IP assignment gives to more control on assigning an IP address and setting the DNS resolvers.
In this tutorial, we will learn how to assign static IP address on Debian 10 “Buster” server. But, if you would rather spare time and leave it up to our skilled IT-professionals, view our Managed Servers .
- Cloud VPS or Dedicated Server with Debian 10 installed.
- You must be logged in via SSH as a sudo or root user.
Step 1: Log in to shell using SSH
If you are not already logged into your remote server, login via SSH by following this guide.
Step 2: Find Network Interfaces
Run the following command to get the active network interfaces.
As we can see in the above screenshot, lo is the loopback interface which is an internal virtual interface used by the computer to communicate with itself.
The second interface ens18 is the active Ethernet adapter, which our server is using to connect to the internet. Now that we have found the adapter interface, we will assign the static IP on this interface. In your case, the adapter name can be different.
Step 3: Find the IP address assigned to the Interface
If you are a Snel user, you can go to the VPS dashboard and navigate to Network >> Interfaces .
Under interfaces, you will find the IP address assigned to the adapter.
Note that the example IP address is shown near 1 , which is 192.168.0.2 . The subnet mask will be 255.255.255.0 and Gateway will be 192.168.0.1 . DNS resolver servers are marked at 2 and 3 . In your actual case, these addresses will be different.
If you are unsure about these values, please feel free to contact Snel Support.
Step 4: Assign Static IP Address
Edit the network configuration file by running the following command.
This file may look like the following.
Edit the configuration as follows.
Make sure not to change the loopback adapter config. After the change, it will look something like the following screenshot.
Save the file and exit from the editor.
Step 5: Restart Networking Service
Restart the networking service so that the updated configuration can be applied. Run the command.
In this tutorial, we have learned how to configure a static IP address on Debian 10 “Buster” server. Your server is now configured to use static IP address.
Wednesday, August 4th, 2021 at 18:36
"systemctl restart networking" does not bring the interface back up for me.
Monday, August 23rd, 2021 at 09:13
do you get an error?
Sunday, October 3rd, 2021 at 23:14
The error I got after "sudo systemctl restart networking" with Debian 11 was: Oct 3 22:16:27 xod11-1 systemd: Stopping Raise network interfaces… Oct 3 22:16:27 xod11-1 ifdown: RTNETLINK answers: Cannot assign requested address Oct 3 22:16:27 xod11-1 dhclient: receive_packet failed on eth0: Network is down Oct 3 22:16:27 xod11-1 systemd: networking.service: Succeeded. Oct 3 22:16:27 xod11-1 systemd: Stopped Raise network interfaces. Oct 3 22:16:27 xod11-1 systemd: Starting Raise network interfaces… Oct 3 22:16:27 xod11-1 systemd: Finished Raise network interfaces.
Machine was unreachable until forcefully rebooted. After reboot machine came up with the new and static IP. Thanks anyway!
Tuesday, April 26th, 2022 at 16:18
Faced the same problem and this was helpful for me. sudo dhclient <interface-name>
Tuesday, November 2nd, 2021 at 21:46
Friday, December 3rd, 2021 at 13:20
auto ens18 iface ens18 inet static address 192.168.0.2 netmask 255.255.255.0 gateway 192.168.0.1 dns-nameservers 184.108.40.206 220.127.116.11
same way i am doing but when i press (CTRL + X ) they i press Y still not going to save.
Friday, December 3rd, 2021 at 13:23
afrer configure this now i can see that now 2 address is coming when i run IP a
first is DHCP and 2nd one is Static when i press CTRL+O. now i want to remove DHCP IP.
Monday, January 24th, 2022 at 20:37
Debian 10 was coming up trying to use a IPV6 address which hung the system since that is not configured here. so I had to log in to the console, hit enter to get to the login prompt.
On my customized kernel the 'interfaces' file was located in /etc/network/ I updated the 'interfaces' file per the above tech note and ran 'systemctl restart/networking'.
Restarting the service 'networking' hung on the ipv6 address as it did upon initial install. I used CTRL-C to break out of the hang then checked 'ip a' output and the IPV4 address was there without a reboot. At that point I was able to ssh to the interface no issues.
Friday, March 11th, 2022 at 21:32
i use a linkstation with debian so idk how to do that i can only ssh so i cant do that. (it stopped showing up on the router now)
Leave a Reply Cancel reply
Your email address will not be published. Required fields are marked *
Deploy your Cloud VPS within 2 minutes
Become a Snel.com customer today
- ISO 27001 Certification
- Privacy Statement
- Terms and Conditions
- Data Processing Agreement
- Acceptable Usage Policy
- Looking for a Webdeveloper?
- NVMe, SSD of HDD server?
- Sharing your company on Google Maps
- White label reseller hosting: Start your own brand
- Snel.com guest at Next Level RTL Z
Copyright © 2023 Snel.com B.V. All Rights Reserved.
How to set a static IP address on Debian server
Share with Your Friends
Your email has been sent
Jack Wallen walks you through the process of giving a standard user sudo privileges so they can set a static IP address on Debian server.
Debian is one of the most reliable operating systems on the planet. Its slower release cycle means each iteration gets plenty of attention before each release. And Debian isn’t just for desktops. In fact, Debian has been deployed as a server for years.
The one thing many new admins might find with deploying Debian as a server is that setting an IP address isn’t exactly as intuitive as other distributions. RHEL-based Linux distributions have the nmtui ncurses tools for configuring network connections, and Ubuntu-based distributions have netplan. With Debian, setting a static IP address is a bit more old-school, so I’m going to show you how it’s done.
SEE: 40+ open source and Linux terms you need to know (TechRepublic Premium)
What you need to setup an IP address in a Debian server
To set the IP address on Debian server, you’ll need a running instance of the OS and either a user with sudo privileges or access to the root user account. I’ll show you first how to give a standard user sudo privileges.
How to give a standard user sudo privileges in a Debian server
Let’s create a new user first. I’ll demonstrate by creating the user olivia (you can name the user whatever you like). To do that, log into Debian server as the root user and issue the command:
Once you’ve added the new user, add that user to the sudo group with:
sudo usermod -aG sudo olivia
Exit from the root user and log in with the new user account.
How to set a static IP address in a Debian server
The first thing you must do is locate the name of your network device. For that, issue the command:
ip -c link show
You should at least see two devices, lo (for loopback) and another named device (such as enp0s3).
Next, let’s back up the current network configuration file with the command:
sudo cp /etc/network/interfaces ~/
Open the configuration file for editing with the command:
sudo nano /etc/network/interfaces
If you find nano isn’t installed, add it with the command:
sudo apt-get install nano -y
With the interfaces file open for editing, you should see a DHCP configuration that looks like this:
# The primary network interface
iface enp0s3 inet dhcp
Comment that block out so it looks like this:
# allow-hotplug enp0s3
# iface enp0s3 inet dhcp
Now, we can add the necessary configuration for a static IP address. Let’s configure enp0s3 to use the address 192.168.1.97, with a gateway of 192.168.1.1, and a DNS nameserver of 18.104.22.168. That configuration will look like this:
iface enp0s3 inet static
Make sure to edit the above configuration to match your network scheme. Save and close the file.
Finally, restart the networking service with the command:
sudo systemctl restart networking
Make sure the networking configuration is correct, by issuing the command:
You should see the static IP address you configured. You’re good to go.
And that’s all there is to configure a static IP address in Debian server. Of course, if you installed your instance of Debian server with a desktop environment, you could simply use the GUI tool for this process. But for those who prefer to keep their servers sans GUI, this is the way to go.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.
Daily Tech Insider Newsletter
Stay up to date on the latest in technology with Daily Tech Insider. We bring you news on industry-leading companies, products, and people, as well as highlighted articles, downloads, and top resources. You’ll receive primers on hot tech topics that will help you stay ahead of the game.
- How to become a developer: A cheat sheet (TechRepublic)
- How-to guide for Linux administrators (free PDF) (TechRepublic)
- Linux 101: What tech pros need to know (TechRepublic Premium)
- Linux, Android, and more open source tech coverage (TechRepublic on Flipboard)
Contact Jack Wallen
Your message has been sent
- See all of Jack's content
- Open source
TechRepublic Premium editorial calendar: IT policies, checklists, toolkits and research for download
TechRepublic Premium content helps you solve your toughest IT issues and jump-start your career or next project.
The best human resources payroll software of 2023
With a lot of choices in the market, we have highlighted the top six HR and payroll software options for 2023.
Windows 11 update brings Bing Chat into the taskbar
Microsoft's latest Windows 11 allows enterprises to control some of these new features, which also include Notepad, iPhone and Android news.
Tech jobs: No rush back to the office for software developers as salaries reach $180,000
Salaries for remote roles in software development were higher than location-bound jobs in 2022, Hired finds.
The 10 best agile project management software for 2023
With so many agile project management software tools available, it can be overwhelming to find the best fit for you. We've compiled a list of 10 tools you can use to take advantage of agile within your organization.
1Password is looking to a password-free future. Here’s why
With phishing-based credentials theft on the rise, 1Password CPO Steve Won explains why the endgame is to 'eliminate’ passwords entirely.
IT training policy
Successful IT departments are defined not only by the technology they deploy and manage, but by the skills and capabilities of their people. IT workers must keep up to date with the latest technology trends and evolutions, as well as developing soft skills like project management, presentation and persuasion, and general management. Due to the ...
MSP best practices: Network switch and router maintenance checklist
Managed services providers often prioritize properly configuring and implementing client network switches and firewalls. However, regularly reviewing and updating such components is an equally important responsibility. It’s essential to ensure clients understand the necessity of regularly auditing, updating and creating new backups for network switches and routers as well as the need for scheduling the ...
Service level agreement policy
A service level agreement is a proven method for establishing expectations for arrangements between a service provider and a customer. SLAs involve identifying standards for availability and uptime, problem response/resolution times, service quality, performance metrics and other operational concepts. SLAs streamline operations and allow both parties to identify a proper framework for ensuring business efficiency ...
- TechRepublic on Twitter
- TechRepublic on Facebook
- TechRepublic on LinkedIn
- TechRepublic on Flipboard
- Property of TechnologyAdvice
Linux Basics: Configuring A Static IP In Debian
This tutorial details how to configure networking for a static IP in Debian. Most Debian systems configure network settings one way, however, there is one exception to the rule that I’m familiar with that I detail how to configure well. This tutorial was written for headless Debian 11 “Bullseye” installs but should work with other versions of Debian as well. When Debian 12 “Bookworm” is released, I will update this tutorial as necessary.
Before We Begin
Above, I mentioned that this tutorial is meant for headless systems. If you don’t know what headless means in this context – it’s a reference to a system/server without a graphical interface or even without a monitor attached at all. All changes to a headless system are generally done through a remote connection using a command line terminal.
The reason this tutorial is specific to headless systems is that a system with a graphical interface setup is likely using a graphical program called Network Manager to handle configuring networks for the system.
IP Address / Subnet Basics
If you’re using this tutorial, there’s a chance you might not have a strong knowledge of IP addresses and subnet masks. If you need to brush up on some basic info on IP addresses and subnets, I’ve written an additional tutorial that should give you enough understanding to complete this tutorial.
Check Your Existing IP
First things first – before we modify any settings, let’s have a look at the existing IP address on your system. By default when you install Debian your networking is configured via DHCP. Run this command in the terminal to check your existing IP address:
The output should look similar to this but specific to your system:
Notice for the device [email protected] (this is the network device for my my LXD container based demo environment) that the address is listed as dynamic meaning that the IP has been assigned via DHCP.
If your results don’t say dynamic, your system is already configured with a static IP address and no further changes are necessary unless you need to modify the server to use a different IP address.
Once you’ve determined that your system does indeed have a dynamic IP address, you can proceed with modifying your configuration for a static IP.
Modifying The Networking Interfaces File
Most Debian systems use the file /etc/network/interfaces for configuring your network settings.
To edit this file, we’ll use the nano editor as it’s fairly easy to use:
Your default interfaces file should look similar to this:
Start by modifying the line that says iface eth0 inet dhcp by changing dhcp to static . Next we need to provide a networking configuration. You’ll need to determine what IP address, netmask – netmask is another term for subnet mask, gateway, and dns nameserver settings are necessary for your own network.
If it’s helpful, these are the settings I’ve used in creating this tutorial:
I’ll take a moment to mention – you can use whatever DNS nameservers you prefer on your systems. On server systems I prefer to use Cloudflare’s 22.214.171.124 public DNS for their lightning fast speed. On desktop systems, I prefer to use Quad9’s DNS servers as I prefer the additional privacy / security their system offers.
Once you’ve finished making changes, the resulting configuration should look similar to this:
To exit saving the changes you’ve made, on your keyboard press CTRL + X and when prompted to save press Y for yes.
Once the file has been saved, you’ll need to restart networking for these changes to take effect. Do this using this command:
and then check the IP address to verify that your new settings have applied:
The output should look similar to this:
If we check the [email protected] interface again, notice that the address is now the static IP I’ve specified and it is no longer showing as being dynamic.
Setting A Static IP In Debian LXD Containers
For whatever reason, Debian configures their networking differently than normal in LXD containers . I make use of LXD containers in my homelab all the time – running various services as well as for setting up test environments and demos.
If you’d be interested in a tutorial series here on LXD containers, let me know in the comments below.
In LXD containers, Debian makes use of the networkd feature in systemd for networking. To modify the settings, you’ll need to find the config file for the network device you wish to configure inside the /etc/systemd/network/ directory. If you didn’t change the ID of your network interface for your container config, it should be /etc/systemd/network/eth0.network .
The default DHCP configuration should look like this:
To modify this configuration, we’re going to delete the line that says DHCP=true and replace it with settings like these, however, be sure to use settings appropriate for your own network:
I’ll take a moment to mention – like I did in the previous section – you can use whatever DNS nameservers you prefer on your systems. On server systems I prefer to use Cloudflare’s 126.96.36.199 public DNS for their lightning fast speed. On desktop systems, I prefer to use Quad9’s DNS servers as I prefer the additional privacy / security their system offers.
Once you’ve finished your changes, the resulting configuration should look similar to this:
Unlike your typical Debian system where you can easily restart the networking service to apply the changes, when you’re using Debian in a LXD container the simplest solution to applying the network changes is to restart your container.
Once your container is restarted, you can check that the changes have applied from your host system by just bringing up a list of the system’s containers using this command:
The output of this command should look similar to my system – though if you’re reading this tutorial you probably won’t have as many containers:
Additionally, you can check for the static IP in Debian as normal from the system terminal with this command:
Setting a static IP in Debian isn’t difficult once you know how to do it. If you’ve used this tutorial to prepare a system for a server application – perhaps like Pi-hole , Gitea, or Minio – you’re now ready to continue setting up your new server app.
If you found this review helpful and would like to support my efforts to create additional resources like this, please consider a subscription for just $5 per month or a one time donation via the “Buy Me A Coffee” button on this website. It looks like a travel mug in the corner of the page – you can’t miss it! Your support is greatly appreciated!
If you can’t make a donation, please consider sharing this review with others who may be interested. If you have questions about anything regarding this review, please be sure to leave them in the comments below. Thanks for reading, and I hope you visit again soon!
Setup A HA Galera Cluster On Debian / Ubuntu In 9 Easy Steps
Installing Pi-hole On TrueNAS Scale
Basic Pi-hole Configuration
About the author.
Leave a comment 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.
How to set up a static IP address on Debian 11
In this post, you will learn how to set up static IP on Debian 11 using two different methods . So, let’s start!
Method 1: Set up a static IP address on Debian 11 using terminal
As a Debian user, you can easily set up a static IP by using your terminal. To do so, firstly, you have to select an active network interface on your system.
How to check available network interfaces on Debian 11
You can utilize the “ ip ” command to get the details about your system’s currently available network interfaces. The “ ip ” is an abbreviation for “ Internet Protocol ”. The “ ip ” command is a utility used by network and system administrators in Linux-based systems to configure network interfaces. In the “ ip ” command, “ link ” is the sub-command added to view and modify the network interface. Write out the below-given command in your Debian 11 terminal for viewing the currently available network interfaces:
From the output, we will note down the name of our active network interface, which is “ enpos3 ”. As “ enpos3 ” is the network interface for which we will set up a static IP:
Now, open the configuration file of the network interfaces “ /etc/network/interfaces ” in the nano editor:
With the default settings, your network interfaces configuration file will look like this:
In the “ /etc/network/interfaces ” file, add the following details about your network interface, such as its static IP address , which you want to set up, netmask, gateway, dns-nameservers:
Here, the first two lines declare that we are setting a static IP address for the “ enpos3 ” network interface:
To save the changes you have made in the network interface configuration file, press “ CTRL+O ”:
How to restart the networking service on Debian 11
After configuring the static IP address for the “ enpos3 ” network interface, now we will restart the networking service using the systemctl command:
You can verify if your Debian system has configured the static IP for your selected network interface:
From the output, you can see that we have successfully configured static IP address our “ enpos3 ” network interface to “ 192.168.2.2 ”:
Method 2: Set up a static IP address on Debian 11 using GUI
Debian 11 also provides you the facility to set the static IP address of your active network interface using its GUI. If you want to utilize the Debian GUI method for configuring the static IP address, then open your system settings by searching “ settings ” in the Application’s bar:
From the different categories present in the left side menu, select “ Network ”. Open settings of your active network connection by clicking on the gear icon:
In the opened network settings window, click on the “ IPv4 ” tab. Select the “ Manual ” IPv4 method for your network:
After that, add your static IP address, Netmask, Gateway, DNS for your network, and then click on the “ Apply ” button:
Now, open the “ Details ” tab. Here, you will verify the added details for your network, such as its IP address:
That’s how you set up the static IP address for your network interface on Debian 11 using its GUI.
About the author
I am a Linux enthusiast, I love to read Every Linux blog on the internet. I hold masters degree in computer science and am passionate about learning and teaching.
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.
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.
If you appreciate what we do here on tecmint, you should consider:.
TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
We are thankful for your never ending support.
6 Wc Command to Count Number of Lines, Words, and Characters in File
How to Use ‘tee’ Command in Linux [8 Useful Examples]
How to Run Commands from Standard Input Using Tee and Xargs in Linux
How to Modify Linux Kernel Variables Using sysctl Command
4 Useful Commands to Clear Linux Terminal Screen
How to List and Extract tar.xz File in Linux
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.
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.
Got something to say? Join the discussion. Cancel reply
Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.
Save my name, email, and website in this browser for the next time I comment.
Don't subscribe All Replies to my comments Notify me of followup comments via e-mail. You can also subscribe without commenting.
Open the terminal application. · Log in to remote or server using ssh command. · Backup /etc/network/interfaces file running sudo cp /etc/network/
DNS configuration for NetworkManager · Choose a connection (from the Wired or Wireless tab) and click Edit. · Click on the IPv4 Settings tab · Choose 'Automatic (
Instructions. Enable Static IP. By default you will find the following configuration within the /etc/network/interfaces network config file:
See below for older versions. On Red Hat based systems, each interface has its own configuration file /etc/sysconfig/networking-scripts/ifcfg-
Prerequisites · Step 1: Log in to shell using SSH · Step 2: Find Network Interfaces · Step 3: Find the IP address assigned to the Interface · Step 4: Assign Static
You should at least see two devices, lo (for loopback) and another named device (such as enp0s3). ... Make sure to edit the above configuration to
Modifying The Networking Interfaces File ... Most Debian systems use the file /etc/network/interfaces for configuring your network settings.
Debian 11 also provides you the facility to set the static IP address of your active network interface using its GUI. If you want to utilize the Debian GUI
Explore network configuration under many different Linux distributions, with the main goal of setting a static IP address.
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