How to use the ip command in favor of the deprecated ifconfig

If you're a network admin, you probably work with Linux. If you constantly reach for the ifconfig command, Jack Wallen says it's time you learn its replacement: ip.

Image: Jack Wallen

Did you know back in 2009 it was announced that the ifconfig Linux command would be deprecated? It was and it has been. In fact, no work has been done on ifconfig for some time now. In its place is the ip command. Although some aren't exactly happy about this choice, the die was cast and we must move on (sort of).

Yes, ifconfig is still available to those of you absolutely fear change, need not worry. For everyone else, it's time to move on.

So what do you do? You use the ip command. How is it used? Actually it's quite easy. The syntax of the ip command looks like:

ip [options] OBJECT COMMAND

Objects include things like:

  • link: network device
  • address: protocol address of a device
  • addrlabel: label configuration for protocol address
  • neighbour: ARP or NDISC cache entry
  • route: routing table entry
  • rule: rule in routing policy database
  • maddress: multicast address
  • mroute: multicast routing cache entry
  • tunnel: tunnel over IP
  • xfrm: framework for IPsec protocol

If you need more help with an object, you can issue the command ip OBJECT help (where OBJECT is the name of the object in question).


Let's see some examples of the ip command.

Display info about all network interfaces:

ip a

Display info about all IPv4 network interfaces:

ip -4 a

Display info about all IPv6 network interfaces:

ip -6 a

Display info about a particular network interface:

ip a show eth0

You can also modify an existing interface with the ip command. Say you want to assign a specific IP address to the eth0 interface:

ip a add dev eth0

You could also flush all addresses from all interfaces on the 192.168.10.x network with the command:

ip -s -s a f to

Finally, you can bring up and down interfaces with ip like so:

ip link set dev eth0 down

ip link set dev eth0 up

There are plenty of other uses for this command. To get a complete listing, issue the man ip command to read the full details.

I highly recommend you familiarize yourself with the ip command. Although you're going to keep defaulting to ifconfig, that tool is now out of never know if/when it might stop functioning properly.

Also see

By Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic, The New Stack, and Linux New Media. He's covered a variety of topics for over twenty years and is an avid promoter of open source. For more news about Jack Wallen, visit his website jackwallen....