Use the ip command in favor of the deprecated ifconfig

Puppy related raves and general interest that doesn't fit anywhere else
Post Reply
Message
Author
User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

Use the ip command in favor of the deprecated ifconfig

#1 Post by Flash »

Pro tip: 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.

By Jack Wallen | February 1, 2016

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 use...so 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:
ADVERTISING


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).
Examples

Let's see some examples of the ip command.

Display info about all network interfaces:
The Experimental Elements Of Video Games
There are many ways of setting games apart from the herd, but you don’t necessarily have to reinvent the wheel to make an innovative game.
Sponsored by maximum games

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 192.168.10.100/24 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 192.168.10.0/24

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.

gcmartin

#2 Post by gcmartin »

Thanks @Flash. This is very helpful to members about the change from ifconfig to the supported "ip" command.

In reading some may find this command useful. The command

Code: Select all

# ifconfig
is the same as the article's

Code: Select all

# ip a
The "a" is shortcut notation for these

Code: Select all

# ip address
# ip addr
The biggest problem across the industry in general, and Puppy Linux specifically, is that scripts all over have used the old command (deprecated) format. At some point or when new scripts are created, hopefully developers will be aware of the need for change.

Thanks again.

Post Reply