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

Last Update of V2.9 for Calligra is Released with Improvements in Krita and Kexi

Share Button

The final update for 2.9 series of Calligra, a graphic art and office suite by KDE is released with bug fixes which is 11th maintenance release of the series. The next

Articles 2 Comments

Linux or GNU/Linux – Here is What Every User Should Know.

Share Button

You must have seen people stating linux distro simply as “Linux” whereas if you go through some official documentation or posts, you will find it called as “GNU/Linux”. Though its

Articles 0 Comments

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

Share Button

After widely growing usage of Linux based Operating system on PCs and mobile devices, it has become number one choice for the Hosting Company Sites too. In the first month

  • 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.