May 16, 2025
Tutorials

How to Install ifconfig on Debian 12: 4 Possible Methods

Install ifconfig on Debian 12

The ifconfig tool is a well-known tool to set up and show network settings on Linux systems. But in the latest Debian versions, including Debian 12 (Bookworm), ifconfig isn’t there by default, as it’s from an old package called net-tools. Here’s how you can get ifconfig on your Debian 12 system with all possible methods explained step by step.

Table of Contents

How to Install ifconfig on Debian 12

In Debian 12 (Bookworm), the ifconfig command comes from the net-tools package, which isn’t installed by default. However, if you still need to install ifconfig, here’s how to install it.

Method 1: Using APT Package Manager (Recommended)

APT is Debian’s main tool for handling software and the top choice for installing packages. Let’s install ifconfig:

Step 1: Update Package Repository

It’s always good to make sure your system knows about the newest available software before you install anything:

sudo apt update

You’ll need to install and type your password. For safety, what you type won’t show up.

Step 2: Install net-tools Package

Install net-tools, which has the ifconfig package:

sudo apt install net-tools

During installation:

  • APT will figure out what else needs to be installed
  • Show you what’s going to be installed on your system
  • Tell you how much space it’ll take

It’ll ask you to continue (press ‘Y’ and Enter to do so).

Step 3: Verify Installation

After it’s done, check if ifconfig works right:

ifconfig -a

This will list out info about your network connections.

You can verify the manual page that is given below:

man ifconfig

Method 2: Using DPKG Directly

DPKG is what APT is based on. This method means you download and install the package yourself.

Step 1: Download the net-tools Package

First, go to where you want the download:

cd ~/Downloads

Then get the package:

wget http://ftp.debian.org/debian/pool/main/n/net-tools/net-tools_2.10-0.1_amd64.deb

The exact version might change. If this one isn’t there, check the Debian package site at http://ftp.debian.org/debian/pool/main/n/net-tools/ for the latest one.

Step 2: Install the Downloaded Package

Install in the package with dpkg:

sudo dpkg -i net-tools_2.10-0.1_amd64.deb

Followed by the filename of the package.

Step 3: Resolve Dependencies (If Needed)

If dpkg shows any problems with missing parts, fix them with:

sudo apt -f install

This tells APT to fix any missing parts needed.

Step 4: Verify Installation

Check if ifconfig is installed and works:

ifconfig -a

Method 3: Building from Source Code

Making it from source lets you get the latest version and more control, but it needs more steps. Let’s install ifconfig:

Step 1: Install Build Dependencies

First, get the tools and libraries needed to make the code:

sudo apt install git gcc make libselinux1-dev

Step 2: Clone the Repository

Get the net-tools source code:

git clone https://github.com/ecki/net-tools

This makes a net-tools folder in your current spot with the source code.

Step 3: Navigate to the Source Directory

Go into the net-tools folder:

cd net-tools

Step 4: Configure the Build

Run the setup script:

./configure

This checks your system for needed parts and sets up the build config. You’ll get asked about turning on/off features. Most people just go with the defaults by hitting Enter.

Step 5: Compile the Source Code

Finally, compile the source code. Let’s make the package:

make

The make command follows the Makefile instructions to build the software.

Step 6: Install the Compiled Programs

Let’s install the software into the right system spots:

sudo make install

This installs the made files, including ifconfig, where they should go (usually /usr/local/bin or /usr/local/sbin).

Step 7: Verify Installation

Check if ifconfig is in and works:

ifconfig -a

The error “bash: ifconfig: command not found” happens because the net-tools package (which includes ifconfig) isn’t there by default on modern Debian (including Debian 12). You can fix it by following the Troubleshoot section.

Method 4: Using Snap Package Manager (Alternative)

If you like using containerized apps, you can install them in Snap and then use them for net-tools:

Step 1: Install Snap

First, get Snap if it’s not already there:

sudo apt install snapd

Step 2: Install Core Snap

Install the core part needed for Snap:

sudo snap install core

Step 3: Install net-tools via Snap

Though net-tools isn’t officially a Snap package, some third-party ones might include ifconfig. Look for them:

snap find net-tools

If you find a good one, install it:

sudo snap install package-name

Note: This method might not be as dependable since official Snap packages for net-tools might not be there.

Troubleshooting

If the command isn’t found, you might need to use the full path or add /usr/local/sbin to your PATH. If ifconfig is in but not found, it could be in /sbin/ifconfig, which isn’t in the standard $PATH for regular users. Fix it by:

export PATH=$PATH:/sbin

Command Not Found

If you still get “command not found” after installing it, try the below instructions:

Check if the binary exists:

ls -l /sbin/ifconfig

If it’s there but not in your PATH, use the full path:

/sbin/ifconfig

Or add /sbin to your PATH just for now:

export PATH=$PATH:/sbin

Permission Issues

If you get “permission denied”, you need to use sudo:

sudo ifconfig -a

That’s everything from the guide.

Conclusion

To install ifconfig on Debian 12, use the APT method to run sudo apt update && sudo apt install net-tools. Or, the DPKG method represents downloading the .deb file yourself and installing it with sudo dpkg -i net-tools_*.deb, then using sudo apt -f install to fix any missing parts.

For those who know more, making it from the source needs installing in build tools, getting the repository, and running ./configure, make, and sudo make install. But, newer Debian systems like using the ip command more than the old ifconfig, use ip addr for interface details, ip link for status, and ip route for routing. This method is better for the future. Let me know if you need more help.

Frequently Asked Questions

The ifconfig command is provided by the net-tools package.
Run sudo apt update && sudo apt install net-tools in the terminal.
Debian 12 uses ip from the iproute2 package by default; ifconfig is considered deprecated.
Yes, you can use ip a instead of ifconfig to view network interfaces.
net-tools is no longer actively maintained but is still available for compatibility.

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video