Linux Create Fake Ethernet Interface
There could be numerous reasons to create a fake Ethernet interface on a Linux server though I have heard that people might do so to get around licensing of software that is tied to the MAC address of a specific Ethernet port. You really just enable a dummy Ethernet interface and assign the MAC address to it which is explain in more detail below. The easiest way to do this is to simply assign a MAC address to an Ethernet interface you are not using on your server where the drivers have already been installed automatically. If you do not have a spare Ethernet interface then the instructions below will assist you to accomplish your goal.
The below example commands were done on BackTrack Linux version 5 Release 3 which is still based off of Ubuntu 10.04 LTS.
Create Fake Ethernet Interface On Linux:
- Initialize Dummy Interface Driver: First initialize the dummy interface driver using the below command.
- Assign Ethernet Interface To Dummy Driver: Now run the below command to associate an Ethernet interface alias to the driver we just initialized above.
/sbin/ip link set name eth10 dev dummy0
- Set MAC Address On Fake Ethernet Interface: Once the Ethernet interface has been associated to the dummy driver you can now set the MAC address of the interface to be whatever you would like it to be using the command below.
/sbin/ifconfig eth3 hw ether 00:22:22:ff:ff:ff
- Restart Networking: Now restart networking using the init.d networking script using the example command noted below.
- Modify rc.local To Create Interface On Boot: After networking was started using the command above the interface is now active and should server its purpose however you will need to add the below lines to rc.local before the “exit 0” so the fake Ethernet interface is set when the server reboots.
## add dummy ethernet interface /sbin/modprobe dummy /sbin/ip link set name eth10 dev dummy0 /sbin/ifconfig eth10 hw ether 00:22:22:ff:ff:ff
The above four lines should be added to /etc/rc.local using your favorite text editor which in my case is vi. Now when the server reboots the rc.local file will be processed and the fake Ethernet interface or eth10 will be recreated.
You have now not only created a fake Ethernet interface but also made sure that the interface will come online every time the server reboots. Again the above commands are based specifically on BT5r3 or Ubuntu Linux 10.04 but it should be easy to port them to other Linux distributions such as CentOS Linux.