Solved ip - ifconfig - netplan - interfaces file

Solved issue

banderas20

Active Member
Joined
Aug 1, 2018
Messages
102
Reaction score
42
Credits
799
Hi!

I'm struggling to configure a quite simple network using Debian. I can't see the difference between using the following commands to set the networking parameters.

ip
ifconfig
netplan
/etc/network/interfaces file

When to use one or another?
Why so many tools for the same purpose?
Does any of them cause conflict with the other?

Thanks!
 


About 4 or 5 years ago, a lot of Linux distro's quit using something called networkd, and started using
something called NetworkManager. Unfortunately a lot of the "howto" and documentation out on the
internet hasn't really caught up yet.

The other problem, is that not all distro's do things the same way.

nmcli ( has hundreds of flags to use )
ip addr
route


... are newer commands.

ifconfig
/etc/sysconfig/network-scripts/ifcfg-(interface)


... are the older commands.

/etc/network/interfaces seems to be an Ubuntu thing, that directory doesn't exist on RPM based Linux's.

Most of the old commands will still work on newer distro's, but in reality, it's usually just wrapper scripts
that run the newer commands with flags to make the output look like the old commands.
 
Hi!

I'm struggling to configure a quite simple network using Debian. I can't see the difference between using the following commands to set the networking parameters.

ip
ifconfig
netplan
/etc/network/interfaces file

When to use one or another?
Why so many tools for the same purpose?
Does any of them cause conflict with the other?

Thanks!
This is linux live and colored. There are many ways to do the same things.
ifconfig is a part of the old iproute toolset of linux
ip is a part of the new iproute2 toolset of linux
netplan ,/etc/network/interfaces, networkmanager are ways to configure the system uses in backend mostly ip and ifconfig.
 
Networking in debian is explained to a large degree here:

Briefly, the ip command has supplanted the ifconfig command so using ip is the most useful approach to print networking output. The ip command is more flexible, provides a bit more information, and has an output format that is more conducive to scripting. It also works more efficiently in its execution because of the way it uses sockets.

The /etc/network/interfaces file is the configuration file for the ifupdown networking program on debian which is a relatively straight forward means of configuring common networking systems on computers with relatively few complications such as single computers, home networks and servers. NetworkManager is a more modern networking system and has a comprehensive GUI for the user and so is included in a lot of desktop environments, though it can be managed from the command line as well. It was pioneered by Red Hat so is used extensively in enterprise environments.

Of netplan, I can't say anything useful.

The other major networking system is systemd-networkd, which is being increasingly used in servers, but is equally suited for any other networking environment as well.

Normally a user uses only one networking program so that they won't conflict with each other. They each have their own configuration systems and files which are largely not compatible with each other and can play havoc with each other. There are a few grim tales about that online.

It's commonly said that the linux networking stack is one of the most robust networking frameworks in existence and runs systems from the smallest embedded hardware to supercomputers, and everything in between, which is hard to argue against.

The reason there are so many different tools for the one task is because different developers developed programs to manage different aspects in ways they thought were more conducive to their own needs. Once one has configured each different networking program, the differences become apparent, but they all cover the basic needs of network connectivity.

If one chooses one system, configures it according to one's needs, its reliability and performance is likely to be seamless and problem-free. In my own case, I've been using ifupdown for decades, quite a bit before NetworkManager hit the scene in a big way, and it's catered for all my networking needs and for small businesses and community organisations where I've set it up. YMMV.
 
Last edited:
Hi.

Thanks for the explanation. I tend to use only one tool to avoid conflicts.

I have seen however that some configuration is temporary and others are persistent. Depending on the tool you use.

¿What is the major difference between Network Manager and systemd-networkd?

Thanks again!
 
In relation to configuration, it's alterable in all networking programs and needs to be so as networking needs change with the addition and deletion of hardware, and changes in software. Actions such as adding an ethernet device, or a wifi dongle, usually require changes to configuration files.

In addition, software that changes, makes demands on the user to learn new commands, or deal with new GUI options. Think of the differences between the older ifconfig and newer ip commands.

Then there are configuration changes that the developers make in existing programs which the user's must adapt to. Change is very common.

In relation to temporary and persistent configuration, it depends partially on the use of the computer. NetworkManager, for example, may freely alter the /etc/resolv.conf. This quote notes this feature in its help texts:
By default, NetworkManager on Red Hat Enterprise Linux (RHEL) 8 dynamically updates the /etc/resolv.conf file with the DNS settings from active NetworkManager connection profiles.
The reason it does that is because users with laptops and other mobile computers interact with many different networks. As they change location, changing DNS servers in the /etc/resolv.conf file to optimally connect to the new networks, is a functionally superior way of making the network connection for the user.

On the other hand, a desktop computer that is largely stationary at home or in an office, and connects by wifi or ethernet to a router, usually never needs to change the /etc/resolv.conf file. Rather, the contents of the file usually include the IP address of the router which doesn't change. The router does the DNS work for it, so the configuration is persistent.

The changes in configuration files don't depend so much on the tool that is used, but on how the machine is used and what its needs are. The various tools that are used to configure the network perform the same end result. Basically, it's a text editor to alter file content, or a GUI that that makes the same alterations to those files through an extra layer of software for the user's convenience.

People who I interact with on these matters note the difference between using the GUI of NetworkManager and the more command line and text editing of systemd's networking files and those of ifupdown. They go either way on the matter. Although NetworkManager does have a command line editing facility as well as the GUI, they tend towards the GUI. I guess the "major" difference is a matter of opinion.

The example above of how the /etc/resolv.conf can be treated by NetworkManager is expanded upon here:

To get a feel for the differences in configuration styles of NetworkManager, systemd and ifupdown, (and some other programs as well) in the case of configuring a wifi device, this page may help:
 
Last edited:

Staff online

Members online


Top