Modem Manager set bearer and connect automatically
You can register your connection using the NetworkManager instead.
I dont have the same setup. I am on Ubuntu with a gsm modem.
Create the connection
sudo nmcli c add con-name "mycon" type gsm ifname "*" apn "internet.t-d1.de"
Set autoconnect
sudo nmcli c mod mycon connection.autoconnect yes
Username and password
sudo nmcli c mod mycon gsm.username "t-mobile"
sudo nmcli c mod mycon gsm.password "tm"
On Ubuntu, the NetworkManager config file are in the /etc/NetworkManager/system-connections/ folder.
sudo cat /etc/NetworkManager/system-connections/mycon
Start the connection
sudo nmcli c up mycon
The connection should start automatically now.
Related videos on Youtube
edermi
Updated on September 18, 2022Comments
-
edermi over 1 year
I'm trying to set up a Huawei E3276 LTE stick with German Telekom and Modem Manager on Raspberry Pi (latest Raspbian), and basically it works but I'm failing to create a configuration that is deployable to the RPi via ansible.
When I connect the LTE stick, ModemManager sets everything up correctly and I end with a wwan0 interface and a 169.254.0.0/16 address assigned to it. Afterwards, I always have to run
sudo mmcli -m 0 --simple-connect="apn=internet.t-d1.de,user=t-mobile,password=tm,number=*99#"
which triggers network manager to get me somehow an IP. Everything's fine.Since I want to automate this, I want to get rid of manually executing the mmcli command but am currently failing.
- Option 1: cronjob and script - ugly but most likely to work. I want to avoid this
- Option 2: Configuration file for modem manager / mmcli. I did not find any configuration file where I can place this data
Option 3: udev rule executing the command
pi@raspberrypi:~ $ cat /etc/udev/rules.d/90-lte.rules ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="0c:5b:8f:27:9a:64", RUN+="/usr/local/bin/lte_setup.sh" pi@raspberrypi:~ $ cat /usr/local/bin/lte_setup.sh #!/bin/sh sleep 2 mmcli -m 0 --simple-connect='apn=internet.t-d1.de,user=t-mobile,password=tm,number=*99#'
This doesn't work and I don't actually know why.
So, the basic question: What is the simplest way to deploy this configuration/scripts via ansible to the Raspberry Pi in order to just get a public IP automatically via Modem-/NetworkManager after pluging the E3276 in?
One last thing: I am not searching for a solution using wvdial or other tools. I spent days trying to use them using "working" configurations from the Internet just to find out they are not working. ModemManager and NetworkManager have proven to work, so I'm just trying to complete the setup without building the ugly cronjob workaround.
-
edermi over 6 yearsSeems like I have to use this workaround, I hope this is somehow scriptable with ansible...
-
Hayden Thring over 2 yearsautoconnect is default yes when you add a connection