Useful “ifconfig” Commands to Configure Network Interface in Linux

·         View All Network Setting

Ifconfig

 

·         Display Information of All Network Interfaces

ifconfig –a

 

·         How to Enable an Network Interface

[root@tecmint ~]# ifconfig eth0 up

OR

[root@tecmint ~]# ifup eth0

 

·         How to Assign a IP Address to Network Interface

ifconfig eth0 192.168.25.125

 

·         How to Assign a Netmask to Network Interface

ifconfig eth0 netmask 255.255.255.224

 

·         How to Assign a Broadcast to Network Interface

ifconfig eth0 broadcast 192.168.25.1

 

·         How to Assign a IP, Netmask and Broadcast to Network Interface

ifconfig eth0 192.168.25.125 netmask 255.255.255.224 broadcast 192.168.25.1

 

·         How to Change MTU for an Network Interface

ifconfig eth0 mtu 1000

 

·         How to Enable Promiscuous Mode

ifconfig eth0 promisc

 

·         How to Disable Promiscuous Mode

ifconfig eth0 –promisc

 

·         How to Add New Alias to Network Interface

ifconfig eth0:0 192.168.25.125

 

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

ifconfig eth0:0

 

·         How to Remove Alias to Network Interface

ifconfig eth0:0 down

 

·         How to Change the MAC address of Network Interface

ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF