Manual Modem Connection

Full control, but carries some risks

We strongly recommend you let the iface manager handle the modem automatically. Don't try these steps unless you have a specific need and you know what you are doing. The main reason you would want to do this is when you need to use a specific APN and the auto-connect script is detecting and using the wrong one.

If you wish to manually define a modem configuration, then do the following steps, in order.

Figure out which mode is active

Simply run the following command to get the current mode

ardexa_modem mode

Find the modem

Find all available modems and establish if you are using legacy or WWAN mode. The following command will attempt to identify all available modems. The output will vary depending on the mode.

ardexa_modem modems

All serial interfaces will be checked to see if they respond to modem commands (that is, AT commands).

/dev/ttyUSB1: definitely NOT a modem
/dev/ttyUSB2: probably NOT a modem
/dev/ttyUSB3: is a modem
/dev/ttyUSB4: is a modem
/dev/ttyUSB0: probably NOT a modem

Find the network code

These are 2 numbers, the mcc (mobile country code) and mnc (mobile network code). To find these numbers, run the following command, using the modem device found in the previous step. There's no need to list the full path (but you can if you like).

# ardexa_modem mc ttyUSB3
['505', '02']

[OPTIONAL] Inspect the available APNs

If you wish to see which APN(s) are being used by the modem, the run the following command using the mcc and mnc from the previous step, for example

ardexa_modem apns 505 02

Create config file

PLEASE NOTE: once you manually create a netctl config file called modem, then iface-manager will NOT attempt to auto-manage the modem.

Creating the file modem in /etc/netctl will configure netctl to use the modem to connect to the Internet. The following is an example configuration. The User and Password parameters are usually not required and can be removed.

The Init parameter is optional and we strongly discourage using it unless absolutely necessary. It is here for demonstration purposes only.

Description='PPP mobile connection'
Connection=mobile_ppp
DefaultRoute=true
UsePeerDNS=true
Mode=None

Interface=ttyUSB3
AccessPointName=internet.t-d1.de
User=''
Password='t-d1'
Init='ATQ0 V1 E1 S0=0'

Tell iface-manager to restart the modem

If access to the internet is lost for any reason, iface-manager will attempt to restart network interfaces (ethernet and wifi) in an attempt to restore access. Since the modem is not a "network interface", iface-manager will ignore it, unless we explicitly tell it to restart the modem if there's no internet access available.

netctl enable modem
cd /etc/netctl
mkdir restart
touch restart/modem
mkdir ignore
touch ignore/modem

WWAN

It's also important to ensure that the network interface associated with the modem is completely ignored by iface-manager

# ardexa_modem modems
/org/freedesktop/ModemManager1/Modem/0 (wwan0)
# cd /etc/netctl
# touch ignore/wwan0
# rm restart/ww*

We also need to make sure that the modem is started after the ModemManager service. Create the following file (if you are logged into the console of the device, you can simply run systemctl edit --full modem):

/etc/systemd/system/netctl@modem.service
[Unit]
Description=Networking for netctl profile %I
Documentation=man:netctl.profile(5)
After=ModemManager.service
Requires=ModemManager.service

[Service]
Type=notify
NotifyAccess=exec
RemainAfterExit=yes
ExecStart=/usr/lib/netctl/network start %I
ExecStop=/usr/lib/netctl/network stop %I

And then run systemctl daemon-reload.

Remove any auto files

Be sure to remove any modem-auto interface

netctl stop modem-auto
rm /etc/netctl/modem-auto
netctl stop wwan0
rm /etc/netctl/wwan0

Check everything is working as expected

Either reboot the device or start the interface with the command

nectl start modem

Last updated