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 220.127.116.11. 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.
Subscribe to the Developer Insider Newsletter
From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays
- 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)
- See all of Jack's content
- Open source
TechRepublic Premium Editorial Calendar: Policies, Checklists, Hiring Kits and Glossaries for Download
TechRepublic Premium content helps you solve your toughest IT issues and jump-start your career or next project.
7 Best AI Art Generators of 2023
This is a comprehensive list of the best AI art generators. Explore the advanced technology that transforms imagination into stunning artworks.
The Best Cheap Payroll Services for 2023
Find the perfect payroll service for your business without breaking the bank. Discover the top cheap payroll services, features, pricing and pros and cons.
NordVPN Review (2023): Pricing, Security & Performance
Is NordVPN worth it? How much does it cost and is it safe to use? Read our NordVPN review to learn about pricing, features, security, and more.
10 Best Free Project Management Software & Tools for 2023
Free project management software provides flexibility for managing projects without paying a cent. Check out our list of the top free project management tools.
Cloud Strategies Are Facing a New Era of Strain in Australia, New Zealand
Australian and New Zealand enterprises in the public cloud are facing pressure to optimize cloud strategies due to a growth in usage and expected future demand, including for artificial intelligence use cases.
Quality Assurance Checklist For Outsourced Projects
Quality assurance refers to the processes being used to manage the project and to build the deliverables. This is in contrast to quality control, which refers to the activities used to create the deliverables. Because you are not responsible for the creation of the deliverables (quality control), you need to be comfortable that the outsourcer ...
Cloud Computing Policy
The list of advantages to cloud computing include lowered operational costs, greater technological flexibility and the ability to rapidly implement new systems or services. Gains in business continuity are an especially noteworthy attraction to cloud services, which operate via remote systems that remain running in the event of a local disaster, such as a hurricane ...
Quick Glossary: Business Intelligence and Analytics
Business intelligence and data analytics give tech decision makers a clearer idea of how well their companies are running and whether they’re meeting goals. Because BI incorporates data from across the enterprise — revenue operations, sales, supply chain and logistics — its insight is beneficial in areas such as customer profiling, customer support and market ...
- TechRepublic on Twitter
- TechRepublic on Facebook
- TechRepublic on LinkedIn
- TechRepublic on Flipboard
- Property of TechnologyAdvice
Create a TechRepublic Account
Get the web's best business technology news, tutorials, reviews, trends, and analysis—in your inbox. Let's start with the basics.
* - indicates required fields
Sign in to TechRepublic
Lost your password? Request a new password
Please enter your email adress. You will receive an email message with instructions on how to reset your password.
Check your email for a password reset link. If you didn't receive an email don't forgot to check your spam folder, otherwise contact support .
Welcome. Tell us a little bit about you.
This will help us provide you with customized content.
Want to receive more TechRepublic news?
You're all set.
Thanks for signing up! Keep an eye out for a confirmation email from our team. To ensure any newsletters you subscribed to hit your inbox, make sure to add [email protected] to your contacts list.
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, using systemd-resolved for dns resolution, 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. 18.104.22.168 for OpenDNS).
- Click “Apply.”
Checking the status and flushing the cache in systemd-resolved, managing systemd-resolved settings, 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-07-18 11:37:31 )
- Powered by MoinMoin and Python , with hosting provided by Metropolitan Area Network Darmstadt .
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 eth0@if2 (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 eth0@if2 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.
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 tutorial helpful and would like to support our efforts to create additional resources like this, please consider making a donation . Your support is greatly appreciated!
If you can’t make a donation, please consider sharing this tutorial with others who may be interested. If you have questions about anything regarding this tutorial, please be sure to leave them in the comments below. Thanks for reading, and I hope you visit again soon!
About The Author
Installing Pi-hole On TrueNAS Scale
Linux Basics: Configuring A Static IP In Ubuntu
Basic Pi-hole Configuration
Easily Self Host Vaultwarden Using Docker Compose
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.
Start typing and press enter to search
How to Assign Static IP Address on Debian 12
In this blog post, we will show you how to assign static ip address on Debian 12.
In the world of Linux, Debian remains one of the most popular distributions, known for its stability and versatility. One essential aspect of managing a Linux system is configuring network settings. Whether you’re setting up a server or just want a consistent IP address for your desktop, assigning a static IP address on Debian 12 can be a crucial task.
Table of Contents
- Pre-Installed Debian 12
- Sudo User with admin rights
There are different methods through we can assign static ip address on Debian 12.
Method1: Assign Static IP Address on Debian 12 Using GUI
Login to your Debian Desktop environment, From Activity –> Search Settings –> Choose Network
Click on Wired Settings and then we will get the following window,
Note: To disable IPv6, go to IPv6 tab and choose ‘ Disable ’ option
Click on IPv4 Tab
Above window shows that Automatic DHCP is enabled, so to Assign Static IP choose ‘ Manual’ and then specify the IP details like IP address, netmask, gateway and dns server IP.
Important Note: To Specify the dns server IP first disable the automatic dns IP by toggling it.
Click on Apply to save the changes.
Now, disable and enable the interface by toggling it so that new IP address is mapped to the Interface.
Now again click on wired settings to verify whether the new static ip address is assigned or not.
Perfect, above confirms that new static IP address is assigned successfully.
Method2: Assign Static IP Address on Debian 12 From Command Line
Open the terminal, check your current network configuration. You can do this by running the following ip command ,
This will display a list of network interfaces on your system. Note down the name of the interface you want to assign a static IP address to (typically, it’s ‘ enp0s3 ‘ for Ethernet).
Next, run nmcli command to get connection name,
Once we get the connection name, run below nmcli command to assign static ipv4 address,
$ nmcli con mod ‘connection-name’ ipv4.address <IP-Address>
Set the gateway by running below
Change Configuration from DHCP to Manual , so that IP will be static and persistent, run
Set the DNS server IP by running below command,
Disable and enable the connection so that above changes come into the effect.
Now run IP Command to check IP address,
Output of above commands would look like below:
Perfect, above output confirms that static IP address has been assigned successfully on enp0s3 interface.
Assign Static IP Address on Minimal Installed Debian 12
Whenever we install minimal Debian 12 then we will have only the CLI console and don’t have any nmcli utility. So, to assin static ip address we must edit the file ‘ /etc/network/interfaces ’.
Edit the file and set the static IP address as shown below,
Replace the line ‘ allow-htplug enp0s3 ’ with ‘ auto enp0s3 ‘ and change dhcp parameter to static . Below is my sample file, change interface name and ip details as per your environment.
save & close the file.
To make above changes into the effect the restart the network service
Now, run ip command to verify the ip address,
That’s all from this post. Please do share your feedback and queries in below comments section.
Assigning a static IP address on Debian 12 is a straightforward process that can greatly benefit your network stability and ease of access. By following the steps outlined in this guide, you can ensure that your Debian 12 system always has a consistent IP address, making it easier to manage and access your resources. Whether you’re configuring a server or just prefer having a stable address for your desktop, Debian 12 provides a user-friendly environment for all your networking needs.
Also Read : How to Install Kubernetes Cluster on Debian 12 | 11
2 thoughts on “How to Assign Static IP Address on Debian 12”
Nice Guide. Appreciate it.
In case someone has used “sudo raspi-config” > Advanced Options > Network Interface Names > Would you like to enable predictable network interface names ?
pi@pi-san-rasp:~ $ sudo nmcli connection modify Wired\ connection\ 1 ipv4.addresses 192.168.1.10/24 pi@pi-san-rasp:~ $ sudo nmcli connection modify Wired\ connection\ 1 ipv4.gateway 192.168.1.1 pi@pi-san-rasp:~ $ sudo nmcli connection modify Wired\ connection\ 1 ipv4.method manual pi@pi-san-rasp:~ $ sudo nmcli connection modify Wired\ connection\ 1 ipv4.dns ‘188.8.131.52’ pi@pi-san-rasp:~ $ sudo reboot
Leave a Comment Cancel reply
@2023 - All Right Reserved.
How to set up a static IP address on Debian 11
W hen installing any operating system, it is always set to receive network configuration from the DHCP (Dynamic Host Configuration Protocol) server. That includes IP address, routing, subnet, Gateway address, DNS information, and other network configurations. While that is always ok and enough to give you access to the internet, there are situations where a static IP address would be much more preferred. The main challenge with using the DHCP to assign IP addresses is that the IP is dynamic and might change.
To better understand the difference between Static and dynamic examples, let’s use a simple example. You have WiFi at your house, but you decide to go to a coffee shop with your laptop and use the internet there. When you come back to your home, there is a high probability that the DHCP will assign you a different IP address.
Why use a static IP
Some of the advantages of using a static IP include;
- It’s much easier to set up and manage DNS
- Reliable hosting services: Let’s say you are hosting a web server, game server, email server, or file server. Using a static IP will make it easier for clients to find you on a local network.
- Reliable Remote access: A static IP address would be more reliable if you connect to your system via SSH or a VPN.
- Reliable communication: Static Ip addressing ake it easier to configure VoIP (Voice Over Internet Protocol) and any other Video or Voice communication over IP.
- Reliable geo-location services: With static IPs, you will get much more accurate geo-location services than a dynamic IP. For example, if you want to know the weather status in your location, you are sure you won’t get weather information from another city.
Setting up a static IP on Debian 11
This post will guide you on setting up a static IP on Debian 11. There are two main methods that we can utilize.
- Set up static IP via the Terminal
- Set up static IP from the GUI
We will look at both methods. Let’s get started.
(Method 1) Set up static IP via the terminal
Before configuring our static IP address, we need to know the network interfaces we are connected to. There are several commands that we can use to achieve that. One of the most popular commands to list network interfaces on Linux is the ifconfig command. Unfortunately, this command is now deprecated and doesn’t come pre-installed on most systems.
The other command to list network interfaces is the IP command. Execute the command below on your Terminal.
List network interfaces
From the image above, you can see we are connected to the network interface ens33 and the currently assigned IP address is 192.168.1.52 .
With that information, we can now set our static IP address. Execute the command below to open the /etc/network/interfaces configuration file with nano editor.
If you have not done any configurations before, the file will look as shown below.
To set a static IP, add lines below at the end of the file.
Now let’s go through the line above:
- auto ens33 : Here, we specify that we want to use the ens33 network interface.
- iface ens33 inet static : This line specifies that we want to set a static IP address for our network interface.
- address : Here, we set the static IP address that we want to assign to our network interface.
- netmask : Here, enter the subnet mask
- gateway : Here, type the gateway address. If you are unsure, use the IP route command to list the gateway address.
- dns-nameservers : Enter your name servers here. For this post, we will use the default Google name servers.
Static IP configuration
Save the file (Ctrl + S) and Exit (Ctrl + X) when done.
To apply the configurations, we will need to restart the networking service. Execute the command below.
That’s it! You have successfully set a static IP address for your Debian 11 system. Now, when you reboot your system or travel and come back and connect to your WiFi network, the IP address will not change dynamically.
(Method 2) Set up static IP from the GUI
If you are not a command-line person, GNOME (the default Desktop Environment for the Debian system) has provided you with a simple and intuitive interface to configure a static IP address.
First, launch the Settings app from the applications menu and select the ‘Network’ option from the left-hand side panel.
You can see the network interface you are connected to and the necessary network information from this screen. In our case, we are connected to the ens33 network interface.
To set a static IP address, click on the Settings icon (gear icon) next to the network interface you want to set the static IP address.
Network interface settings
That will open a configuration window where you can perform several network settings. Select the IPv4 tab and in the IPv4 method section, enable the “manual” radio button. A section will appear below where you must fill in the IP address, subnet mask, and Gateway address.
Leave the DNS and Routes set as automatic. But if you still want to use your DNS settings and Routes, click on the button next to the ‘Automatic’ tag to enable ‘manual’ mode.
Click the ‘Apply’ button at the top to save the new configurations. To confirm that your static IP address was set successfully, click on the Settings icon next to the network interface and check the ‘details’ section.
That’s it! You have successfully enabled a static IP address from the Graphical User Interface.
This post has given you a step-by-step guide on setting up a static IP address on the Debian 11. We have looked at two methods – setting a static IP via the command line and setting a static IP from the Graphical User Interface. We have also looked at the advantages of using a static IP address and the various scenarios best if you used a static IP. We hope you found this article helpful. If you have any queries or comments, please don’t hesitate to leave a comment below.
You may also like
A ultimate guide to setting up a vsftpd..., your complete guide to installing python on debian, fixing ‘repository does not have a release file’..., fix: ‘unable to locate package’ error in ubuntu..., how to install missing perl modules on debian, how to set up wireguard server on debian.
Thanks. On Raspberry Pi this can be done by adding: ip=192.168.x.xxx to a file in the boot directory that you name: cmdline.txt Are you aware of any similar method that can do this on Debian?
Leave a Comment Cancel Reply
Save my name, email, and website in this browser for the next time I comment.
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 (307)
- Downloads (246)
- Learn Linux (227)
- Beginner's Guide (170)
- Terminal Tuts (160)
- Featured (126)
- Linux Mint (93)
- Server (90)
- Fedora (86)
- 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
How-tos and tutorials for sys admins
How to Set a Static IP on Debian 11
On a DHCP network, your Linux system will usually receive an IP address automatically from the DHCP server which, in most cases, is the router. The IP configuration will usually comprise the IPv4 address, the netmask, gateway, and the DNS settings. This is usually convenient for desktop or client PCs which only need to access the internet or network resources.
However, the case is different when you want to set up a server. In this case, you would need to configure a static IP to make the server always available via the same IP address. With DHCP, the IP address is bound to change once the lease time is over leading to the unavailability of the server.
In this guide, we will take you through a walk-through of how to set a static IP on Debian 11. We will demonstrate how you can configure a static IP on both the desktop GUI and server instances.
As you set sail, ensure that you have an instance of Debian 11 server installed and set up. In addition, ensure that you have configured a sudo user.
There are two ways of configuring a static IP on Debian. You can achieve this using GUI or on command-line.
Configure Static IP Address using the Graphical User Interface ( GUI )
If you are running a Debian 11 desktop instance, log in using your username and password. Before we configure the static IP, first confirm the IP address assigned to your system. In our case, we have a Debian PC with an IP address of 192.168.2.104 in a DHCP network.
You can verify this using the command shown.
In our system, enp0s3 interface is the active link that is assigned the IP address. This may be something else in your case.
To get started with setting the static IP, click on ‘Activities ’ on the left far corner. Search for and click on the ‘ Settings ’ icon.
On the ‘Settings’ page, select the ‘ Network ’ tab. Next, head over to the ‘Wired’ section and click on the small gear wheel as indicated.
This displays the current IP address configuration as shown. As we confirmed earlier, our current IP address is 192.168.2.104. This has been dynamically allocated to the active interface using the DHCP service.
We are going to override the DHCP settings and manually set a static IP which will persist even upon a reboot.
Click the IPv4 tab. Switch from ‘ Automatic ’ to ‘Manual ’ in the IPv4 method section. Thereafter, specify your desired IP address, netmask, and default gateway. Be sure to also provide the preferred DNS settings.
To apply the changes made, click the ‘ Apply’ button.
You need to restart the networking daemon or service for the Debian system to implement the new static IP settings. So, turn the toggle button off and then on.
Click on the gear icon once more to verify that the static IP settings have been applied.
On the terminal, verify that the network interface has acquired the newly configured IP address:
The output is a confirmation that the system was successfully configured using a static IP. Let’s now shift gears and explore setting a static IP on the command line.
Configure Static IP Address using the terminal
If you are running a headless server, or are connecting to a remote server via SSH, the only option available is to configure the static IP on the command line.
The network configuration settings are stored in the /etc/network/interfaces file. Have a peek at the file as follows. Feel free to use Nano editor if you don’t have vim installed.
By default, only the loopback settings are specified.
We are going to specify the IP settings for our active network interface. But before making any changes, make a backup of the configuration file.
Specify the IP settings as provided. Ensure to make your settings in accordance with your network subnet.
To apply the changes, restart the networking service.
This will disconnect you from the server if you are connected via SSH. Reconnect using the newly set static IP address.
We have outlined two methods of assigning a static IP on your Debian 11 PC – using GUI and the terminal. The former is the easier option when working on a Debian desktop and the latter comes in handy when configuring a remote server via an SSH client.
Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.
- ← How to Install VirtualBox Guest Additions on Debian 11
- How to Allow Remote Connections to MySQL →
Usermod Command with Examples
How to Install Manuskript on Manjaro Linux?
How to Exclude in Grep Command in Linux
How to Set Up a Static IP Address on Debian 12 Linux
A static IP address is already understandable from its name that this IP address will not change. The static IP address is the fixed address that is assigned to a particular network port.
If one wants to connect to the machine using a remote connection, a static IP address is required for it. If one is connected using the dynamic IP address, then the connection will be interrupted again and again.
Due to this, it is necessary to set up a static IP address on Debian 12, especially when one wants to connect the computer remotely. In this post, the methods for setting up a static IP address on Debian 12 have been explained.
What are the Methods to Set Up a Static IP Address on Debian 12?
One can set up the static IP address on Debian 12 by using any of the below-mentioned methods:
- Using the /etc/network/interfaces
- Using the Network Manager
- Using the GUI Method
Method 1: Set Up a Static IP Address on Debian 12 Using the /etc/network/interfaces
The first method of setting up the static IP address on Debian 12 is by editing the /etc/network/interfaces file with the text editor. To use the /etc/network/interfaces, follow the next-mentioned steps.
Step 1: Open the Terminal
First, open the terminal to run the commands for setting up the static IP address:
Step 2: Create a Backup
Create a backup of the original /etc/network/interfaces by copying its contents:
Step 3: Open the /etc/network/interfaces File
Using the nano or any other text editor, open the /etc/network/interfaces file:
Step 4: Set Up the Static IP Address
Now find the name of the network interface of which the static IP address is supposed to be set up and assign the IP address:
After making changes, save the file and close it by using the shortcuts CTRL+S and CTRL+X , respectively.
Step 5: Restart the Network
The final step of this method is to restart the network:
Method 2: Set Up a Static IP Address on Debian 12 Using the Network Manager
Another method to set up the static IP address on Debian 12 is by using the network manager. For this, follow the steps mentioned below.
Step 1: Use the nmcli Command
With the help of the nmcli command utility, set up the static IP address. To do so, follow the below-mentioned general syntax:
In the above command, change the “Your Connection Name” with your own values. For example, in our case, the above command will be used like this:
If the name of the “ connection name ” is not known to you, then use the command:
Step 2: Reload the NetworkManager
To save the changes, reload the network manager with the command:
Method 3: Set Up a Static IP Address on Debian 12 Using the GUI
The last but easiest method of setting up the static IP Address on Debian 12 is by using the GUI. The graphical user interface method is to understand, simply open the “ Settings ” of the Debian 12:
Click on “ Network ” and then choose the “ gear icon ” for the network connection:
Now click on “ IPv4 ”, then change the address to your own choice, and finally click on the “ Apply ” button:
The static IP address will be set up successfully.
How to Verify the Changes to Static IP Address on Debian 12?
To verify the changes to the static IP address on Debian 12, use the command:
These are the three methods of setting up the static IP address on Debian 12.
On Debian 12, one can use the “ Network Manager ” or change the “ /etc/network/interfaces ” file to configure the static IP address. Also, access Settings to set the IPv4 address. This post has explained all the mentioned methods with a step-by-step guide.