sharing mobile data through usb tethering
(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.


Yes it worked.

I endded up by performing an ipv6 nat :


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

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)

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).

Messages In This Thread
RE: sharing mobile data through usb tethering - by deb75 - 02-25-2022, 04:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Mobile internet via cellular network mostly not working Anna 18 9,274 01-19-2024, 02:59 AM
Last Post: anonymous
  4G data on default startup / boot dcinoz 1 746 04-29-2023, 11:24 PM
Last Post: dcinoz
  Block firefix-esr-mobile-config from (re)installing itself grump_fiddle_reinstall 3 1,391 01-07-2023, 09:36 AM
Last Post: dcarvil
Exclamation No modems were found: No mobile data, no 2G anonymous 2 1,197 12-26-2022, 06:46 PM
Last Post: anonymous
  very slow processing of MMS received via Ting (T-Mobile) treebeard 6 2,266 12-01-2022, 09:18 AM
Last Post: traut
  DNS Problems with Mobile Data arno_nuehm 29 15,895 10-29-2022, 09:16 AM
Last Post: treebeard
  Amberol Mobile Music player(flatpak) biketool 0 862 06-19-2022, 07:16 AM
Last Post: biketool
  Cellular data is working! drh 0 802 05-15-2022, 09:02 AM
Last Post: drh
  Reskinning Apps for Mobile biketool 6 3,215 12-05-2021, 02:30 PM
Last Post: biketool
  Mobile network mode setting not saved Zebulon Walton 3 2,916 12-05-2021, 12:12 AM
Last Post: bcnaz

Forum Jump:

Users browsing this thread: 1 Guest(s)