5 ms·
Functionally as a sysadmin, I've heard ifconfig is deprecated before yet I've never used ip. just 'ifconfig' on the command line tells me everything I need to k
by jrussbowman 16y ago
Functionally as a sysadmin, I've heard ifconfig is deprecated before yet I've never used ip. just 'ifconfig' on the command line tells me everything I need to know about what interfaces are up, their status and basic info.
'ip' just gives me the standard syntax description.
The power of the basic shell is that there's usually a few hundred ways to skin a cat. And just because there's documentation saying something is deprecated as often as not it's still so widely used that in practice, it's not.
- thwarted 16y agoifconfig doesn't show the additional IPs on an interface unless they are bound to aliased interface names (eth0:0)
- jrussbowman 16y agotrue, but that's how we've always done it where I work. We use chroot to support multiple web apps with their own ip/domain on a single box. real simple to just add a new /etc/sysconfig/network-script/ifcfg-eth#:# with the proper network config. We can then ifup and ifdown them as necessary, they come up on boot if the config is set... Just always made sense :)
- ominous_prime 16y agoThis isn't really an argument for using ifconfig. On RHEL and related systems, ifup, ifdown, and everything in /etc/sysconfig/network-scripts/ are all implemented with the `ip` command.
- veritgo 16y agoifconfig is deprecated, so probably a good idea to get out of that habit. Particularly if you are using it in scripts. 'ip addr' should give you all the information that 'ifconfig' does. You can also make the output a little less chatty by doing 'ip -o -4 addr' to get IPv4 addresses on one line per interface, or 'ip -o -0 addr' to get MAC addresses displayed similarly. This can make awking / cutting for addresses to use in scripts a little more elegant.
- davedavedave 16y agoI didn't know about the one-per-line option, so thanks for that. Commands I use regularly instead of using ifconfig: # link up/down ip link set dev eth0 up|down # add a new address ip addr add dev eth0 172.16.43.124/24 # to clear all IP addresses from eth0 ip addr flush dev eth0 # delete an address ip addr del dev eth0 172.16.43.124/24 # add default route ip route add default via 172.16.43.254 Edit: I fail at formatting
- telemachos 16y ago> Edit: I fail at formatting Really not you. It's one way this site is too minimal.
- X-Istence 16y agoAnd what is wrong with ifconfig eth0 up|down? Why would I want to type more to accomplish the same task? This is the same reason as to why I hated that Linux decided to have an ifconfig for physical interfaces, an iwconfig for wireless interfaces. It seems redundant...
- ominous_prime 16y ago> And what is wrong with > ifconfig eth0 up|down? Nothing, as long as it's working for you (your Linux distribution probably patched some of the remaining ifconfig problems themselves). You likely won't have a problem until you want to use network features that were implemented after 2001.
- davedavedave 16y agoYep, I'm fully aware of ifconfig. I use "ip link" just out of habit, and, given that ifconfig is apparently deprecated, it might disappear some day. Anyway, the point of my post was showing some basic things which can be done with ip, and how to do them.
- philjr 16y agoip accepts shortened versions of it's commands e.g. ip a can be used instead of ip addr Even shorter than ifconfig!