ip vs ifconfig commands pros and consDifference between 'ifconfig' and 'ip' commandsifconfig showing invalid...
How can I mix up weapons for large groups of similar monsters/characters?
Should I choose Itemized or Standard deduction?
Where was Karl Mordo in Infinity War?
Can the SpaceX Dragon 2 crew vehicle still use the draco and super draco thrusters to slow down when landing?
F1 visa even for a three-week course?
How to prepare vegetables for a sandwich that can last for several days in a fridge?
Finding the number of integers that are a square and a cube at the same time
How to avoid being sexist when trying to employ someone to function in a very sexist environment?
If I delete my router's history can my ISP still provide it to my parents?
How to add multiple differently colored borders around a node?
How to approximate rolls for potions of healing using only d6's?
Wanted: 5.25 floppy to usb adapter
What did I do wrong that caused me to lose bitcoin?
Dilemma of explaining to interviewer that he is the reason for declining second interview
It took me a lot of time to make this, pls like. (YouTube Comments #1)
How do we edit a novel that's written by several people?
Is it a fallacy if someone claims they need an explanation for every word of your argument to the point where they don't understand common terms?
Does this pattern of summing polygonal numbers to get a square repeat indefinitely?
Can a person refuse a presidential pardon?
Do my Windows system binaries contain sensitive information?
How should I state my MS degree in my CV when it was in practice a joint-program?
Emit zero-width bash prompt sequence from external binary
Is my plan for fixing my water heater leak bad?
Has the Isbell–Freyd criterion ever been used to check that a category is concretisable?
ip vs ifconfig commands pros and cons
Difference between 'ifconfig' and 'ip' commandsifconfig showing invalid ip addressip-tools vs old ifconfigDifference between 'ifconfig' and 'ip' commandsifconfig command not foundifconfig made my server unreachableifconfig showing invalid ip addressRan ifconfig, everything formatted weird nowlinux + how to monitor dropping from ifconfig or ipifconfig down using ifconfig outputWhat does /sbin/ifconfig contain?ifconfig + device interruptErrors from ifconfig?
At some point, in some teaching material (from Linux Foundation) on Linux that I came across, the following is mentioned:
ipcommand is more versatile and more efficient thanifconfigbecause it uses netlink sockets rather than ioctl system calls.
Can anyone elaborate a bit on this because I cannot understand what's going on under the hood?
P.S. I am aware of this topic on those tools but it does not address this specific difference on how they operate
networking linux-kernel ip ifconfig
add a comment |
At some point, in some teaching material (from Linux Foundation) on Linux that I came across, the following is mentioned:
ipcommand is more versatile and more efficient thanifconfigbecause it uses netlink sockets rather than ioctl system calls.
Can anyone elaborate a bit on this because I cannot understand what's going on under the hood?
P.S. I am aware of this topic on those tools but it does not address this specific difference on how they operate
networking linux-kernel ip ifconfig
add a comment |
At some point, in some teaching material (from Linux Foundation) on Linux that I came across, the following is mentioned:
ipcommand is more versatile and more efficient thanifconfigbecause it uses netlink sockets rather than ioctl system calls.
Can anyone elaborate a bit on this because I cannot understand what's going on under the hood?
P.S. I am aware of this topic on those tools but it does not address this specific difference on how they operate
networking linux-kernel ip ifconfig
At some point, in some teaching material (from Linux Foundation) on Linux that I came across, the following is mentioned:
ipcommand is more versatile and more efficient thanifconfigbecause it uses netlink sockets rather than ioctl system calls.
Can anyone elaborate a bit on this because I cannot understand what's going on under the hood?
P.S. I am aware of this topic on those tools but it does not address this specific difference on how they operate
networking linux-kernel ip ifconfig
networking linux-kernel ip ifconfig
edited 13 hours ago
GAD3R
26.9k1756111
26.9k1756111
asked 17 hours ago
pkaramolpkaramol
604419
604419
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
The ifconfig command on operating systems such as FreeBSD and OpenBSD was updated in line with the rest of the operating system. It nowadays can configure all sorts of network interface settings on those operating systems, and handle a range of network protocols. The BSDs provide ioctl() support for these things.
This did not happen in the Linux world. There are, today, three ifconfig commands:
ifconfigfrom GNU inetutilsjdebp % inetutils-ifconfig -l
enp14s0 enp15s0 lo
jdebp % inetutils-ifconfig lo
lo Link encap:Local Loopback
inet addr:127.0.0.1 Bcast:0.0.0.0 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:9087 errors:0 dropped:0 overruns:0 frame:0
TX packets:9087 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:51214341 TX bytes:51214341
jdebp %
-
ifconfigfrom NET-3 net-toolsjdebp % ifconfig -l
ifconfig: option-l' not recognised.--help' gives usage information.
ifconfig:
jdebp % ifconfig lo
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
inet6 ::2 prefixlen 128 scopeid 0x80<compat,global>
inet6 fe80:: prefixlen 10 scopeid 0x20<link>
loop txqueuelen 1000 (Local Loopback)
RX packets 9087 bytes 51214341 (48.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9087 bytes 51214341 (48.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
jdebp %
-
ifconfigfrom (the next version of) the nosh toolsetjdebp % ifconfig -l
enp14s0 enp15s0 lo
jdebp % ifconfig lo
lo
link up loopback running
link address 00:00:00:00:00:00 bdaddr 00:00:00:00:00:00
inet4 address 127.0.0.1 prefixlen 8 bdaddr 127.0.0.1
inet4 address 127.53.0.1 prefixlen 8 bdaddr 127.255.255.255
inet6 address ::2 scope 0 prefixlen 128
inet6 address fe80:: scope 1 prefixlen 10
inet6 address ::1 scope 0 prefixlen 128
jdebp % sudo ifconfig lo inet4 127.1.0.2 alias
jdebp % sudo ifconfig lo inet6 ::3/128 alias
jdebp % ifconfig lo
lo
link up loopback running
link address 00:00:00:00:00:00 bdaddr 00:00:00:00:00:00
inet4 address 127.0.0.1 prefixlen 8 bdaddr 127.0.0.1
inet4 address 127.1.0.2 prefixlen 32 bdaddr 127.1.0.2
inet4 address 127.53.0.1 prefixlen 8 bdaddr 127.255.255.255
inet6 address ::3 scope 0 prefixlen 128
inet6 address ::2 scope 0 prefixlen 128
inet6 address fe80:: scope 1 prefixlen 10
inet6 address ::1 scope 0 prefixlen 128
jdebp %
As you can see, the GNU inetutils and NET-3 net-tools ifconfigs have some marked deficiencies, with respect to IPv6, with respect to interfaces that have multiple addresses, and with respect to functionality like -l.
The IPv6 problem is in part some missing code in the tools themselves. But in the main it is caused by the fact that Linux does not (as other operating systems do) provide IPv6 functionality through the ioctl() interface. It only lets programs see and manipulate IPv4 addresses through the networking ioctl()s.
Linux instead provides this functionality through a different interface, send() and recv() on a special, and somewhat odd, address family of sockets, AF_NETLINK.
The GNU and NET-3 ifconfigs could have been adjusted to use this new API. The argument against doing so was that it was not portable to other operating systems, but these programs were in practice already not portable anyway so that was not much of an argument.
But they weren't adjusted, and remain as aforeshown to this day. (Some people worked on them at various points over the years, but the improvements, sad to say, never made it into the programs. For example: Bernd Eckenfels never accepted a patch that added some netlink API capability to NET-3 net-tools ifconfig, 4 years after the patch had been written.)
Instead, some people completely reinvented the toolset as an ip command, which used the new Linux API, had a different syntax, and combined several other functions behind a fashionable command subcommand-style interface.
I needed an ifconfig that had the command-line syntax and output style of the FreeBSD ifconfig (which neither the GNU nor the NET-3 ifconfig has, and which ip most certainly does not have). So I wrote one. As proof that one could write an ifconfig that uses the netlink API on Linux, it does.
So the received wisdom about ifconfig, such as what you quote, is not really true any more. It is now untrue to say that "ifconfig does not use netlink.". The blanket that covered two does not cover three.
It has always been untrue to say that "netlink is more efficient". For the tasks that one does with ifconfig, there isn't really much in it when it comes to efficiency between the netlink API and the ioctl() API. One makes pretty much the same number of API calls for any given task.
Indeed, each API call is two system calls in the netlink case, as opposed to one in the ioctl() system. And arguably the netlink API has the disadvantage that on a heavily-used system it explicitly incorporates the possibility of the tool never receiving an acknowledgement message informing it of the result of the API call.
It is, furthermore, untrue to say that ip is "more versatile" than the GNU and NET-3 ifconfigs because it uses netlink. It is more versatile because it does more tasks, doing things in one big program that one would do with separate programs other than ifconfig. It is not more versatile simply by dint of the API that it uses internally for performing those extra tasks. There's nothing inherent to the API about this. One could write an all-in-one tool that used the FreeBSD ioctl() API, for example, and equally well state that it is "more versatile" than the individual ifconfig, route, arp, and ndp commands.
One could write route, arp, and ndp commands for Linux that used the netlink API, too.
Further reading
- Jonathan de Boyne Pollard (2019).
ifconfig. nosh Guide. Softwares. - Eduardo Ferro (2009-04-16). ifconfig: reports wrong ip address / initial patch. Debian bug #359676.
. I too prefer dealing with the bsd ifconfig versions. Updated slightly my answer on light of this excellent answer. +1
– Rui F Ribeiro
13 hours ago
I think you're reading too much into the "more versatile" claim. IMHO it only says that netlink is what makesipmore versatile, because all kinds of cool features are simply impossible to do using ioctls on Linux (because the ioctls are not there and likely will never be).
– TooTea
1 hour ago
"netlink is what makes ip more versatile" is the same as "ip is more versatile because it uses netlink", which is right there in the question.
– JdeBP
29 mins ago
add a comment |
The standard ifconfig we have in many distributions is deprecated for several reasons. Talks in a outdated and limited way with the kernel, and in fact, does not understand anymore all the network configurations. You won't be able to manipulate some network configurations such ifconfig versions that you are able to do with ip. In addition, the ifconfig support for network namespaces is limited.
As an anecdotal tale, I found interface IP alias that are only visible in ip and not in SuSE ifconfig.
As for the differences under the hood: From ifconfig vs ip: What’s Difference and Comparing Network Configuration
Although
ipmight seem a bit complex at first site but it is much
broader in functionality than ifconfig. It is functionally organized
on two layers of Networking Stack i.e. Layer 2 (Link Layer), Layer 3
(IP Layer) and does the work of all the above mentioned commands from
net-tools package.
While
ifconfigmostly displays or modifies the interfaces of a system,
this command is capable of doing following tasks:
Displaying or Modifying Interface properties.
Adding, Removing ARP Cache entries along creating new Static ARP entry
for a host.
Displaying MAC addresses associated with all the interfaces.
Displaying and modifying kernel routing tables.
One of the main highlight which separates it from its ancient
counterpart ifconfig is that latter uses ioctl for network
configuration, which is a less appreciated way of interaction with
kernel while former takes advantage of netlink socket mechanism for
the same which is a much more flexible successor of ioctl for
inter-communication between kernel and user space using rtnetlink
(which adds networking environment manipulation capability).
About the use/advantages of netlink: From LJ - Kernel Korner - Why and How to Use Netlink Socket
Netlink socket is a special IPC used for transferring information
between kernel and user-space processes. It provides a full-duplex
communication link between the two by way of standard socket APIs for
user-space processes and a special kernel API for kernel modules.
Netlink socket uses the address family AF_NETLINK.
.....
Why do the above features use netlink instead of system calls, ioctls
or proc filesystems for communication between user and kernel worlds?
It is a nontrivial task to add system calls, ioctls or proc files for
new features; we risk polluting the kernel and damaging the stability
of the system. Netlink socket is simple, though: only a constant, the
protocol type, needs to be added to netlink.h. Then, the kernel module
and application can talk using socket-style APIs immediately.
....
Netlink socket is a flexible interface for communication between
user-space applications and kernel modules. It provides an easy-to-use
socket API to both applications and the kernel. It provides advanced
communication features, such as full-duplex, buffered I/O, multicast
and asynchronous communication, which are absent in other
kernel/user-space IPCs.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504063%2fip-vs-ifconfig-commands-pros-and-cons%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The ifconfig command on operating systems such as FreeBSD and OpenBSD was updated in line with the rest of the operating system. It nowadays can configure all sorts of network interface settings on those operating systems, and handle a range of network protocols. The BSDs provide ioctl() support for these things.
This did not happen in the Linux world. There are, today, three ifconfig commands:
ifconfigfrom GNU inetutilsjdebp % inetutils-ifconfig -l
enp14s0 enp15s0 lo
jdebp % inetutils-ifconfig lo
lo Link encap:Local Loopback
inet addr:127.0.0.1 Bcast:0.0.0.0 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:9087 errors:0 dropped:0 overruns:0 frame:0
TX packets:9087 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:51214341 TX bytes:51214341
jdebp %
-
ifconfigfrom NET-3 net-toolsjdebp % ifconfig -l
ifconfig: option-l' not recognised.--help' gives usage information.
ifconfig:
jdebp % ifconfig lo
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
inet6 ::2 prefixlen 128 scopeid 0x80<compat,global>
inet6 fe80:: prefixlen 10 scopeid 0x20<link>
loop txqueuelen 1000 (Local Loopback)
RX packets 9087 bytes 51214341 (48.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9087 bytes 51214341 (48.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
jdebp %
-
ifconfigfrom (the next version of) the nosh toolsetjdebp % ifconfig -l
enp14s0 enp15s0 lo
jdebp % ifconfig lo
lo
link up loopback running
link address 00:00:00:00:00:00 bdaddr 00:00:00:00:00:00
inet4 address 127.0.0.1 prefixlen 8 bdaddr 127.0.0.1
inet4 address 127.53.0.1 prefixlen 8 bdaddr 127.255.255.255
inet6 address ::2 scope 0 prefixlen 128
inet6 address fe80:: scope 1 prefixlen 10
inet6 address ::1 scope 0 prefixlen 128
jdebp % sudo ifconfig lo inet4 127.1.0.2 alias
jdebp % sudo ifconfig lo inet6 ::3/128 alias
jdebp % ifconfig lo
lo
link up loopback running
link address 00:00:00:00:00:00 bdaddr 00:00:00:00:00:00
inet4 address 127.0.0.1 prefixlen 8 bdaddr 127.0.0.1
inet4 address 127.1.0.2 prefixlen 32 bdaddr 127.1.0.2
inet4 address 127.53.0.1 prefixlen 8 bdaddr 127.255.255.255
inet6 address ::3 scope 0 prefixlen 128
inet6 address ::2 scope 0 prefixlen 128
inet6 address fe80:: scope 1 prefixlen 10
inet6 address ::1 scope 0 prefixlen 128
jdebp %
As you can see, the GNU inetutils and NET-3 net-tools ifconfigs have some marked deficiencies, with respect to IPv6, with respect to interfaces that have multiple addresses, and with respect to functionality like -l.
The IPv6 problem is in part some missing code in the tools themselves. But in the main it is caused by the fact that Linux does not (as other operating systems do) provide IPv6 functionality through the ioctl() interface. It only lets programs see and manipulate IPv4 addresses through the networking ioctl()s.
Linux instead provides this functionality through a different interface, send() and recv() on a special, and somewhat odd, address family of sockets, AF_NETLINK.
The GNU and NET-3 ifconfigs could have been adjusted to use this new API. The argument against doing so was that it was not portable to other operating systems, but these programs were in practice already not portable anyway so that was not much of an argument.
But they weren't adjusted, and remain as aforeshown to this day. (Some people worked on them at various points over the years, but the improvements, sad to say, never made it into the programs. For example: Bernd Eckenfels never accepted a patch that added some netlink API capability to NET-3 net-tools ifconfig, 4 years after the patch had been written.)
Instead, some people completely reinvented the toolset as an ip command, which used the new Linux API, had a different syntax, and combined several other functions behind a fashionable command subcommand-style interface.
I needed an ifconfig that had the command-line syntax and output style of the FreeBSD ifconfig (which neither the GNU nor the NET-3 ifconfig has, and which ip most certainly does not have). So I wrote one. As proof that one could write an ifconfig that uses the netlink API on Linux, it does.
So the received wisdom about ifconfig, such as what you quote, is not really true any more. It is now untrue to say that "ifconfig does not use netlink.". The blanket that covered two does not cover three.
It has always been untrue to say that "netlink is more efficient". For the tasks that one does with ifconfig, there isn't really much in it when it comes to efficiency between the netlink API and the ioctl() API. One makes pretty much the same number of API calls for any given task.
Indeed, each API call is two system calls in the netlink case, as opposed to one in the ioctl() system. And arguably the netlink API has the disadvantage that on a heavily-used system it explicitly incorporates the possibility of the tool never receiving an acknowledgement message informing it of the result of the API call.
It is, furthermore, untrue to say that ip is "more versatile" than the GNU and NET-3 ifconfigs because it uses netlink. It is more versatile because it does more tasks, doing things in one big program that one would do with separate programs other than ifconfig. It is not more versatile simply by dint of the API that it uses internally for performing those extra tasks. There's nothing inherent to the API about this. One could write an all-in-one tool that used the FreeBSD ioctl() API, for example, and equally well state that it is "more versatile" than the individual ifconfig, route, arp, and ndp commands.
One could write route, arp, and ndp commands for Linux that used the netlink API, too.
Further reading
- Jonathan de Boyne Pollard (2019).
ifconfig. nosh Guide. Softwares. - Eduardo Ferro (2009-04-16). ifconfig: reports wrong ip address / initial patch. Debian bug #359676.
. I too prefer dealing with the bsd ifconfig versions. Updated slightly my answer on light of this excellent answer. +1
– Rui F Ribeiro
13 hours ago
I think you're reading too much into the "more versatile" claim. IMHO it only says that netlink is what makesipmore versatile, because all kinds of cool features are simply impossible to do using ioctls on Linux (because the ioctls are not there and likely will never be).
– TooTea
1 hour ago
"netlink is what makes ip more versatile" is the same as "ip is more versatile because it uses netlink", which is right there in the question.
– JdeBP
29 mins ago
add a comment |
The ifconfig command on operating systems such as FreeBSD and OpenBSD was updated in line with the rest of the operating system. It nowadays can configure all sorts of network interface settings on those operating systems, and handle a range of network protocols. The BSDs provide ioctl() support for these things.
This did not happen in the Linux world. There are, today, three ifconfig commands:
ifconfigfrom GNU inetutilsjdebp % inetutils-ifconfig -l
enp14s0 enp15s0 lo
jdebp % inetutils-ifconfig lo
lo Link encap:Local Loopback
inet addr:127.0.0.1 Bcast:0.0.0.0 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:9087 errors:0 dropped:0 overruns:0 frame:0
TX packets:9087 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:51214341 TX bytes:51214341
jdebp %
-
ifconfigfrom NET-3 net-toolsjdebp % ifconfig -l
ifconfig: option-l' not recognised.--help' gives usage information.
ifconfig:
jdebp % ifconfig lo
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
inet6 ::2 prefixlen 128 scopeid 0x80<compat,global>
inet6 fe80:: prefixlen 10 scopeid 0x20<link>
loop txqueuelen 1000 (Local Loopback)
RX packets 9087 bytes 51214341 (48.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9087 bytes 51214341 (48.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
jdebp %
-
ifconfigfrom (the next version of) the nosh toolsetjdebp % ifconfig -l
enp14s0 enp15s0 lo
jdebp % ifconfig lo
lo
link up loopback running
link address 00:00:00:00:00:00 bdaddr 00:00:00:00:00:00
inet4 address 127.0.0.1 prefixlen 8 bdaddr 127.0.0.1
inet4 address 127.53.0.1 prefixlen 8 bdaddr 127.255.255.255
inet6 address ::2 scope 0 prefixlen 128
inet6 address fe80:: scope 1 prefixlen 10
inet6 address ::1 scope 0 prefixlen 128
jdebp % sudo ifconfig lo inet4 127.1.0.2 alias
jdebp % sudo ifconfig lo inet6 ::3/128 alias
jdebp % ifconfig lo
lo
link up loopback running
link address 00:00:00:00:00:00 bdaddr 00:00:00:00:00:00
inet4 address 127.0.0.1 prefixlen 8 bdaddr 127.0.0.1
inet4 address 127.1.0.2 prefixlen 32 bdaddr 127.1.0.2
inet4 address 127.53.0.1 prefixlen 8 bdaddr 127.255.255.255
inet6 address ::3 scope 0 prefixlen 128
inet6 address ::2 scope 0 prefixlen 128
inet6 address fe80:: scope 1 prefixlen 10
inet6 address ::1 scope 0 prefixlen 128
jdebp %
As you can see, the GNU inetutils and NET-3 net-tools ifconfigs have some marked deficiencies, with respect to IPv6, with respect to interfaces that have multiple addresses, and with respect to functionality like -l.
The IPv6 problem is in part some missing code in the tools themselves. But in the main it is caused by the fact that Linux does not (as other operating systems do) provide IPv6 functionality through the ioctl() interface. It only lets programs see and manipulate IPv4 addresses through the networking ioctl()s.
Linux instead provides this functionality through a different interface, send() and recv() on a special, and somewhat odd, address family of sockets, AF_NETLINK.
The GNU and NET-3 ifconfigs could have been adjusted to use this new API. The argument against doing so was that it was not portable to other operating systems, but these programs were in practice already not portable anyway so that was not much of an argument.
But they weren't adjusted, and remain as aforeshown to this day. (Some people worked on them at various points over the years, but the improvements, sad to say, never made it into the programs. For example: Bernd Eckenfels never accepted a patch that added some netlink API capability to NET-3 net-tools ifconfig, 4 years after the patch had been written.)
Instead, some people completely reinvented the toolset as an ip command, which used the new Linux API, had a different syntax, and combined several other functions behind a fashionable command subcommand-style interface.
I needed an ifconfig that had the command-line syntax and output style of the FreeBSD ifconfig (which neither the GNU nor the NET-3 ifconfig has, and which ip most certainly does not have). So I wrote one. As proof that one could write an ifconfig that uses the netlink API on Linux, it does.
So the received wisdom about ifconfig, such as what you quote, is not really true any more. It is now untrue to say that "ifconfig does not use netlink.". The blanket that covered two does not cover three.
It has always been untrue to say that "netlink is more efficient". For the tasks that one does with ifconfig, there isn't really much in it when it comes to efficiency between the netlink API and the ioctl() API. One makes pretty much the same number of API calls for any given task.
Indeed, each API call is two system calls in the netlink case, as opposed to one in the ioctl() system. And arguably the netlink API has the disadvantage that on a heavily-used system it explicitly incorporates the possibility of the tool never receiving an acknowledgement message informing it of the result of the API call.
It is, furthermore, untrue to say that ip is "more versatile" than the GNU and NET-3 ifconfigs because it uses netlink. It is more versatile because it does more tasks, doing things in one big program that one would do with separate programs other than ifconfig. It is not more versatile simply by dint of the API that it uses internally for performing those extra tasks. There's nothing inherent to the API about this. One could write an all-in-one tool that used the FreeBSD ioctl() API, for example, and equally well state that it is "more versatile" than the individual ifconfig, route, arp, and ndp commands.
One could write route, arp, and ndp commands for Linux that used the netlink API, too.
Further reading
- Jonathan de Boyne Pollard (2019).
ifconfig. nosh Guide. Softwares. - Eduardo Ferro (2009-04-16). ifconfig: reports wrong ip address / initial patch. Debian bug #359676.
. I too prefer dealing with the bsd ifconfig versions. Updated slightly my answer on light of this excellent answer. +1
– Rui F Ribeiro
13 hours ago
I think you're reading too much into the "more versatile" claim. IMHO it only says that netlink is what makesipmore versatile, because all kinds of cool features are simply impossible to do using ioctls on Linux (because the ioctls are not there and likely will never be).
– TooTea
1 hour ago
"netlink is what makes ip more versatile" is the same as "ip is more versatile because it uses netlink", which is right there in the question.
– JdeBP
29 mins ago
add a comment |
The ifconfig command on operating systems such as FreeBSD and OpenBSD was updated in line with the rest of the operating system. It nowadays can configure all sorts of network interface settings on those operating systems, and handle a range of network protocols. The BSDs provide ioctl() support for these things.
This did not happen in the Linux world. There are, today, three ifconfig commands:
ifconfigfrom GNU inetutilsjdebp % inetutils-ifconfig -l
enp14s0 enp15s0 lo
jdebp % inetutils-ifconfig lo
lo Link encap:Local Loopback
inet addr:127.0.0.1 Bcast:0.0.0.0 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:9087 errors:0 dropped:0 overruns:0 frame:0
TX packets:9087 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:51214341 TX bytes:51214341
jdebp %
-
ifconfigfrom NET-3 net-toolsjdebp % ifconfig -l
ifconfig: option-l' not recognised.--help' gives usage information.
ifconfig:
jdebp % ifconfig lo
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
inet6 ::2 prefixlen 128 scopeid 0x80<compat,global>
inet6 fe80:: prefixlen 10 scopeid 0x20<link>
loop txqueuelen 1000 (Local Loopback)
RX packets 9087 bytes 51214341 (48.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9087 bytes 51214341 (48.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
jdebp %
-
ifconfigfrom (the next version of) the nosh toolsetjdebp % ifconfig -l
enp14s0 enp15s0 lo
jdebp % ifconfig lo
lo
link up loopback running
link address 00:00:00:00:00:00 bdaddr 00:00:00:00:00:00
inet4 address 127.0.0.1 prefixlen 8 bdaddr 127.0.0.1
inet4 address 127.53.0.1 prefixlen 8 bdaddr 127.255.255.255
inet6 address ::2 scope 0 prefixlen 128
inet6 address fe80:: scope 1 prefixlen 10
inet6 address ::1 scope 0 prefixlen 128
jdebp % sudo ifconfig lo inet4 127.1.0.2 alias
jdebp % sudo ifconfig lo inet6 ::3/128 alias
jdebp % ifconfig lo
lo
link up loopback running
link address 00:00:00:00:00:00 bdaddr 00:00:00:00:00:00
inet4 address 127.0.0.1 prefixlen 8 bdaddr 127.0.0.1
inet4 address 127.1.0.2 prefixlen 32 bdaddr 127.1.0.2
inet4 address 127.53.0.1 prefixlen 8 bdaddr 127.255.255.255
inet6 address ::3 scope 0 prefixlen 128
inet6 address ::2 scope 0 prefixlen 128
inet6 address fe80:: scope 1 prefixlen 10
inet6 address ::1 scope 0 prefixlen 128
jdebp %
As you can see, the GNU inetutils and NET-3 net-tools ifconfigs have some marked deficiencies, with respect to IPv6, with respect to interfaces that have multiple addresses, and with respect to functionality like -l.
The IPv6 problem is in part some missing code in the tools themselves. But in the main it is caused by the fact that Linux does not (as other operating systems do) provide IPv6 functionality through the ioctl() interface. It only lets programs see and manipulate IPv4 addresses through the networking ioctl()s.
Linux instead provides this functionality through a different interface, send() and recv() on a special, and somewhat odd, address family of sockets, AF_NETLINK.
The GNU and NET-3 ifconfigs could have been adjusted to use this new API. The argument against doing so was that it was not portable to other operating systems, but these programs were in practice already not portable anyway so that was not much of an argument.
But they weren't adjusted, and remain as aforeshown to this day. (Some people worked on them at various points over the years, but the improvements, sad to say, never made it into the programs. For example: Bernd Eckenfels never accepted a patch that added some netlink API capability to NET-3 net-tools ifconfig, 4 years after the patch had been written.)
Instead, some people completely reinvented the toolset as an ip command, which used the new Linux API, had a different syntax, and combined several other functions behind a fashionable command subcommand-style interface.
I needed an ifconfig that had the command-line syntax and output style of the FreeBSD ifconfig (which neither the GNU nor the NET-3 ifconfig has, and which ip most certainly does not have). So I wrote one. As proof that one could write an ifconfig that uses the netlink API on Linux, it does.
So the received wisdom about ifconfig, such as what you quote, is not really true any more. It is now untrue to say that "ifconfig does not use netlink.". The blanket that covered two does not cover three.
It has always been untrue to say that "netlink is more efficient". For the tasks that one does with ifconfig, there isn't really much in it when it comes to efficiency between the netlink API and the ioctl() API. One makes pretty much the same number of API calls for any given task.
Indeed, each API call is two system calls in the netlink case, as opposed to one in the ioctl() system. And arguably the netlink API has the disadvantage that on a heavily-used system it explicitly incorporates the possibility of the tool never receiving an acknowledgement message informing it of the result of the API call.
It is, furthermore, untrue to say that ip is "more versatile" than the GNU and NET-3 ifconfigs because it uses netlink. It is more versatile because it does more tasks, doing things in one big program that one would do with separate programs other than ifconfig. It is not more versatile simply by dint of the API that it uses internally for performing those extra tasks. There's nothing inherent to the API about this. One could write an all-in-one tool that used the FreeBSD ioctl() API, for example, and equally well state that it is "more versatile" than the individual ifconfig, route, arp, and ndp commands.
One could write route, arp, and ndp commands for Linux that used the netlink API, too.
Further reading
- Jonathan de Boyne Pollard (2019).
ifconfig. nosh Guide. Softwares. - Eduardo Ferro (2009-04-16). ifconfig: reports wrong ip address / initial patch. Debian bug #359676.
The ifconfig command on operating systems such as FreeBSD and OpenBSD was updated in line with the rest of the operating system. It nowadays can configure all sorts of network interface settings on those operating systems, and handle a range of network protocols. The BSDs provide ioctl() support for these things.
This did not happen in the Linux world. There are, today, three ifconfig commands:
ifconfigfrom GNU inetutilsjdebp % inetutils-ifconfig -l
enp14s0 enp15s0 lo
jdebp % inetutils-ifconfig lo
lo Link encap:Local Loopback
inet addr:127.0.0.1 Bcast:0.0.0.0 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:9087 errors:0 dropped:0 overruns:0 frame:0
TX packets:9087 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:51214341 TX bytes:51214341
jdebp %
-
ifconfigfrom NET-3 net-toolsjdebp % ifconfig -l
ifconfig: option-l' not recognised.--help' gives usage information.
ifconfig:
jdebp % ifconfig lo
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
inet6 ::2 prefixlen 128 scopeid 0x80<compat,global>
inet6 fe80:: prefixlen 10 scopeid 0x20<link>
loop txqueuelen 1000 (Local Loopback)
RX packets 9087 bytes 51214341 (48.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 9087 bytes 51214341 (48.8 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
jdebp %
-
ifconfigfrom (the next version of) the nosh toolsetjdebp % ifconfig -l
enp14s0 enp15s0 lo
jdebp % ifconfig lo
lo
link up loopback running
link address 00:00:00:00:00:00 bdaddr 00:00:00:00:00:00
inet4 address 127.0.0.1 prefixlen 8 bdaddr 127.0.0.1
inet4 address 127.53.0.1 prefixlen 8 bdaddr 127.255.255.255
inet6 address ::2 scope 0 prefixlen 128
inet6 address fe80:: scope 1 prefixlen 10
inet6 address ::1 scope 0 prefixlen 128
jdebp % sudo ifconfig lo inet4 127.1.0.2 alias
jdebp % sudo ifconfig lo inet6 ::3/128 alias
jdebp % ifconfig lo
lo
link up loopback running
link address 00:00:00:00:00:00 bdaddr 00:00:00:00:00:00
inet4 address 127.0.0.1 prefixlen 8 bdaddr 127.0.0.1
inet4 address 127.1.0.2 prefixlen 32 bdaddr 127.1.0.2
inet4 address 127.53.0.1 prefixlen 8 bdaddr 127.255.255.255
inet6 address ::3 scope 0 prefixlen 128
inet6 address ::2 scope 0 prefixlen 128
inet6 address fe80:: scope 1 prefixlen 10
inet6 address ::1 scope 0 prefixlen 128
jdebp %
As you can see, the GNU inetutils and NET-3 net-tools ifconfigs have some marked deficiencies, with respect to IPv6, with respect to interfaces that have multiple addresses, and with respect to functionality like -l.
The IPv6 problem is in part some missing code in the tools themselves. But in the main it is caused by the fact that Linux does not (as other operating systems do) provide IPv6 functionality through the ioctl() interface. It only lets programs see and manipulate IPv4 addresses through the networking ioctl()s.
Linux instead provides this functionality through a different interface, send() and recv() on a special, and somewhat odd, address family of sockets, AF_NETLINK.
The GNU and NET-3 ifconfigs could have been adjusted to use this new API. The argument against doing so was that it was not portable to other operating systems, but these programs were in practice already not portable anyway so that was not much of an argument.
But they weren't adjusted, and remain as aforeshown to this day. (Some people worked on them at various points over the years, but the improvements, sad to say, never made it into the programs. For example: Bernd Eckenfels never accepted a patch that added some netlink API capability to NET-3 net-tools ifconfig, 4 years after the patch had been written.)
Instead, some people completely reinvented the toolset as an ip command, which used the new Linux API, had a different syntax, and combined several other functions behind a fashionable command subcommand-style interface.
I needed an ifconfig that had the command-line syntax and output style of the FreeBSD ifconfig (which neither the GNU nor the NET-3 ifconfig has, and which ip most certainly does not have). So I wrote one. As proof that one could write an ifconfig that uses the netlink API on Linux, it does.
So the received wisdom about ifconfig, such as what you quote, is not really true any more. It is now untrue to say that "ifconfig does not use netlink.". The blanket that covered two does not cover three.
It has always been untrue to say that "netlink is more efficient". For the tasks that one does with ifconfig, there isn't really much in it when it comes to efficiency between the netlink API and the ioctl() API. One makes pretty much the same number of API calls for any given task.
Indeed, each API call is two system calls in the netlink case, as opposed to one in the ioctl() system. And arguably the netlink API has the disadvantage that on a heavily-used system it explicitly incorporates the possibility of the tool never receiving an acknowledgement message informing it of the result of the API call.
It is, furthermore, untrue to say that ip is "more versatile" than the GNU and NET-3 ifconfigs because it uses netlink. It is more versatile because it does more tasks, doing things in one big program that one would do with separate programs other than ifconfig. It is not more versatile simply by dint of the API that it uses internally for performing those extra tasks. There's nothing inherent to the API about this. One could write an all-in-one tool that used the FreeBSD ioctl() API, for example, and equally well state that it is "more versatile" than the individual ifconfig, route, arp, and ndp commands.
One could write route, arp, and ndp commands for Linux that used the netlink API, too.
Further reading
- Jonathan de Boyne Pollard (2019).
ifconfig. nosh Guide. Softwares. - Eduardo Ferro (2009-04-16). ifconfig: reports wrong ip address / initial patch. Debian bug #359676.
answered 13 hours ago
JdeBPJdeBP
35.6k472169
35.6k472169
. I too prefer dealing with the bsd ifconfig versions. Updated slightly my answer on light of this excellent answer. +1
– Rui F Ribeiro
13 hours ago
I think you're reading too much into the "more versatile" claim. IMHO it only says that netlink is what makesipmore versatile, because all kinds of cool features are simply impossible to do using ioctls on Linux (because the ioctls are not there and likely will never be).
– TooTea
1 hour ago
"netlink is what makes ip more versatile" is the same as "ip is more versatile because it uses netlink", which is right there in the question.
– JdeBP
29 mins ago
add a comment |
. I too prefer dealing with the bsd ifconfig versions. Updated slightly my answer on light of this excellent answer. +1
– Rui F Ribeiro
13 hours ago
I think you're reading too much into the "more versatile" claim. IMHO it only says that netlink is what makesipmore versatile, because all kinds of cool features are simply impossible to do using ioctls on Linux (because the ioctls are not there and likely will never be).
– TooTea
1 hour ago
"netlink is what makes ip more versatile" is the same as "ip is more versatile because it uses netlink", which is right there in the question.
– JdeBP
29 mins ago
. I too prefer dealing with the bsd ifconfig versions. Updated slightly my answer on light of this excellent answer. +1
– Rui F Ribeiro
13 hours ago
. I too prefer dealing with the bsd ifconfig versions. Updated slightly my answer on light of this excellent answer. +1
– Rui F Ribeiro
13 hours ago
I think you're reading too much into the "more versatile" claim. IMHO it only says that netlink is what makes
ip more versatile, because all kinds of cool features are simply impossible to do using ioctls on Linux (because the ioctls are not there and likely will never be).– TooTea
1 hour ago
I think you're reading too much into the "more versatile" claim. IMHO it only says that netlink is what makes
ip more versatile, because all kinds of cool features are simply impossible to do using ioctls on Linux (because the ioctls are not there and likely will never be).– TooTea
1 hour ago
"netlink is what makes ip more versatile" is the same as "ip is more versatile because it uses netlink", which is right there in the question.
– JdeBP
29 mins ago
"netlink is what makes ip more versatile" is the same as "ip is more versatile because it uses netlink", which is right there in the question.
– JdeBP
29 mins ago
add a comment |
The standard ifconfig we have in many distributions is deprecated for several reasons. Talks in a outdated and limited way with the kernel, and in fact, does not understand anymore all the network configurations. You won't be able to manipulate some network configurations such ifconfig versions that you are able to do with ip. In addition, the ifconfig support for network namespaces is limited.
As an anecdotal tale, I found interface IP alias that are only visible in ip and not in SuSE ifconfig.
As for the differences under the hood: From ifconfig vs ip: What’s Difference and Comparing Network Configuration
Although
ipmight seem a bit complex at first site but it is much
broader in functionality than ifconfig. It is functionally organized
on two layers of Networking Stack i.e. Layer 2 (Link Layer), Layer 3
(IP Layer) and does the work of all the above mentioned commands from
net-tools package.
While
ifconfigmostly displays or modifies the interfaces of a system,
this command is capable of doing following tasks:
Displaying or Modifying Interface properties.
Adding, Removing ARP Cache entries along creating new Static ARP entry
for a host.
Displaying MAC addresses associated with all the interfaces.
Displaying and modifying kernel routing tables.
One of the main highlight which separates it from its ancient
counterpart ifconfig is that latter uses ioctl for network
configuration, which is a less appreciated way of interaction with
kernel while former takes advantage of netlink socket mechanism for
the same which is a much more flexible successor of ioctl for
inter-communication between kernel and user space using rtnetlink
(which adds networking environment manipulation capability).
About the use/advantages of netlink: From LJ - Kernel Korner - Why and How to Use Netlink Socket
Netlink socket is a special IPC used for transferring information
between kernel and user-space processes. It provides a full-duplex
communication link between the two by way of standard socket APIs for
user-space processes and a special kernel API for kernel modules.
Netlink socket uses the address family AF_NETLINK.
.....
Why do the above features use netlink instead of system calls, ioctls
or proc filesystems for communication between user and kernel worlds?
It is a nontrivial task to add system calls, ioctls or proc files for
new features; we risk polluting the kernel and damaging the stability
of the system. Netlink socket is simple, though: only a constant, the
protocol type, needs to be added to netlink.h. Then, the kernel module
and application can talk using socket-style APIs immediately.
....
Netlink socket is a flexible interface for communication between
user-space applications and kernel modules. It provides an easy-to-use
socket API to both applications and the kernel. It provides advanced
communication features, such as full-duplex, buffered I/O, multicast
and asynchronous communication, which are absent in other
kernel/user-space IPCs.
add a comment |
The standard ifconfig we have in many distributions is deprecated for several reasons. Talks in a outdated and limited way with the kernel, and in fact, does not understand anymore all the network configurations. You won't be able to manipulate some network configurations such ifconfig versions that you are able to do with ip. In addition, the ifconfig support for network namespaces is limited.
As an anecdotal tale, I found interface IP alias that are only visible in ip and not in SuSE ifconfig.
As for the differences under the hood: From ifconfig vs ip: What’s Difference and Comparing Network Configuration
Although
ipmight seem a bit complex at first site but it is much
broader in functionality than ifconfig. It is functionally organized
on two layers of Networking Stack i.e. Layer 2 (Link Layer), Layer 3
(IP Layer) and does the work of all the above mentioned commands from
net-tools package.
While
ifconfigmostly displays or modifies the interfaces of a system,
this command is capable of doing following tasks:
Displaying or Modifying Interface properties.
Adding, Removing ARP Cache entries along creating new Static ARP entry
for a host.
Displaying MAC addresses associated with all the interfaces.
Displaying and modifying kernel routing tables.
One of the main highlight which separates it from its ancient
counterpart ifconfig is that latter uses ioctl for network
configuration, which is a less appreciated way of interaction with
kernel while former takes advantage of netlink socket mechanism for
the same which is a much more flexible successor of ioctl for
inter-communication between kernel and user space using rtnetlink
(which adds networking environment manipulation capability).
About the use/advantages of netlink: From LJ - Kernel Korner - Why and How to Use Netlink Socket
Netlink socket is a special IPC used for transferring information
between kernel and user-space processes. It provides a full-duplex
communication link between the two by way of standard socket APIs for
user-space processes and a special kernel API for kernel modules.
Netlink socket uses the address family AF_NETLINK.
.....
Why do the above features use netlink instead of system calls, ioctls
or proc filesystems for communication between user and kernel worlds?
It is a nontrivial task to add system calls, ioctls or proc files for
new features; we risk polluting the kernel and damaging the stability
of the system. Netlink socket is simple, though: only a constant, the
protocol type, needs to be added to netlink.h. Then, the kernel module
and application can talk using socket-style APIs immediately.
....
Netlink socket is a flexible interface for communication between
user-space applications and kernel modules. It provides an easy-to-use
socket API to both applications and the kernel. It provides advanced
communication features, such as full-duplex, buffered I/O, multicast
and asynchronous communication, which are absent in other
kernel/user-space IPCs.
add a comment |
The standard ifconfig we have in many distributions is deprecated for several reasons. Talks in a outdated and limited way with the kernel, and in fact, does not understand anymore all the network configurations. You won't be able to manipulate some network configurations such ifconfig versions that you are able to do with ip. In addition, the ifconfig support for network namespaces is limited.
As an anecdotal tale, I found interface IP alias that are only visible in ip and not in SuSE ifconfig.
As for the differences under the hood: From ifconfig vs ip: What’s Difference and Comparing Network Configuration
Although
ipmight seem a bit complex at first site but it is much
broader in functionality than ifconfig. It is functionally organized
on two layers of Networking Stack i.e. Layer 2 (Link Layer), Layer 3
(IP Layer) and does the work of all the above mentioned commands from
net-tools package.
While
ifconfigmostly displays or modifies the interfaces of a system,
this command is capable of doing following tasks:
Displaying or Modifying Interface properties.
Adding, Removing ARP Cache entries along creating new Static ARP entry
for a host.
Displaying MAC addresses associated with all the interfaces.
Displaying and modifying kernel routing tables.
One of the main highlight which separates it from its ancient
counterpart ifconfig is that latter uses ioctl for network
configuration, which is a less appreciated way of interaction with
kernel while former takes advantage of netlink socket mechanism for
the same which is a much more flexible successor of ioctl for
inter-communication between kernel and user space using rtnetlink
(which adds networking environment manipulation capability).
About the use/advantages of netlink: From LJ - Kernel Korner - Why and How to Use Netlink Socket
Netlink socket is a special IPC used for transferring information
between kernel and user-space processes. It provides a full-duplex
communication link between the two by way of standard socket APIs for
user-space processes and a special kernel API for kernel modules.
Netlink socket uses the address family AF_NETLINK.
.....
Why do the above features use netlink instead of system calls, ioctls
or proc filesystems for communication between user and kernel worlds?
It is a nontrivial task to add system calls, ioctls or proc files for
new features; we risk polluting the kernel and damaging the stability
of the system. Netlink socket is simple, though: only a constant, the
protocol type, needs to be added to netlink.h. Then, the kernel module
and application can talk using socket-style APIs immediately.
....
Netlink socket is a flexible interface for communication between
user-space applications and kernel modules. It provides an easy-to-use
socket API to both applications and the kernel. It provides advanced
communication features, such as full-duplex, buffered I/O, multicast
and asynchronous communication, which are absent in other
kernel/user-space IPCs.
The standard ifconfig we have in many distributions is deprecated for several reasons. Talks in a outdated and limited way with the kernel, and in fact, does not understand anymore all the network configurations. You won't be able to manipulate some network configurations such ifconfig versions that you are able to do with ip. In addition, the ifconfig support for network namespaces is limited.
As an anecdotal tale, I found interface IP alias that are only visible in ip and not in SuSE ifconfig.
As for the differences under the hood: From ifconfig vs ip: What’s Difference and Comparing Network Configuration
Although
ipmight seem a bit complex at first site but it is much
broader in functionality than ifconfig. It is functionally organized
on two layers of Networking Stack i.e. Layer 2 (Link Layer), Layer 3
(IP Layer) and does the work of all the above mentioned commands from
net-tools package.
While
ifconfigmostly displays or modifies the interfaces of a system,
this command is capable of doing following tasks:
Displaying or Modifying Interface properties.
Adding, Removing ARP Cache entries along creating new Static ARP entry
for a host.
Displaying MAC addresses associated with all the interfaces.
Displaying and modifying kernel routing tables.
One of the main highlight which separates it from its ancient
counterpart ifconfig is that latter uses ioctl for network
configuration, which is a less appreciated way of interaction with
kernel while former takes advantage of netlink socket mechanism for
the same which is a much more flexible successor of ioctl for
inter-communication between kernel and user space using rtnetlink
(which adds networking environment manipulation capability).
About the use/advantages of netlink: From LJ - Kernel Korner - Why and How to Use Netlink Socket
Netlink socket is a special IPC used for transferring information
between kernel and user-space processes. It provides a full-duplex
communication link between the two by way of standard socket APIs for
user-space processes and a special kernel API for kernel modules.
Netlink socket uses the address family AF_NETLINK.
.....
Why do the above features use netlink instead of system calls, ioctls
or proc filesystems for communication between user and kernel worlds?
It is a nontrivial task to add system calls, ioctls or proc files for
new features; we risk polluting the kernel and damaging the stability
of the system. Netlink socket is simple, though: only a constant, the
protocol type, needs to be added to netlink.h. Then, the kernel module
and application can talk using socket-style APIs immediately.
....
Netlink socket is a flexible interface for communication between
user-space applications and kernel modules. It provides an easy-to-use
socket API to both applications and the kernel. It provides advanced
communication features, such as full-duplex, buffered I/O, multicast
and asynchronous communication, which are absent in other
kernel/user-space IPCs.
edited 13 hours ago
answered 17 hours ago
Rui F RibeiroRui F Ribeiro
40.8k1479137
40.8k1479137
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f504063%2fip-vs-ifconfig-commands-pros-and-cons%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown