by simias · 8y ago · 0 comments
I have a few issues though:
* "ip" is useless as a keyword if you're looking for help online. It's extremely frustrating and probably my main issue actually learning how to use the damn thing.
* ifconfig's output is simply more readable IMO: https://svkt.org/~simias/up/20180525-113825_ip-vs-ifconfig.p... . It's pretty weird that a brand new tool manages to have worse output than a venerable old unix command. Because of this I often end up configuring the network with ip only to double-check everything is right with a quick ifconfig. That's silly.
I think at this point I would've preferred if they had made an "ifconfig2" instead, mostly identical to the old one but with a few breaking changes to add the missing functionality. An incremental update instead of a full rewrite. There's definitely some NIH going on.
Yes, this is key, and why ip is so terrible for the way I currently work. No doubt I'll have to get used to it, like those stupid biosdevname interfaces.
90% of my machines don't have more than 1 IP per physical interface, the rest are aliases
ifconfig outputs clear whitespace, so picking out the specific details of
- interface name
- ip address
Is far easier. I do prefer /28 to 255.255.255.240 when specifying subnets, but it does make it far harder to scan what the IP is. I suspect the people writing the utilities are the ones who are able to automate everything, as they do the same job 1000 times, with IP in, IP out, and no concern about physical devices, so rarely use the tool to read data, certainly not as a human.
You've then got the "what's the default gateway" problem
route -n
shows it nice and easy
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.26.32.1 0.0.0.0 UG 0 0 0 eth0
172.26.32.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0
ip route -n returns ip route -n
Command "-n" is unknown, try "ip route help".
Helpful, ip route help is no help at allIt's all good having tools to manage lots of ip namespaces etc, that's great in the subset of cases you need that functionality, but for those of us that manage physical machines with physical inputs/outputs, rather than datacenter scale devices, it's a right pain.
> > ifconfig's output is simply more readable IMO
I prefer iproute2's terseness.
Adding more punctuation to delimit the fields (, : etc...) would be nice too. I mean what the hell:
mtu 1500 qdisc pfifo_fast qlen 1000I once tried to use tc and gave up after more than a day of trying, that is how bad it is. The syntax is a word soup and the semantics are very poorly explained.
valid_lft forever preferred_lft forever> ip route | column -t
(With iproute2 4.3.0, I get the same output between "route", "route show", and "route show default"; no idea if it's changed since.)
Alas it doesn't work quite so well for "ip addr". It would have been great if they'd just decided on CSV or JSON or whatever and then relied on secondary utilities to go to "pretty-printed".
ip route get XI do use ip route a fair bit - if I have a machine connected to two (or more) network segments and want to ensure traffic gets routed back the way it came
However my main criticism for "ip route" is that it's inconsistent and a change route "route"
"route" does reverse dns lookups - e.g "my.server.tld rather than "1.2.3.4", or "default" rather than "0.0.0.0"
"route -n" shows 1.2.3.4
"ip route" doesn't do reverse lookup, however it does say "default" rather than "0.0.0.0".
Most docs will mention iproute2. You can use that for googling.
Of course in the specific case of "ip", both are going to return quite a haystack to search through...
> $ which ip
> /sbin/ip
> $ dpkg -S /sbin/ip
> iproute2: /sbin/ip
I use cope to colorize my output, which makes 'which' useless to me for most common commands, but 'whereis' still works.
Edit for examples:
$ which ip
/usr/share/perl5/vendor_perl/auto/share/dist/Cope/ip
$ whereis ip
ip: /usr/bin/ip /usr/share/perl5/vendor_perl/auto/share/dist/Cope/ip /usr/share/man/man7/ip.7.gz /usr/share/man/man8/ip.8.gzThat being said while docs specifically written about the tool will probably mention it random forum posts, tutorials or even stackoverflow questions may not.
I don't know the decisions behind the naming either, but the ip shell command comes as part of the iproute2 [1] package.
After I found out about this googling became much easier.
The point is that searching for "ifconfig tutorial" is going to give you what you want, while "ip route" is probably going to get you Cisco documentation, honestly. Even something like "parse ip output" is going to give you a mix of results from Linux, Windows, or web services while "parse ifconfig output" is a lot more clear.
"ip" is simply a saturated keyword, making it a bad keyword.
`ip` takes a --oneline arg to make it more parseable.
The only real gripe I have with IP is their long argument/switch format. Unlike everyone else, ip is a minority, which accepts long options with single dash "-". This prevents someone from combining many short parameters under a single dash, also it's confusing to use.
Yes, it unofficially supports the old double dash format, but if you are supporting it, there's no point in supporting single dash long options.
Not all subcommands support it though.
rascul@coyote:~$ ip -json addr
Option "-json" is unknown, try "ip -help".
rascul@coyote:~$ ip -V
ip utility, iproute2-ss160111Mind expanding NIH?
It's better that the command you type often is short, (you can certainly alias ifconfig as "ifg" or anything too).
Take for instance a very simple query: "ip show default route":
https://duckduckgo.com/?q=ip+command+show+default+route&t=ff...
There are a few obviously relevant matches in the first page but also a bunch of completely irrelevant results. Adding "command" doesn't improve that much. And that's for a very simple query that's probably been asked hundreds of times before.
Meanwhile if I search "ls sort date" I get mostly relevant results immediately because even though it's also a 2 letter identifier it's not quite as ambiguous: https://duckduckgo.com/?q=ls+sort+date&t=ffab&ia=qa
Let alone the non-conformity of other OS's like Solaris, HP-UX which really might not matter now. I'm sure FreeBSD matters to someone... just not me
ifconfig -L
(I don't know if this is already taken. I haven't read the man pages in forever.)Looking at it more closely now, ip addr's output doesn't seem that difficult to fix. Remove that random number before the adapter name (what the hell is that anyway? The order in which the adapter appeared? If so, why are not in that order?)
I think that alone would make it so much more readable! Maybe white space between each entry with a flag?
All of the help sections are awful too. I feel like I'm looking at language grammar definition instead of useful usage information.