Hard setting RNDIS MAC address¶
Description¶
The RNDIS USB gadget is setup by default to randomly assign a host and device MAC every time it is loaded. For some cases it is necessary to set both to a static address. This guide will show how to do so.
Steps¶
Kernel¶
The RNDIS USB gadget needs to be compiled as a module:
[*] USB support ---> <*> USB Gadget Support ---> USB Peripheral Controller ---> <M> USB Gadget Drivers <M> Ethernet Gadget (with CDC Ethernet support) [*] RNDIS support
Linux¶
Setting up /etc/modules-load.d¶
Now that the RNDIS gadget is compiled as a module, linux needs to be setup to auto load the module on boot.
This can be done by adding a .conf file in /etc/modules-load.d. This file will have the name(s) of the module(s) to be loaded on boot. More than one module can be specified, each module needs to be on its own line in the .conf file.
NOTE: create the directory if it doesn't already exist
Example /etc/modules-load.d/rndis.conf
g_ether
Setting up /etc/modprobe.d¶
The auto loaded module will need the arguments for the MAC addresses passed to it, this is done by adding a .conf file in /etc/modprobe.d.
Example /etc/modprobe.d/rndis.conf
options g_ether host_addr=32:70:05:18:ff:78 dev_addr=46:10:3a:b3:af:d9
The format is options modulename moduleparameters
The dev_addr is the address seen by the embedded device and host_addr is the address seen by the machine connected to the embedded board.
Go to top