sharing mobile data through usb tethering
#1
Hello,

I am able to connect to the pinephone through USB from my laptop, but then I have no internet connexion
from my laptop.

The mobile data on the pinephone is enabled. Within a ssh session I can ping google as an example.

What am i missing ?

Also, I noticed that my FAI is only giving me an ipv6 address :

Code:
wwan0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
        inet6 2a04:cec0:10c8:f8e:5c88:c307:fa17:d9e2  prefixlen 64  scopeid 0x0<global>
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 257  bytes 35979 (35.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 274  bytes 27084 (26.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  Reply
#2
Some carriers control/or block tethering
      LINUX = CHOICES
         **BCnAZ**
               Idea
   Donate to $upport
your favorite OS Team
  Reply
#3
A script to try
Code:
#!/bin/bash
# Share the  internet connection from wwan0 through usb0

case "$1" in
    start)
ip link set usb0 up
ip a add 192.168.99.1/24 dev usb0
iptables --table nat --append POSTROUTING --out-interface wwan0 -j MASQUERADE
iptables --append FORWARD --in-interface usb0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "Set your PC's networking to"
echo "192.168.99.0/24"
echo "gateway 192.168.99.1"
echo "dns 192.168.99.1"   
;;
    stop)
echo 0 > /proc/sys/net/ipv4/ip_forward
ip link set usb0 down
iptables --table nat --delete POSTROUTING --out-interface wwan0 -j MASQUERADE
;;
    *)
echo "To start or stop sharing script usage: $0 {start|stop}"
;;
esac


Might need little changes. Easy to turn into touch friendly yad gui. Easy script to gui examples https://puri.sm/posts/easy-librem-5-app-...creenshot/ && https://puri.sm/posts/easy-librem-5-app-...he-screen/ Please improve and share.
  Reply
#4
Thanks for yous answeer.

I will try the script you provided, but I doubt it will work because the forward iptable rules operates on the ipv4 stack
whereas my wwan interface has only a ipv6 address. I do not think they can communicate, as far as I understand.
  Reply
#5
(02-10-2022, 09:39 AM)deb75 Wrote: Thanks for yous answeer.

I will try the script you provided, but I doubt it will work because the forward iptable rules operates on the ipv4 stack
whereas my wwan interface has only a ipv6 address. I do not think they can communicate, as far as I understand.

Did the  script work? ipv6  wwan address should not be of concern.
  Reply
#6
(02-25-2022, 12:57 AM)vusra Wrote:
(02-10-2022, 09:39 AM)deb75 Wrote: Thanks for yous answeer.

I will try the script you provided, but I doubt it will work because the forward iptable rules operates on the ipv4 stack
whereas my wwan interface has only a ipv6 address. I do not think they can communicate, as far as I understand.

Did the  script work? ipv6  wwan address should not be of concern.

Hi,

Yes it worked.

I endded up by performing an ipv6 nat :

Code:
#!/bin/sh
PATH='/sbin'

if [ "x$1" != "xusb0"] || [ "x$2" != "xup" ];
then
    return 0
fi

sysctl -w net.ipv6.conf.usb0.accept_ra=2
sysctl -w net.ipv6.conf.usb0.autoconf=1

# Allow all incoming traffic from local area network interface.
ip6tables -t filter -A INPUT -i usb0 -m conntrack --ctstate NEW -j ACCEPT

# Enable access traffic, from the firewall to the LAN network
ip6tables -t filter -A OUTPUT -o usb0 -m conntrack --ctstate NEW -j ACCEPT

# Forward packages from the internal network (usb0) to the internet (wwan0).
ip6tables -t filter -A FORWARD -i usb0 -o wwan0 -m conntrack --ctstate NEW -j ACCEPT

# Masquerade packets going into the internet (wwan0).
ip6tables -t nat -A POSTROUTING -o wwan0 -j MASQUERADE

# Allow ssh from usb0
ip6tables -t filter -A INPUT -i usb0 -p tcp --dport 22 -m conntrack --ctstate NEW -j ACCEPT

Also, I set up radvd : (/etc/radvd.conf)

Code:
interface usb0 {
        AdvSendAdvert on;
        MinRtrAdvInterval 3;
        MaxRtrAdvInterval 10;
        prefix fd00:2016:22:dec::/64 {
                AdvOnLink on;
                AdvAutonomous on;
                AdvRouterAddr on;
        };
};

The prefix above is the ULA (Unique Local Address) ipv6 of the usb0 interface.

There should be a better way as one of the ipv6 goal is to eliminate the need of network address translation (nat).
  Reply
#7
ipv6 is a privacy  calamity. Avoid it while you can.   Create a  .conf file in /etc/NetworkManager/conf.d/   comprising  of
Code:
[connection]
ipv6.ip6-privacy=2
 
to pseudo randomize your ipv6 mac.  Our community  should  create a list of   mobian configuration changes to improve privacy.
  Reply
#8
I haven't done it on the Pinephone yet, but on all my other Linux systems I've disabled IPv6 in the kernel. In /etc/default/grub you should find a line similar to the following though it may have other options:

Code:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Add ipv6.disable=1 to that line:

Code:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1"

Run sudo update-grub, reboot, and no more IPv6. I have not found a need for IPv6 to be active on my router or any of my desktop or laptop computers but don't know if it would affect cellular data on the phone. (I don't use cellular data so that doesn't affect me.)
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pinephone seems tobe using 4G data instead of Wifi data grump_fiddle_reinstall 1 801 06-25-2024, 10:38 AM
Last Post: mikehenson
  Mobile internet via cellular network mostly not working Anna 18 13,596 01-19-2024, 02:59 AM
Last Post: anonymous
  4G data on default startup / boot dcinoz 1 1,192 04-29-2023, 11:24 PM
Last Post: dcinoz
  Block firefix-esr-mobile-config from (re)installing itself grump_fiddle_reinstall 3 2,225 01-07-2023, 09:36 AM
Last Post: dcarvil
Exclamation No modems were found: No mobile data, no 2G anonymous 2 1,966 12-26-2022, 06:46 PM
Last Post: anonymous
  very slow processing of MMS received via Ting (T-Mobile) treebeard 6 3,684 12-01-2022, 09:18 AM
Last Post: traut
  DNS Problems with Mobile Data arno_nuehm 29 21,138 10-29-2022, 09:16 AM
Last Post: treebeard
  Amberol Mobile Music player(flatpak) biketool 0 1,165 06-19-2022, 07:16 AM
Last Post: biketool
  Cellular data is working! drh 0 1,065 05-15-2022, 09:02 AM
Last Post: drh
  Reskinning Apps for Mobile biketool 6 4,376 12-05-2021, 02:30 PM
Last Post: biketool

Forum Jump:


Users browsing this thread: 2 Guest(s)