ifconfig is an interface configuration program for system and network management in the Unix/linux operating system. You can configure, manage, and query network interface parameters on the command line interface (CLI) or system configuration scripts. The ifconfig command displays the current network configuration. You can set an IP address, network mask, or broadcast address for a network interface, create an alias for a network interface, set a hardware address, and enable or disable a network interface.
Lists network interfaces in linux, including assigned IP addresses, network masks, and other related information:
$ ifconfig
Displays all network interface information, with the parameter ifconfig a displays all active or inactive network interface information on the server, displaying the results of eth0\Io, sit0, and tun0:
ifconfig -a
View network Settings for a specific interface. Using the interface name as a parameter to the ifconfig command displays specific network interface details:
ifconfig eth0
The "up" or "ifup" flag with the interface name activates the network interface and allows information to be sent and received, for example, "ifconfig eth0 up" or "ifup eth0" activates the eth0 interface.
ifconfig eth0 up
or
ifup eth0
To disable a network interface, run the ifconfig eth0 down or ifdown eth0 command to disable the inactive eth0 interface.
ifconfig eth0 down
perhaps
ifdown eth0
Assign IP addresses to network interfaces and set interface names. For example, ifconfig eth0 188.16.25.125 "sets the IP address for eth0.
ifconfig eth0 188.16.25.125
Assign a netmask to a network interface, and the ifconfig command with the netmask parameter and the interface name defines the netmask for a given interface. For example, ifconfig eth0 netmask 233.233.233.224 sets the netmask for the given interface eth0.
[root@tecmint ~]# ifconfig eth0 netmask 233.233.233.224
Assign IP addresses, network masks, and broadcast addresses to network interfaces:
ifconfig eth0 172.16.25.125 Network mask 233.233.233.224 Broadcast 172.16.25.63
Change the MTU of the network interface. mtu indicates the maximum transmission order of the interface. MTU Allows you to set the maximum size of packets transmitted on an interface. The MTU can process a maximum of 8 bytes on an interface at a time.
For example, ifconfig eth0 mtu 1000 sets the maximum transmission unit to a given set (i.e. 1000). Not all network interfaces support MTU Settings.
ifconfig eth0 mtu 1000
Enable Promiscuous mode:
ifconfig eth0 promisc
Disable promiscuous mode:
ifconfig eth0 -promisc
Add a new alias to the network interface. The alias network address needs to be in the same subnet mask. For example, if your eth0 network IP address is 172.16.25.125, the alias IP address must be 137.16.25.127.
ifconfig eth0:0 137.16.25.127
Verify the newly created alias network interface address with the "ifconfig eth0:0" command:
ifconfig eth0:0
Delete network interface aliases:
ifconfig eth0:0 down
How to change the MAC address on a network interface, change the MAC address of a eth0 network interface:
ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF