I got it working on Ubuntu Server 64bit with the following setup:
Code: Select all
ubuntu@ubuntu:~$ uname -a
Linux ubuntu 5.8.0-1006-raspi #9-Ubuntu SMP PREEMPT Fri Oct 16 12:55:30 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux
installed today with the raspberry pi imager and selecting the Ubuntu 20.10 Server image
After writing the image to disk edit on the disk:
config.txt and add
dtoverlay=dwc2,dr_mode=peripheral
In cmdline.txt add
modules-load=dwc2,g_ether
after the rootwait with only one space in between as already discussed.
Adapt your network.config
Code: Select all
version: 2
ethernets:
eth0:
# Rename the built-in ethernet device to "eth0"
match:
driver: bcmgenet smsc95xx lan78xx
set-name: eth0
dhcp4: true
optional: true
usb0:
dhcp4: false
optional: true
addresses: [10.55.0.1/29]
wifis:
wlan0:
dhcp4: true
dhcp6: false
optional: true
access-points:
"MyHomeNet":
password: "MyPassword"
"MyOtherHomeNet":
password: "MyOtherPassword"
create '/etc/dnsmasq.d/usb
interface=usb0
dhcp-range=10.55.0.2,10.55.0.6,255.255.255.248,1h
dhcp-option=3
leasefile-ro
port=0
and uncomment the last line in /etc/default/dnsmasq
# If the resolvconf package is installed, dnsmasq will tell resolvconf
# to use dnsmasq under 127.0.0.1 as the system's default resolver.
# Uncommenting this line inhibits this behaviour.
DNSMASQ_EXCEPT="lo"
See here for an explanation:
https://askubuntu.com/questions/818205/ ... ctionality
after reboot I have and you should also have:
Code: Select all
ubuntu@ubuntu:~$ ifconfig usb0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.55.0.1 netmask 255.255.255.248 broadcast 10.55.0.7
inet6 fe80::f084:4fff:fee9:3222 prefixlen 64 scopeid 0x20<link>
ether f2:84:4f:e9:32:22 txqueuelen 1000 (Ethernet)
RX packets 539 bytes 93361 (93.3 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 128 bytes 19380 (19.3 KB)
TX errors 0 dropped 14 overruns 0 carrier 0 collisions 0
and also
Code: Select all
ubuntu@ubuntu:~$ systemctl status dnsmasq
? dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-11-02 19:01:42 UTC; 26min ago
Process: 1701 ExecStartPre=/etc/init.d/dnsmasq checkconfig (code=exited, status=0/SUCCESS)
Process: 1752 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
Process: 1765 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
Main PID: 1763 (dnsmasq)
Tasks: 1 (limit: 9255)
CGroup: /system.slice/dnsmasq.service
+-1763 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -I lo -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service --trust-anchor=.,20326,8,2,e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d
Nov 02 19:20:14 ubuntu dnsmasq-dhcp[1763]: DHCPREQUEST(usb0) 10.55.0.6 ea:78:xx:xx:xx:3f
Nov 02 19:20:14 ubuntu dnsmasq-dhcp[1763]: DHCPACK(usb0) 10.55.0.6 ea:78:xx:xx:xx:3f MyIPad
Nov 02 19:26:12 ubuntu dnsmasq-dhcp[1763]: DHCPDISCOVER(usb0) ea:78:xx:xx:xx:3f
and also
Code: Select all
ubuntu@ubuntu:~$ modinfo g_ether
filename: /lib/modules/5.8.0-1006-raspi/kernel/drivers/usb/gadget/legacy/g_ether.ko
license: GPL
author: David Brownell, Benedikt Spanger
description: RNDIS/Ethernet Gadget
srcversion: C7B1A05BBF09AA2ACF8D58C
depends: libcomposite,u_ether,usb_f_rndis
intree: Y
name: g_ether
vermagic: 5.8.0-1006-raspi SMP preempt mod_unload aarch64
sig_id: PKCS#7
signer: Build time autogenerated kernel key
sig_key: 57:72:20:5E:A7:F3:46:4E:67:11:E4:1A:24:34:4B:40:ED:02:E3:C1
sig_hashalgo: sha512
signature: 99:29:05:E2:71:81:90:0C:F2:60:5A:06:F9:7F:3E:D1:5B:AC:C5:2F:
...
46:5B:EA:96:30:5A:70:C3:DC:26:E9:33
parm: idVendor:USB Vendor ID (ushort)
parm: idProduct:USB Product ID (ushort)
parm: bcdDevice:USB Device version (BCD) (ushort)
parm: iSerialNumber:SerialNumber string (charp)
parm: iManufacturer:USB Manufacturer string (charp)
parm: iProduct:USB Product string (charp)
parm: qmult:queue length multiplier at high/super speed (uint)
parm: dev_addr:Device Ethernet Address (charp)
parm: host_addr:Host Ethernet Address (charp)
parm: use_eem:use CDC EEM mode (bool)
On the iPad Pro (iPadOs 14.01) I do now see an Ethernet-Adapter "RNDIS/Ethernet Gadget" with IP 10.55.0.6 and subnetmask 255.255.255.248 and can indeed connect to the raspberry via ssh under 10.55.0.1
Note this is not the address under which the gadget is listed, but the one which we assigned statically and which ifconfig tells you for usb0.
Hope that still help somebody. So it appears as if one does not need the shell usb.sh script that modifies the parameters of g_ether for connecting to an Ipad. I have yet to establish connection with a windows pc and as of now, the raspberry pi is not even recognized when I plug it in. But maybe that is a topic for another thread.