meta data for this page
PinePhone as Modem
Configure Mobile Data
Go to Settings » Mobile » Mobile Data » Access Points » [+] button
Add network name and APN, e.g. Name: 3 internet APN: three.co.uk
Sharing 4G with Hotspot
Run and create new hotspot connections with SSID `Pinephone` and Password `HotspotPassword`:
sudo nmcli device wifi hotspot ifname wlan0 con-name Hotspot ssid Pinephone password HotspotPassword
Stop the hotspot from NetworkManager. To restart your hotspot you can use the 3 dots menu “Connect to hidden network”
Sharing internet from your PC via USB
Set up ip-forwarding on your PC and configure your USB ethernet device's IP:
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward sudo iptables -A POSTROUTING -t nat -s 10.0.0.0/24 -j MASQUERADE sudo iptables -P FORWARD ACCEPT sudo ip addr add dev $USB_INTERFACE 10.0.0.1/24
where you should replace $USB_INTERFACE
by the name of your interface (e.g enp7s0u1c2
or usb0
)
You need to install pinephone-devtools
on your phone and set the correct DNS server in /etc/resolv.conf
:
sudo apt install pinephone-devtools cat << EOF | sudo tee /etc/resolv.conf search $LOCAL_DOMAIN nameserver $LOCAL_DNS_IP EOF
where you should replace $LOCAL_DOMAIN
by your local domain (e.g local
)
and $LOCAL_DNS_IP
by a valid DNS server (e.g 192.168.1.1
or 9.9.9.9
)
Note: If you only just installed pinephone-devtools
you might need to restart the PinePhone once. Since the pinephone-devtools also enable SSH access to the phone it is strongly recommended to change your passwords first.
Network overlap with 10.0.0.0/8
When connecting a Mobian device to a computer via USB-C, Mobian is configured to use the IP address 10.66.0.1, in the subnet 10.0.0.0/8. This can cause an issue if Mobian is also connected to a wifi network which utilizes a subnet within the same 10.0.0.0/8 subnet. The configuration of the USB connection could be changed to use a different or smaller subnet, or a more specific route can be configured for the wifi connection to account for this special case. Here is how to add a persistent more specific route.
- Connect the Mobian device via USB-C to a computer, and SSH into it (see Connect via USB-C and SSH)
- Connect the Mobian device to the desired wifi network
- Identify the name of the wifi network in Network Manager
$ nmcli connection NAME UUID TYPE DEVICE USB a3ee13d7-85ce-4386-8ba9-419a67309692 ethernet usb0 wifi-network-name bfe0a288-f193-4eeb-ba00-7d6f15ec27f6 wifi wlan0
- Add a more specific route for the destination network, using the wifi network's name and gateway IP address
$ sudo nmcli connection modify wifi-network-name +ipv4.routes "10.45.89.128/25 192.168.0.1" +ipv4.route-metric 25
- 10.45.89.128/25 - This is the destination network, swap in whatever the desired network is
- 192.168.0.1 - This is the gateway to use for that network, in this case it's the wifi network's gateway.
- wifi-network-name - This is the name of the wifi network.
- Reload the connection configuration
$ sudo nmcli connection reload wifi-network-name
- It should now be possible to route packets to the destination network successfully over the wifi connection, instead of using the USB-C network connection.
- The route table should look something similar to this:
$ ip route default via 192.168.0.1 dev wlan0 proto dhcp metric 25 10.0.0.0/8 dev usb0 proto kernel scope link src 10.66.0.1 metric 25 10.45.89.128/25 via 192.168.0.1 dev wlan0 proto static metric 25 192.168.0.0/24 dev wlan0 proto kernel scope link src 192.168.0.101 metric 25