USB Gadget Networking (RNDIS/ECM)

RNDIS, CDC-ECM, USB gadget config, IP assignment
Post Reply
felix
Site Admin
Posts: 15
Joined: Sat Oct 04, 2025 4:48 pm

USB Gadget Networking (RNDIS/ECM)

Post by felix »

USB Gadget Networking (RNDIS/ECM)

When you plug your OpenStick into a PC, it appears as a USB Ethernet adapter. This is the primary way to access the device for initial setup.

Default Configuration
By default, the OpenStick uses RNDIS (Remote Network Driver Interface Specification) to create a USB network interface:
  • Device IP: 192.168.200.1
  • Host IP: assigned via DHCP (192.168.200.x)
  • Subnet: 192.168.200.0/24
On your host PC, the device appears as a new network interface (usually usb0 or enp0sXXX).

RNDIS vs ECM
  • RNDIS — Works on Windows, Linux, and macOS (with driver). Default mode.
  • CDC-ECM — Better performance on Linux and macOS. Does not require extra drivers. Recommended if you do not need Windows support.
Switching to ECM Mode
The USB gadget mode is configured via configfs. To switch from RNDIS to ECM, you need to modify the gadget configuration scripts on the device.

Sharing Host Internet to the Stick
If your stick does not have a SIM card, you can share your PC internet:

On the host PC:

Code: Select all

# Enable IP forwarding
sudo sysctl net.ipv4.ip_forward=1

# Set up NAT (replace eth0 with your internet-facing interface)
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT
sudo iptables -A FORWARD -i eth0 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
On the stick:

Code: Select all

sudo ip route add default via 192.168.200.100  # your host IP
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
This is useful for initial setup when you need to download packages but do not have LTE configured yet.
Post Reply