Slashdot Mirror


There Are Real Reasons For Linux To Replace ifconfig, netstat and Other Classic Tools (utoronto.ca)

Several readers have shared a blog post: One of the ongoing system administration controversies in Linux is that there is an ongoing effort to obsolete the old, cross-Unix standard network administration and diagnosis commands of ifconfig, netstat and the like and replace them with fresh new Linux specific things like ss and the ip suite. Old sysadmins are generally grumpy about this; they consider it yet another sign of Linux's 'not invented here' attitude that sees Linux breaking from well-established Unix norms to go its own way. Although I'm an old sysadmin myself, I don't have this reaction. Instead, I think that it might be both sensible and honest for Linux to go off in this direction. There are two reasons for this, one ostensible and one subtle.

The ostensible surface issue is that the current code for netstat, ifconfig, and so on operates in an inefficient way. Per various people, netstat et al operate by reading various files in /proc, and doing this is not the most efficient thing in the world (either on the kernel side or on netstat's side). You won't notice this on a small system, but apparently there are real impacts on large ones. Modern commands like ss and ip use Linux's netlink sockets, which are much more efficient. In theory netstat, ifconfig, and company could be rewritten to use netlink too; in practice this doesn't seem to have happened and there may be political issues involving different groups of developers with different opinions on which way to go.

(Netstat and ifconfig are part of net-tools, while ss and ip are part of iproute2.)

However, the deeper issue is the interface that netstat, ifconfig, and company present to users. In practice, these commands are caught between two masters. On the one hand, the information the tools present and the questions they let us ask are deeply intertwined with how the kernel itself does networking, and in general the tools are very much supposed to report the kernel's reality. On the other hand, the users expect netstat, ifconfig and so on to have their traditional interface (in terms of output, command line arguments, and so on); any number of scripts and tools fish things out of ifconfig output, for example. As the Linux kernel has changed how it does networking, this has presented things like ifconfig with a deep conflict; their traditional output is no longer necessarily an accurate representation of reality.

27 of 478 comments (clear)

  1. So by ArchieBunker · · Score: 5, Insightful

    keep the command names the same but rewrite how they function? Nah makes too much fucking sense. I've had distros where my default route wasn't working and traceroute wasn't even installed by default. Talk about a shit show. What was the reason for replacing "route" anyhow? It's worked for decades and done one thing.

    --
    Only the State obtains its revenue by coercion. - Murray Rothbard
    1. Re:So by Z00L00K · · Score: 4, Insightful

      I agree - I don't care how the commands work under the cover as long as they have the names and syntax I expect since ages ago.

      Most of the listed programs aren't really performance hogs anyway so there's not a huge reason to rewrite them unless there's some serious safety issues or stability issues that has to be taken care of.

      Please don't generate time wasters trying to force people find new commands with new syntaxes doing what the old commands did fine. It's not worth it.

      --
      If builders built buildings the way programmers wrote programs, then the first woodpecker would destroy civilization.
    2. Re:So by Anonymous Coward · · Score: 5, Insightful

      Following the systemd model, "if it aint broken, you're not trying hard enough"...

    3. Re:So by Anonymous Coward · · Score: 2, Insightful

      What is the point? If an intruder is already there couldn't they just upload their own binary?

    4. Re:So by gweihir · · Score: 3, Insightful

      What was the reason for replacing "route" anyhow? It's worked for decades and done one thing.

      Idiots that confuse "new" with better and want to put their mark on things. Because they are so much greater than the people that got the things to work originally, right? Same as the systemd crowd. Sometimes, they realize decades later they were stupid, but only after having done a lot of damage for a long time.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    5. Re:So by DamnOregonian · · Score: 3, Insightful

      You have no fucking idea what you're talking about. I run a multi-regional network with over 130 peers. Nobody "disables ICMP". IP breaks without it.
      Some folks, generally the dimmer of us, will disable echo responses or TTL expiration notices thinking it is somehow secure (and they are very fucking wrong) but nobody blocks all ICMP, except for very very dim witted humans, and only on endpoint nodes.

    6. Re:So by DamnOregonian · · Score: 5, Insightful

      No.
      Things like this don't slow down "hackers" with even a modicum of network knowledge inside of a functioning network.
      What they do slow down is your ability to troubleshoot network problems.
      Breaking into a network is a slow process. Slow and precise. Trying to fix problems is a fast reactionary process. Who do you really think you're hurting?
      Yes another example of how ignorant opinions can become common sense.

    7. Re:So by kevmeister · · Score: 3, Insightful

      No, TCP/IP is not working fine. It's broken and is costing you performance and $$$. But it is not evident because TCP/IP is very good about dealing with broken networks, like yours.

      Th problem is that doing this requires things like packet fragmentation which greatly increases router CPU load and reduces the maximum PPS of your network as well s resulting in dropped packets requiring re-transmission and may also result in widow collapse fallowed with slow-start, though rapid recovery mitigates much of this, it's still not free.

      It's another example of security by stupidity which seldom provides security, but always buys added cost.

      --
      Kevin Oberman, Network Engineer, Retired
  2. Bad idea by goombah99 · · Score: 5, Insightful

    Unix was founded on the ideas of lots os simple command line tools that do one job well and don't depend on system idiosyncracies. If you make the tool have to know the lower layers of the system to exploit them then you break the encapsulation. Polling proc has worked across eons of linux flavors without breaking. when you make everthing integrated it creates paralysis to change down the road for backward compatibility. small speed game now for massive fragility and no portability later.

    --
    Some drink at the fountain of knowledge. Others just gargle.
    1. Re:Bad idea by llamalad · · Score: 5, Insightful

      The error you're making is thinking that Linux is UNIX.

      It's not. It's merely UNIX-like. And with first SystemD and now this nonsense, it's rapidly becoming less UNIX-like. The Windows of the UNIX(ish) world.

      Happily, the BSDs seem to be staying true to their UNIX roots.

  3. SS Really by barryvoeten · · Score: 5, Insightful

    What moron has called the tool SS ? I thing someone who does not check Google first. It is not only Unix history being wiped here.

  4. That would break scripts which use the UI by raymorris · · Score: 5, Insightful

    A LOT of scripts use ifconfig and friends. Changing them would be bad, imho. Better would be to call it ifconfig6 or whatever if you're going to change the output or the meaning of commands, so you don't break existing scripts.

    In general, it's better for application programs, including scripts to use an application programming interface (API) such as /proc, rather than a user interface such as ifconfig, but in reality tons of scripts do use ifconfig and such.

    1. Re:That would break scripts which use the UI by drinkypoo · · Score: 4, Insightful

      Yes, the UNIX way has a fundamental flaw.

      It's not a flaw. Process creation is cheap on Unixlikes.

      There's nothing like an iterative algorithm that loads and saves it's (large) data to disk multiple times per iteration.

      That's not a problem inherent to scripts; if you do it wrong, you can do it that way with a coded program, too. Some things, of course, should just not be done with shell scripts. For those things, there is perl :)

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    2. Re:That would break scripts which use the UI by gweihir · · Score: 5, Insightful

      The problem isn't new tools. It's crap tools.

      Crap tools written by morons with huge egos and rather mediocre skills. Happens time and again an the only sane answer to these people is "no". Good new tools also do not have to be pushed on anybody, they can compete on merit. As soon as there is pressure to use something new though, you can be sure it is inferior.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    3. Re:That would break scripts which use the UI by TechyImmigrant · · Score: 3, Insightful

      Being able to code things fast and have them execute slow is not a "fundamental flaw". It is a valid design choice and actual experts understand that.

      This.

      I write many programs that I end up running exactly once after they're tested and working. Runtime might vary from milliseconds to a week. But the thing that impacts my time is writing the code, not getting on with other stuff while the computer works for me.

      --
      I should use this sig to advertise my book ISBN-13 : 978-1501515132.
  5. Why do they need to be REPLACED? by freeze128 · · Score: 4, Insightful

    What's wrong with just ADDING newer commands and leaving the old ones?

    1. Re:Why do they need to be REPLACED? by gweihir · · Score: 3, Insightful

      Then you would have to compete on merit, i.e. your new shiny greatest thing (TM) would actually have to be better to be successful. It rarely is.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    2. Re:Why do they need to be REPLACED? by c · · Score: 4, Insightful

      What's wrong with just ADDING newer commands and leaving the old ones?

      People would just keep using the old ones and ignore the new ones. This would be a blow to the egos of the people reinventing the wheel and hence can't be allowed.

      --
      Log in or piss off.
  6. Mainly because ... by thadtheman · · Score: 3, Insightful

    Lenart Poettering hasn't screwed up linux enough already.

  7. What utter nonsense. by AJWM · · Score: 5, Insightful

    I'm responsible a lot of production systems (somewhere around a thousand VMs, it varies), so of course I worry about CPU use, memory use, I/O, etc. I have never, ever, in decades of sysadmin'ing, worried about how much of the above ifconfig or netstat take. (It's not like what's in /proc are actual files, after all; /proc a kernel interface.)

    Worried about efficiency? In the aggregate you'll waste more CPU- and man-hours compiling and debugging your replacement tools than using ifconfig or netstat will. Go spend that time on something useful.

    --
    -- Alastair
  8. Never break userland. by drolli · · Score: 3, Insightful

    Do it like it is done correctly:

    Leave the old interfaces/tools in, including their inefficiency. If you dont like to haven these in your special kernel, the proc filesystem can be disabled......

    For those systems which need something more efficient (i suppose things involving heavy use of containers or virtualization), use the new interfaces.

    This worked well for a lot of things up to now in linux.

  9. Re:After the systemd fiasco... by jythie · · Score: 4, Insightful

    Well yes, systemd was intended to cater to a different set of users and use cases than the old system, so of course it 'worked well', or was 'a fiasco', depending on what one was doing.

  10. Re: Denying ICMP echo @ server/workstation level t by Bing+Tsher+E · · Score: 5, Insightful

    Linux has one of the few IP stacks that isn't derived from the BSD stack, which in the industry is considered the reference design. Instead for linux, a new stack with it's own bugs and peculiarities was cobbled up.

    Reference designs are a good thing to promote interoperability. As far as TCP/IP is concerned, linux is the biggest and ugliest stepchild. A theme that fits well into this whole discussion topic, actually.

  11. Let's try hard to break Linux by what+about · · Score: 2, Insightful

    It does not make any sense that some people spend time and money replacing what is currently working with some incompatible crap.

    Therefore, the only logical alternative is that they are paid (in some way) to break what is working.

    Also, if you rewrite tons of systems tools you have plenty of opportunities to insert useful bugs that can be used by the various spying agencies.

    You do not think that the current CPU Flaws are just by chance, right ?
    Immagine the wonder of being able to spy on any machine, regardless of the level of SW protection.

    There is no need to point out that I cannot prove it, I know, it just make sense to me.

  12. Re:That's the reason by locofungus · · Score: 3, Insightful

    It done one thing: Maintain the routing table.

    Should the ip rule stuff be part of route or a separate command?

    There are things that could be better with ip. IIRC it's very fussy about where the table selector goes in the argument list but route doesn't support this at all.

    I also don't think route has anything like 'nexthop dev $if' which is a godsend for ipv6 configuration.

    I stayed with route for years. But ipv6 exposed how incomplete the tool is - and clearly nobody cares enough to add all the missing functionality.

    Perhaps ip addr, ip route, ip rule, ip mroute, ip link should be separate commands. I've never looked at the sourcecode to see whether it's mostly common or mostly separate.

    --
    God said, "div D = rho, div B = 0, curl E = -@B/@t, curl H = J + @D/@t," and there was light.
  13. Re:The dislike of support work by DamnOregonian · · Score: 4, Insightful

    iproute2 exists because ifconfig, netstat, and route do not support the full capabilities of the linux network stack.
    This is because today's network stack is far more complicated than it was in the past. For very simple networks, the old tools work fine. For complicated ones, you must use the new ones.

    Your post could not be any more wrong. Your moderation amazes me. It seems that slashdot is full of people who are mostly amateurs.
    iproute2 has been the main network management suite for linux amongst higher end sysadmins for a decade. It wasn't written to sate someone's desire to change for the sake of change, to make more complicated, to NIH. It was written because the old tools can't encompass new functionality without being rewritten themselves.

  14. Re:Changes for changes sake by DamnOregonian · · Score: 3, Insightful

    TFA is full of shit. IP aliases have always and still do appear in ifconfig as separate logical interfaces.

    No, you're just ignorant.
    Aliases do not appear in ifconfig as separate logical interfaces.
    Logical interfaces appear in ifconfig as logical interfaces.
    Logical interfaces are one way to add an alias to an interface. A crude way, but a way.

    The assertion ifconfig only displays one IP address per interface also demonstrably false.

    Nope. Again, your'e just ignorant.

    root@swalker-samtop:~# tunctl
    Set 'tap0' persistent and owned by uid 0
    root@swalker-samtop:~# ifconfig tap0 10.10.10.1 netmask 255.255.255.0 up
    root@swalker-samtop:~# ip addr add 10.10.10.2/24 dev tap0
    root@swalker-samtop:~# ifconfig tap0:0 10.10.10.3 netmask 255.255.255.0 up
    root@swalker-samtop:~# ip addr add 10.10.1.1/24 scope link dev tap0:0
    root@swalker-samtop:~# ifconfig tap0 | grep inet
    inet 10.10.1.1 netmask 255.255.255.0 broadcast 0.0.0.0
    root@swalker-samtop:~# ifconfig tap0:0 | grep inet
    inet 10.10.10.3 netmask 255.255.255.0 broadcast 10.10.10.255
    root@swalker-samtop:~# ip addr show dev tap0 | grep inet
    inet 10.10.1.1/24 scope link tap0
    inet 10.10.10.1/24 brd 10.10.10.255 scope global tap0
    inet 10.10.10.2/24 scope global secondary tap0
    inet 10.10.10.3/24 brd 10.10.10.255 scope global secondary tap0:0

    If you don't understand what the differences are, you really aren't qualified to opine on the matter.
    Ifconfig is fundamentally incapable of displaying the amount of information that can go with layer-3 addresses, interfaces, and the architecture of the stack in general. This is why iproute2 exists.