2025-06-30 Configuring FreeBSD to network with a postmarketos phone over usb
If you run a postmarketOS device one thing you might run into is trying to connect to the phone when the wifi is not working. Luckily postmarketOS statically configures a USB network interface automatically. USB network is also available in FreeBSD via cdce device driver however unlike linux, it requires a little configuration to get going (my experience has been that plugging a postmarketOS device into linux will autoconfigure the usb network so you can automatically connect to the statically configured postmarketOS USB network device (by default that is 172.16.42.1)
The following shows an example of plugging in the usb interface of the Motorola Moto G4 play (motorola-harpia) into a FreeBSD machine and getting FreeBSD to communicate with the postmarketOS device.
Hardware Prerequisites:
A Motorola Moto G4 Play with postmarketOS installed
A FreeBSD machine with an available USB port
A micro USB cable to connect phone and computer
First step, connect the cable.
After connecting the cable, check the output from dmesg. You should see output like the following. Note the entry for ue0 which is the usb network interface that will be created when plugging
ugen0.4: <Motorola Motorola Moto G4 Play> at usbus0
cdce0 on uhub0
cdce0: <Motorola Motorola Moto G4 Play, class 0/0, rev 2.00/6.12, addr 6> on usbus0
ue0: <USB Ethernet> on cdce0
ue0: Ethernet address: 1a:86:31:59:b4:d5
ugen0.4: <Motorola Motorola Moto G4 Play> at usbus0 (disconnected)
cdce0: at uhub0, port 1, addr 6 (disconnected)
cdce0: detached
ugen0.4: <Motorola Motorola Moto G4 Play> at usbus0
cdce0 on uhub0
cdce0: <Motorola Motorola Moto G4 Play, class 0/0, rev 2.00/6.12, addr 7> on usbus0
ue0: <USB Ethernet> on cdce0
ue0: Ethernet address: 1a:86:31:59:b4:d5
You can also check it shows up by running ifconfig. Note that the mac address for the usb ethernet is usually randomized.
$ ifconfig ue0
ue0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=80000<LINKSTATE>
ether 1a:86:31:59:b4:d5
media: Ethernet autoselect
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Configure the ue0 interface
$ doas ifconfig ue0 172.16.42.11 netmask 255.255.0.0
Check that you can ping the postmarketOS device
$ ping -c 1 172.16.42.1
PING 172.16.42.1 (172.16.42.1): 56 data bytes
64 bytes from 172.16.42.1: icmp_seq=0 ttl=64 time=1.625 ms
--- 172.16.42.1 ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 1.625/1.625/1.625/0.000 ms
If the ping returns succesfully like the example above that means you should be able to connect to the postmarketOS device (ssh is enabled by default and the wiki has more information on what the default logins are. I would suggest setting up ssh key-based authentication as soon as possible).
Enjoy!