Reading Time: 3minutesManaging the network on your servers can be cumbersome, time consuming and, involve a wide range of configurations. Thankfully, there are a handful of tools to help with these configurations. The tool we will be focusing on in this article is Ifconfig.
What is ifconfig?
Ifconfig is short for Interface Configuration and is a Linux command-line utility used to display, configure and manage your network interfaces. The full manpage description of the utility is as follows:
“Ifconfig is used to configure the kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging or when system tuning is needed.If no arguments are given, ifconfig displays the status of the currently active interfaces. If a single interface argument is given, it displays the status of the given interface only; if a single -a flag is given, it displays the status of all interfaces, even those that are down. Otherwise, it configures an interface.”
As the manpage states, you can pass different arguments (of flags) to the ifconfig command to perform different tasks or to display specific information.
What are the most useful things to do with ifconfig?
Ifconfig is a versatile utility and can make managing your network interfaces a relatively simple task. Below are a few helpful ifconfig commands you can use to manage your servers network:[root@host ~]# ifconfig eth0
This command will display information for the eth0 network interface specifically
[root@host ~]# ifconfig eth0 down
This command disables the eth0 interface
[root@host ~]# ifconfig eth0 up
This command enables the eth0 interface
[root@host ~]# ifconfig eth0 184.108.40.206
This command assigns the 220.127.116.11 IP address to the eth0 interface
This command will configure the netmask for the eth0 interface
What if ifconfig is missing in CentOS?
Ifconfig was the default network management command line utility for all versions of CentOS through CentOS 6. With the introduction of CentOS 7, a new replacement utility, called IP, was introduced as the default network management tool. The IP command-line utility functions similarly to ifconfig with a few minor differences. Now, you may be asking yourself, “What if I don’t want to use this new utility?”. That is perfectly fine. While it is no longer the default utility packaged with the latest CentOS distribution, Ifconfig can easily be installed on CentOS 7.
How do you install ifconfig on CentOS?
The installation of Ifconfig on CentOS 7 (or any CentOS servers that are missing the utility) is very simple. The ifconfig utility is part of a larger utility package called net-tools. All you have to do is install the net-tools package and ifconfig should then be available. Because we are specifically referring to CentOS, the yum package manager is what we will be using for this installation.Just to confirm, let’s use yum to see which package “provides” the ifconfig utility. We can do this using the “yum whatprovides” command argument:[root@host ~]# yum whatprovides ifconfigThe output of this command should look similar to this:Loaded plugins: fastestmirror, priorities, universal-hooks
Loading mirror speeds from cached hostfile
* EA4: 18.104.22.168
* cpanel-addons-production-feed: 22.214.171.124
* cpanel-plugins: 126.96.36.199
5 packages excluded due to repository priority protections
net-tools-2.0-0.24.20131004git.el7.x86_64 : Basic networking tools
Repo : @system-base
So the full package name and description is:net-tools-2.0-0.24.20131004git.el7.x86_64 : Basic networking tools
Installation with yum is just as simple and can be done with the below command:[root@host ~]# yum install net-tools
Once the yum installation completes, you can confirm ifconfig is now available by simply typing in the command with no arguments to display the current network interface information:[root@host ~]# ifconfig
That’s it! We’re all done. As always, if you ever have any questions regarding your LiquidWeb server or service, feel free to call our support helpline at 1-800-580-4985 to speak with one of our knowledgeable support representatives, log into your Liquidweb Help Center to submit a support request or, open chat with us!If you are interested in becoming a Liquid Web Customer or would like to know more about our hosting services, you can visit our products page below and if you have further thoughts, call in to speak to a hosting advisor today!.https://www.liquidweb.com/products/