Ifconfig is acronym of “Interface configuration” for System and network administration in Linux/Unix operating system. You can configure network interface parameters via command line. ifconfig commands can be used in many purposes; you can change IP address ifconfig, display network configuration information, enable or disable network interface, and set up hardware address.
There are more than ten utilities of ifconfig commands. We will take some of them with examples. Of course we will begin by clarifying how to change IP address ifconfig.
How to change IP address ifconfig?
If you want to change IP address ifconfig, assign an IP address to a specific interface with interface name “eth0” and put IP address that you want for example “ifconfig eth0 172.16.25.125. Use the following command:
[root@tecmint ~]# ifconfig eth0 172.16.25.125
If you want net mask your network interface, you can change IP address ifconfig and use netmask command. You will combine with these two commands (ifconfig, netmask). For example “ifconfig eth0 netmask 255.255.225.223”
[root@tecmint ~]# ifconfig eth0 netmask 255.255.255.224
Other utilities of ifconfig command
Now after you knew how to change IP address ifconfig, we will take a quick look on other usages of this useful ifconfig command.
Use ifconfig command to assign a broadcast to network interface:
You will use this command in the same way you used other commands. For example “ifconfig eth0 broadcast 188.8.131.52”.
[root@tecmint ~]# ifconfig eth0 broadcast 184.108.40.206
You can combine between these three usages, assign IP, netmask, and assign a broadcast to network interface:
If you want to use these three at once via ifconfig command, type this command line
[root@tecmint ~]# ifconfig eth0 172.16.25.125 netmask 255.255.255.224 broadcast 172.16.25.63
You can change MTU for network interface via ifconfig command as follow:
The MTU allows you to set the limit size of packets that are transmitted on a network interface. For example “ifconfig eth0 mtu 2000” you set the limit of transmission until 2000 “e.g.2000”.
[root@tecmint ~]# ifconfig eth0 mtu 1000
How to change the mac address of network interface via ifconfig
To change media access control address of network interface, use this command with argument “hw ether”.
[root@tecmint ~]# ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF
These are some of the most utilities of ifconfig command.