ifconfig is deprecated. Here is how to use ip command
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.
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.
This command lists the routing table. But if you want to route all traffic via the 192.168.0.254 gateway connected via eth0 network interface, enter the command: ip route add 192.168.1.0/24 dev eth0. Also, del in place of add deletes the route.
ip route add default via 0.0.0.0
It changes the default gateway to 0.0.0.0
ip a add 192.168.10.100/24 dev eth0
This add command assigns specific IP address to the eth0 interface. It is equivalent to ifconfig eth0 192.168.10.100 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 192.168.10.0/24
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.
You might also like
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
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
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