5 ms·
Oh may, I pray for this to be added to macOS. The amount of times I reach for 'ip ...' and am stymied...
by gclawes 4y ago
Oh may, I pray for this to be added to macOS. The amount of times I reach for 'ip ...' and am stymied...
- NegativeLatency 4y agoI'm not familiar with this, can you recommend a good source to read up on it (preferably something more engaging than a manpage)?
- jandrese 4y agoThe ip command has a built-in help system you can get started with "ip help", but it tends to throw a lot of fugly BNF at you and is pretty light on detail. The ip manpage is much better. It is broken up into sections which is a bummer for searching but does make it a little less daunting for reading. The nice thing about it is that since it has been around for many years now you can google search most any question and find the answer. All in all the ip command is fairly straightforward and orthogonal which is nice. Some starting commands "ip addr show" lists interfaces and their stats. It's harder to read than ifconfig -a but gives you the same information in a similar format. "ip route show" replaces netstat -rn to show the routing table but is also not as well formatted as the old command. "ip neigh show" replaces arp -a and is about the same level of legibility. "ip route add ..." replaces "route ..." command and is about the same to use. So basically it combines a bunch of commands (including ifconfig) into one and gives them all a unified interface.
- gerdesj 4y agoip is way more useful than your summary! It also supports abbreviations just like a switch does which is nice: $ip a $ip a a 10.99.0.111/24 dev re0 $ip r $ip r a default via 10.99.0.1 dev re0 The second command is: ip address add. The third is show me the routing table - ip4 is the default add -6 for ipv6. The fourth is add a default route. $ip n s That is neigh(bour) show - the arp table. On Linux, ipconfig and co are destined to quietly go away. Use ip and co instead - so much more powerful.
- laumars 4y agoThe abbreviation convention on networking gear isn’t a good thing. It allows for typos to become completely different command, thus introducing unexpected behaviour. I’ve heard so many horror stories (and had some of my own too) because of this.
- gerdesj 4y agoI don't agree with you. It is a convenience but you do need to be careful. There are few (if any) commands that can be morphed into another to cause horror. All switch command completers I know of will not complete on ambiguity. If you feel you are personally a bit random then use the try/commit mode that most decent gear allows. You package up a set of changes and try them out. You then commit them within an agreed time or the changes revert.
- laumars 4y agoAs I said, I’ve personally been bit by feature and know of others who have. So I’m not talking about a theoretical risk. Things might have improved since I was last managing Cisco gear. try/commit wasn’t available back then and maybe those stupid commands (like “administrator-full-port-shutdown”) have been since removed to prevent ambiguous shortenings. But I did quickly learn that it’s better to be explicit rather than implicit. And frankly, I still think that’s good advice given the IaC methodologies that are now commonly practiced. If nothing else, you should be writing your config so that others can read it, and storing that config in version control.
- iokanuon 4y ago>"ip addr show" lists interfaces and their stats. It's harder to read than ifconfig -a but gives you the same information in a similar format. It's worth noting that `-br` gives you a brief version of the output, and `-c` colors it, so that it's possible to do something like this: ip -br -c addr to get a very readable and colorful table-like output. There's also `-j` for JSON, and `-j -p` for pretty JSON.
- icehawk 4y agoThere's some caveats to comparing it to linux ifconfig and netstat: ifconfig can't express the idea that an interface can have IPv4 address, and is inconsistent with itself because it does show all of the IPv6 addresses. netstat (and route because you can't manipulate the main RIB with netstat, so now you have two problems-- er-- tools) completely elides things like source address selection as a function of the RIB, and the fact that the kernel can have more than one routing table.
- eptcyka 4y agoCould you elaborate on the Mach kernel having multiple routing tables?
- nixcraft 4y agoI have "Linux ip Command Examples"[1] page that explains how to use the ip command to display and configure the network parameters for host interfaces. HTH. [1] https://www.cyberciti.biz/faq/linux-ip-command-examples-usage-syntax/ https://www.cyberciti.biz/faq/linux-ip-command-examples-usag...
- jaredhallen 4y agoI know ip is not only the future, but very much the present. But damn if I can ditch my ifconfig/route habits.
- ipdashc 4y agoThe other replies already answered you, but I just wanted to add: If you pass the -c flag to `ip`, like `ip -c addr`, it colors it! Makes it orders of magnitude easier to work with, IMO. I don't know why this isn't publicized more widely. Hence my username :)
- mhio 4y agoThere's a python script that does a passable impression of `ip` brew install iproute2mac https://github.com/brona/iproute2mac https://github.com/brona/iproute2mac