Jump to content

Question about RNDIS and fixec IP and MAC addresses


Recommended Posts

I have LicheeRV Nano (version B), which is a RISC-V computer with SOPHGO SG2002 CPU. Someone ported Debian onto it.


The device acts as an "USB gadget" - when I connect it to my laptop through USB, it identifies itself as USB Ethernet device. This device is running RDNIS.

 

However, when I connect this device to my Ubuntu laptop, I always get new network interface, with different IP (in range 10.42.0.0/24). For instance, once network interface is called "enx8a7df6c752e6", and it's MAC address is "8a:7d:f6:c7:52:e6". Next time it is called "enxd23862ad4ce9", with MAC address pa"d2:38:62:ad:4c:e9", and so on.

 

The dmesg command on my Ubuntu laptop says: `rndis_host 5-2:1.0 enx6232bf7986a1: renamed from usb0`, so it seems that LicheeRV Nano defines MAC address of my laptop USB interface.

 

LicheeRV Nano has four network interfaces:

- lo
- end0, it has "altname" ina form "enx......." (I guess this device sets the network interface name on my laptop)
- tunl0@NONE (state DOWN) - no idea what it does
- usb0, which has fixed IP 10.42.0.1 (I can ssh to LicheeRV Nano from my laptop to that IP)

 

LicheeRV Nano is running NetworkManager. dmesg on LicheeRV Nano says

"using random self ethernet address" and "using random host ethernet address"

 

It is also running systemctl, and among other services are these:
- usb-gadget-acm.service
- usb-gadget-rndis-usb0.service
- usb-gadget-rndis.service
- usb-gadget.target

 

MY QUESTION:

how to persuade this device to set fixed IP to my laptop and fixed MAC address?

 

I tried with g_ether module (I used "options g_ether host_addr=ca:ff:ee:11:11:11 dev_addr=ca:ff:ee:22:22:22"), and my laptop then gets interface "usb0", however MAC addresses of interfacea are still random. dmesg on LicheeRV Nano says:

```

[    8.536909] g_ether: bad vermagic: kernel tainted.
[    8.543525] Disabling lock debugging due to kernel taint
[    8.702640] using random self ethernet address
[    8.707285] using random host ethernet address
[    8.711904] using host ethernet address: ca:ff:ee:11:11:11
[    8.711911] using self ethernet address: ca:ff:ee:22:22:22
[    8.718426] usb0: HOST MAC ca:ff:ee:11:11:11
[    8.728665] usb0: MAC ca:ff:ee:22:22:22
[    8.732707] using random self ethernet address
[    8.737331] using random host ethernet address
[    8.742005] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[    8.748872] g_ether gadget: g_ether ready
[    8.753043] dwc2 4340000.usb: bound driver g_ether

```

 

Also, NetworkManager is managing end0 device only, usb0 us defined in `/etc/network/interfaces.d/usb0 `:

```
allow-hotplug usb0
iface usb0 inet static
    address 10.42.0.1
    netmask 255.255.255.0
```

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines