If you’re still using ifconfig, you’re living in the past

Mathieu Trudel-Lapierre

Mathieu Trudel-Lapierre

on 7 July 2017

The world evolves

I regularly see “recommendations” to use ifconfig to get interface information in mailing list posts or bug reports and other places. I might even be guilty of it myself. Still, the world of networking has evolved quite a lot since ifconfig was the de-facto standard to bring up a device, check its IP or set an IP.

Following some improvements in the kernel and the gradual move to driving network things via netlink; ifconfig has been largely replaced by the ip command.

Running just ip yields the following:

I understand this may look complicated to some people, but the jist of it is to understand that with ip, you interact with objects, and apply some kind of function to it. For example:

ip address show

This is the main command that would be used in place of ifconfig. It will just display the IP addresses assigned to all interfaces. To be precise, it will show you the layer 3 details the interface: the IPv4 and IPv6 addresses, whether it is up, what are the different properties related to the addresses…

Another command will give you details about the layer 2 properties of the interface: its MAC address (ethernet address), etc; even if it is shown by ip address:

ip link show

Furthermore, you can set devices up or down (similar to ifconfig eth0 up or ifconfig eth0 down) simply by using:

ip link set DEVICE up or ip link set DEVICE down

As shown above, there are lots of other objects that can be interacted with using the ip command. I’ll cover another: ip route, in another post.

Why is this important?

As time passes, more and more features are becoming easier to use with the ip command instead of with ifconfig. We’ve already stopped installing ifconfig on desktops (it still gets installed on servers for now), and people have been discussing dropping net-tools (the package that ships ifconfig and a few other old commands that are replaced) for a while now. It may be time to revisit not installing net-tools by default anywhere.

I want to know about your world

Are you still using one of the following tools?

/bin/netstat (replaced by ss, for which I’ll dedicate another blog post entirely)
/sbin/ipmaddr (replaced by ip maddress)
/sbin/mii-tool (ethtool should appropriately replace it)

If so and there is just no alternative to using them that comes from iproute2 (well, the ip or ss commands) that you can use to do the same, I want to know about how you are using them. We’re always watching for things that might be broken by changes; we want to avoid breaking things when possible.

This article was originally featured on the author’s blog

Ubuntu Server

The leading platform for scale-out computing, Ubuntu Server delivers the best value scale-out performance available.

Newsletter signup

Select topics you’re interested in

In submitting this form, I confirm that I have read and agree to Canonical’s Privacy Notice and Privacy Policy.

Related posts

开源基础设施,桌面和物联网开发者都聚焦在Ubuntu 19.04

2019年4月18日,Canonical今天宣布Ubuntu 19.04 正式发布,新版系统将聚焦开源基础设施部署,开发者桌面,物联网和云到端的软件分发等领域。 “Ubuntu在电信,金融和多媒体领域的开源优势已经扩展到其他领域。从公有云到私有数据中心再到边缘设备或集群,开源已成为效率和创新的标志。Ubuntu 19.04包含了支持领先项目的转换,以及用于加速这些域的应用程序的开发人员工具。” Canonical的CEO Mark Shuttleworth说道。…

Announcing OpenJDK 11 packages in Ubuntu 18.04 LTS

OpenJDK 11 is the default JRE/JDK for 18.04 LTS and is covered under LTS upstream security support. OpenJDK 11 will be the default package for the upcoming 19.04 release.

Open infrastructure, developer desktop and IoT are the focus for Ubuntu 19.04

18th April, 2019: Canonical today announced the release of Ubuntu 19.04, focused on open infrastructure deployments, the developer desktop, IoT, and cloud to edge software distribution. “The open-source-first on Ubuntu movement in telco,…