ifconfig is deprecated. Here is how to use ip command

Share Button

ifconfig command developed by BSD was depreciated years ago but its available to use in many linux system for network interface communication maybe considering its wild use in past years and for those fearing changes too. But its replacement ip is far more handy to use. Apart from ifconfig, many system administration utility like: arp, ipmaddr, route, iptunnel, nameif, mii-tool have become obsolete. The net-tools were used as foundation for the NET-3 networking distribution in Linux based OS.
Though most of the linux distro have the packages already installed but in some cases like: Ubuntu Docker, you might need to get hands dirty for that. This simple command will get you back to years:

sudo apt-get install net-tools

Now, lets get familiar with iproute2 suite to display & analyze the network interface parameters. The newly introduced commands can be used in the form of sub-commands shortened like in Cisco-IOS style like: ip addr is equivalent to ip a.

ip a

It lists all interfaces with their associated information. But if you wish to see only IPV4 or IPV6 info, just enter ip -4 a or ip -6 a

ip a show wlan0

It enables you to see information regarding specific interface.

ip r

This command lists the routing table. But if you want to route all traffic via the gateway connected via eth0 network interface, enter the command: ip route add dev eth0. Also, del in place of add deletes the route.

ip route add default via

It changes the default gateway to

ip a add dev eth0

This add command assigns specific IP address to the eth0 interface. It is equivalent to ifconfig eth0 with the ifconfig command.

Similarly, del in place of add deletes the address from interface.

Flushing all addresses from all interfaces on the 192.168.10.x network can be done with the command:

ip -s -s a f to

Now you may want to set up or close down interfaces which is handy with the new command on modern Linux distributions:

ip link set dev eth0 down

ip link set dev eth0 up

The link commands, the interface can be controlled both in physical and logical level.

Though, ifconfig may work for sometime more but its recommended choice since 2.4 kernels. Its better to switch to newer way of handling network interfaces.

Next Linux Tops Web - Big Aid for Hosting Company to Reach 100 Percent Uptime

About author

You might also like

Articles 0 Comments

Windows 10 have Hidden Linux Sub-System?

Share Button

The news of Microsoft open-sourcing some of its software and development of Linux Based OS for Azure is not old. But in the mean time, a hacker has spotted Linux

Articles 1Comments

OnePlus 3 Kernel Source Code Released; Is Set to Be an Unofficial Ubuntu Phone

Share Button

Day after launching third version of flagship killer phone OnePlus 3, the company has released the kernel source code files of the OnePlus 3 to developers on github. The release

Articles 0 Comments

Microsoft’s Azure now Offers Red Hat Enterprise Linux

Share Button

In another improvement on Microsoft welcoming Linux platforms, Azure is now offering Red Hat Enterprise Linux licenses. Starting from 17th Feb, users can deploy Red Hat Linux Enterprise (RHLE) from the

  • Paul

    ifconfig is depreciated? Thanks obama!

  • Jeff Turner

    It’s a pity the formatting of ‘ip’ command results is so poor. Compare ‘ip a’ with ‘ifconfig’, or ‘ip route’ with ‘route -n’.

  • Leandro G Faria Corcete DUTRA

    You mean deprecated. Check your dic.

  • mikeym0p

    Question. Ubuntu 15.10. Has systemD and uses ip / Network Config instead of bridge-utils/ifconfig.
    Where are the network interfaces stored now? In /opt/NetworkConfig/* there is only the ‘lo’ interface.
    /etc/network/interfaces is empty as well.

    I accumulated several bridge connections that are visible in ifconfig but not when using ip or when using Network Configuration gui utility.

  • Go USA

    Should be deprecated.