Using the Linux ifconfig Command
What is the ifconfig Command in Linux?
The ifconfig command in Linux is used to view and configure network interface parameters. It is commonly used for troubleshooting any networking related issues on a Linux system. It is available on all modern Unix-like operating systems such as Linux, macOS, Solaris and BSD.
How to Use ifconfig Command in Linux?
The ifconfig command can be used in many ways – to check the status of an interface, configure an interface, enable or disable an interface, or set some other network-related parameter on an interface. To get detailed information about the syntax and options of the ifconfig command, use the man command.
Here are some examples of how the ifconfig command can be used:
- To display information about the network interface parameters of your system: ifconfig -a
- To display information about a specific network interface: ifconfig eth0
- To assign an IP address to a network interface: ifconfig eth0 10.10.10.10
- To enable or disable an interface: ifconfig eth0 up/down
- To set the default gateway: route add default gw 192.168.1.1
Conclusion
The ifconfig command is an essential tool for configuring, viewing, and troubleshooting any networking related issues in Linux. It can be used to configure an interface, set the IP address, set the default gateway, enable or disable an interface, and more. For more information about the ifconfig command, refer to the man page.