How make a bridge to share modem from the Librem 5 to a linux computer

Hello everybody.
I search everywhere, a way to make a bridge on the Librum 5 to share 4G Internet connection with my Librum 13 (by wifi or usb).

I try a classical bridge, with bridge-utils, but no success (https://wiki.debian.org/BridgeNetworkConnections#Configuring_bridging_in_.2Fetc.2Fnetwork.2Finterfaces)

Apparently, it’s the modemmanager who is manage the 4G connection.
Someone has an idea to do that, because I don’t find anything to make it work.

Thank’s.

2 Likes

To use your librem 5 as a wifi hotspot :

  • Go to ‘Settings’ > ‘Wi-Fi’
  • Hit the 3 dot button on the top right corner
  • ‘Turn On Wi-Fi hotspot’
  • Choose name and password
  • Hit the ‘Turn On’ button

For a more advanced hotspot creation, in the terminal start the following command :

nm-connection-editor

You may need to change the resolution of your screen to proceed

It will start a graphical interface to configure the hotspot

  • Hit the ‘+’ button un the bottom left
  • Choose type : Wi-Fi, then hit ‘create’ button
  • Give the name of your wanted hotspot in the ‘SSID’ entry (you should put the same in ‘Connection name’, but it’s optionnal)
  • Change ‘Mode’ to hotspot
  • Go to ‘Wi-Fi Security’ tab
  • Change ‘Security’ to ‘WPA & WPA2 Personal’ or any other specific to your needs
  • Put the wanted password
  • Change any other required settings to your specific needs in the other tabs
  • Hit the ‘Save’ button

To enable this new hotspot go back ‘Settings’ > ‘Wi-Fi’ > Hit the 3 dot button on the top right corner, etc…

4 Likes

BUT If you want to create a hotspot WiFi with your Librum (Lithium - Brum ?)

I don’t think you can :clown_face:

1 Like

LoL thanks fralb5, yes I find this wifi hotspot option.
mm-connection-editor is interesting, I will try.

But yeah, my big question is : how share 4G connection from Librum 5 to a computer :smiley:

3 Likes

You can, but it’s currently a bit involved. It’s much easier to set up tethering via USB, since both the phone and PC talk to each other just as if the USB cable was an Ethernet connection, so standard techniques of configuration apply.

3 Likes

Sorry seems like you missed my (bad) joke about the car called ‘brum’ sharing WiFi :wink:

But so it means that the hotspot option doesn’t actually share the available internet connection ? (I can’t test yet I don’t have data activated on my SIM yet)
It would mean creating some routes or iptable rules to be able to ?

I have absolutely no idea how to do that, do you have some easy steps to do that ? Or some key word to search ?

3 Likes

USB network is already present when you plug in a booted Librem 5. Then you proceed as if it was just a regular Ethernet connection.

1 Like

Awesome ! Then it means @MArty just has to plug his Librem 5 with the USB cable to his Librem 13 to get the 4G connection ?

1 Like

No, the IP addresses and inter-network forwarding still need to be configured as desired.

2 Likes

Did someone preserve the 3rd Doctor’s yellow car to make that or is it just CGI?

I want to do that too, but I haven’t figured it out yet. I’ll post here if I manage to get USB tethering working.

It would be super nice if you could post a link on how to do this. I’ve tried many things and failed. I’ve tried this for instance, https://wiki.archlinux.org/index.php/Internet_sharing. I’m typing on the L5 since I don’t have a keyboard or screen to attach, so it is quite some typing to do to test things like this. It would be nice to know that I’m on the right track… :slight_smile:

Sadly, I can’t find a link with graphical steps but:

  • the L5 connects to DHCP over USB automatically
  • KDE Plasma has a GUI to set up a “shared” connection in a few clicks

Those together is how I connect my L5 via USB to the internet.

I’m not going to post a link to anything specific in the other direction cause I don’t have the time to test it, and there’s too many tutorials, low level, high level, etc.

What I can say for sure is that we’re preparing a GUI for the Librem 5 to make this more automatic on that side.

7 Likes

Thanks at all !!!
I will look around the DHCP to make it work.
I notice this post when I find something.

Assuming your cellular provider has you on an IPv4 network, you can share your cellular connection via USB tethering by setting the USB connection to shared and adding a NAT masquerade rule.

I found it easiest to modify the “ethernet-usb0” connection that is created when you attach the phone to a PC. Attach the phone to your PC, then from the terminal enter…

nmcli con mod ethernet-usb0 ipv4.method shared

Then re-activate the connection, you can try nmcli con up ethernet-usb0, but you will probably have to physically disconnect then reconnect the phone to the PC at this point for the PC to pick up an IP address from the phone.

The phone will provide the PC with an IP address in the default 10.42.0.0/24 range, do double check that it does not overlap with the subnet your cellular providers network.

You also need to add a NAT masquerade rule, this should be done automatically by NetworkManager when setting the shared connection but for what ever reason that is not the case on the phone at the moment.

Assuming you are using the default 10.42.0.0/24 IP range, from the terminal enter…

sudo iptables-legacy -t nat -A POSTROUTING -s 10.42.0.0/24 ! -d 10.42.0.0/24 -o wwan0 -j MASQUERADE

This would apply the masquerade rule on the modem interface only, the -o wwan0 should be omitted for the rule to be applied to all interfaces which would most likely be desired.

As far as I can tell at the moment, IPv6 is a little bit more of a game and requires a few workarounds, I haven’t needed it myself so I haven’t looked to deep into it.

To get the phone back to default state, you just have to set the ethernet-usb0 connection back to auto…

nmcli con mod ethernet-usb0 ipv4.method auto

And remove the NAT masquerade rule, assuming you had no other rules in place…
sudo iptables-legacy -t nat -D POSTROUTING 1

5 Likes