How to Use ifconfig to set MAC address in Linux, Unix, FreeBSD etc.

Linux has a built-in command ifconfig that is used to configure wired network interfaces. In this article I am going to give the example commands to setup MAC address manually.

How to Setup MAC address using ifcofig:

Use the below commands in sequence to setup the MAC address on your Linux or Unix or BSD machine.
I am assuming eth0 is the ethernet link on your machine. You can use the below command to see all interfaces present on the machine:
ifconfig -a
Once you fogure out the actual interface name you can replace it with eth0 and proceed using the other commands.

ifconfig eth0 up
ifconfig eth0 192.168.0.3
ifconfig eth0 192.168.0.3 hw ether 00:99:27:90:B4:22
ifconfig eth0 down
ifconfig eth0 hw ether 00:99:27:90:B4:22
ifup eth0

Leave a comment

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