15 Useful “ifconfig” Commands to Configure Network Interface in Linux

By | June 27, 2018

15 Useful “ifconfig” Commands to Configure Network Interface in Linux

ifconfig in short “interface configuration” utility for system/network administration in Unix/Linux operating systems to configure, manage and query network interface parameters via command line interface or in a system configuration scripts.

The “ifconfig” command is used for displaying current network configuration information, setting up an ip address, netmask or broadcast address to an network interface, creating an alias for network interface, setting up hardware address and enable or disable network interfaces.

This article covers “15 Useful “ifconfig” Commands” with their practical examples, that might be very helpful to you in managing and configuring network interfaces in Linux systems.

1. View All Network Setting

The “ifconfig” command with no arguments will display all the active interfaces details. The ifconfig command also used to check the assigned IP address of an server.

2. Display Information of All Network Interfaces

The following ifconfig command with -a argument will display information of all active or inactive network interfaces on server. It displays the results for eth0, lo, sit0 and tun0.

3. View Network Settings of Specific Interface

Using interface name (eth0) as an argument with “ifconfig” command will display details of specific network interface.

4. How to Enable an Network Interface

The “up” or “ifup” flag with interface name (eth0) activates an network interface, if it is not in active state and allowing to send and receive information. For example, “ifconfig eth0 up” or “ifup eth0” will activate the eth0 interface.

5. How to Disable an Network Interface

The “down” or “ifdown” flag with interface name (eth0) deactivates the specified network interface. For example, “ifconfig eth0 down” or “ifdown eth0” command deactivates the eth0 interface, if it is in active state.

6. How to Assign a IP Address to Network Interface

To assign an IP address to an specific interface, use the following command with an interface name (eth0) and ip address that you want to set. For example, “ifconfig eth0 172.16.25.125” will set the IP address to interface eth0.

7. How to Assign a Netmask to Network Interface

Using the “ifconfig” command with “netmask” argument and interface name as (eth0) allows you to define an netmask to an given interface. For example, “ifconfig eth0 netmask 255.255.255.224” will set the network mask to an given interface eth0.

8. How to Assign a Broadcast to Network Interface

Using the “broadcast” argument with an interface name will set the broadcast address for the given interface. For example, “ifconfig eth0 broadcast 172.16.25.63” command sets the broadcast address to an interface eth0.

9. How to Assign a IP, Netmask and Broadcast to Network Interface

To assign an IP address, Netmask address and Broadcast address all at once using “ifconfig” command with all arguments as given below.

10. How to Change MTU for an Network Interface

The “mtu” argument set the maximum transmission unit to an interface. The MTU allows you to set the limit size of packets that are transmitted on an interface. The MTU able to handle maximum number of octets to an interface in one single transaction. For example, “ifconfig eth0 mtu 1000” will set the maximum transmission unit to given set (i.e. 1000). Not all network interfaces supports MTU settings.

11. How to Enable Promiscuous Mode

What happens in normal mode, when a packet received by a network card, it verifies that the packet belongs to itself. If not, it drops the packet normally, but in the promiscuous mode is used to accept all the packets that flows through the network card.

Most of the today’s network tools uses the promiscuous mode to capture and analyze the packets that flows through the network interface. To set the promiscuous mode, use the following command.

12. How to Disable Promiscuous Mode

To disable promiscuous mode, use the “-promisc” switch that drops back the network interface in normal mode.

13. How to Add New Alias to Network Interface

The ifconfig utility allows you to configure additional network interfaces using alias feature. To add alias network interface of eth0, use the following command. Please note that alias network address in same sub-net mask. For example, if your eth0 network ip address is 172.16.25.125, then alias ip address must be 172.16.25.127.

Next, verify the newly created alias network interface address, by using “ifconfig eth0:0” command.

14. How to Remove Alias to Network Interface

If you no longer required an alias network interface or you incorrectly configured it, you can remove it by using the following command.

15. How to Change the MAC address of Network Interface

To change the MAC (Media Access Control) address of an eth0 network interface, use the following command with argument “hw ether“. For example, see below.

These are the most useful commands for configuring network interfaces in Linux, for more information and usage of ifconfig command use the manpages like “man ifconfig” at the terminal. Check out some other networking utilities below

 

www.pdf24.org    Send article as PDF   
Category: VPS

5 thoughts on “15 Useful “ifconfig” Commands to Configure Network Interface in Linux

  1. cost cytotec tablets

    However, serious adverse effects were also more common in the chemotherapy group than in the radiotherapy group, with treatment related deaths twice as high in the former group, at 4 vs 2 cytotec oral Assessment followed the cause infertility cases

  2. Hairstyles VIP

    Along with every little thing that appears to be building throughout this subject material, many of your perspectives are quite exciting. However, I beg your pardon, because I do not subscribe to your entire theory, all be it stimulating none the less. It would seem to everybody that your remarks are not completely validated and in simple fact you are your self not really entirely confident of the argument. In any event I did appreciate looking at it.

  3. www.xmc.pl

    What you’ve created here is more than just a series of words — it’s a journey. As I read through your work, I felt myself transported, not just through ideas, but through emotions and experiences I didn’t even realize I was missing. Your writing holds a mirror up to life in a way that encourages deep self-reflection, and that, in itself, is a rare and powerful gift.

Leave a Reply

Your email address will not be published. Required fields are marked *