Cart 0
No products in the cart.

Linux ifconfig Command explained With Examples

Linux ifconfig Command explained With Examples

Linux ifconfig command is a utility used for configuring network interfaces in Linux operating systems. It can be used for displaying the current configuration of a network interface, setting the IP address, setting the netmask, setting the broadcast address, setting the network address, setting the maximum transmission unit (MTU), configuring the network interface to accept broadcast packets, and more. It can also be used to display the statistics of a network interface, such as the number of bytes sent and received, the number of errors, and the number of packets dropped.

Here at Fixwebnode, we shall look into how to use the Linux ifconfig Command.

 

Using ifconfig on Different Linux Distributions

The ifconfig command is available on almost all versions of Linux, including Ubuntu, Debian, Red Hat, CentOS, Fedora, and more. It is usually located in the /sbin directory and is usually used with the sudo command.

For example, to view the configuration of an interface eth0 on Ubuntu, you can use the following command:

$ sudo ifconfig eth0

On Red Hat, CentOS, and Fedora, you can use the following command:

$ ifconfig eth0

 

Ifconfig Options

The ifconfig command has a number of options that you can use for configuring your network interface. Here are some of the most commonly used options:

  • -a: This option is used to display the configuration of all network interfaces.
  • -v: This option is used to display verbose output.
  • -s: This option is used to display the statistics of a network interface, such as the number of bytes sent and received, the number of errors, and the number of packets dropped.
  • -i: This option is used to display information about a specific network interface.
  • -m: This option is used to set the maximum transmission unit (MTU) of a network interface.
  • -b: This option is used to set the broadcast address of a network interface.
  • -n: This option is used to set the network address of a network interface.

 

Examples of using Ifconfig command

Here are some examples of how to use the ifconfig command:

1. To display the configuration of all network interfaces:

$ sudo ifconfig -a

 

2. To display the statistics of a network interface eth0:

$ sudo ifconfig eth0 -s

 

3. To set the maximum transmission unit (MTU) of a network interface eth0 to 1500 bytes:

$ sudo ifconfig eth0 mtu 1500

 

[Need Linux Support ? We shall help you. ]

 



CONCLUSION

This article covers the basics of the Linux ifconfig command and how to use it on different Linux distributions. In fact, you should be able to use the ifconfig command to configure your network interfaces.


icon

Sign up to Newsletter

...and receive a free support ticket.