Ubuntu — запускаем 3G модем в консоли | Мой блог (Дмитрий Харций) – Huawei Devices

g bee mts Каталог

Avoiding the dispatcher timeout

If the above is working, then this section is not relevant. However, there is a general problem related to running dispatcher scripts which take longer to be executed. Initially an internal timeout of three seconds only was used. If the called script did not complete in time, it was killed.

Later the timeout was extended to about 20 seconds (see the Bugtracker for more information). If the timeout still creates the problem, a work around may be to modify the dispatcher service file /usr/lib/systemd/system/NetworkManager-dispatcher.service to remain active after exit:

/etc/systemd/system/NetworkManager-dispatcher.service.d/remain_after_exit.conf
[Service]
RemainAfterExit=yes

Now start and enable the modified NetworkManager-dispatcher service.

Warning: Adding the RemainAfterExit line to it will prevent the dispatcher from closing. Unfortunately, the dispatcher has to close before it can run your scripts again. With it the dispatcher will not time out but it also will not close, which means that the scripts will only run once per boot. Therefore, do not add the line unless the timeout is definitely causing a problem.

Edit a connection

For a comprehensive list of settings, see nm-settings(5).

Firstly you need to get list of connections:

$ nmcli connection
NAME                UUID                                  TYPE      DEVICE
Wired connection 2  e7054040-a421-3bef-965d-bb7d60b7cecf  ethernet  enp5s0
Wired connection 1  997f2782-f0fc-301d-bfba-15421a2735d8  ethernet  enp0s25
MY-HOME-WIFI-5G     92a0f7b3-2eba-49ab-a899-24d83978f308  wifi       --

Here you can use the first column as connection-id used later. In this example we pick Wired connection 2 as a connection-id.

You have three methods to configure a connection Wired connection 2 after it has been created:

nmcli interactive editor
nmcli connection edit 'Wired connection 2'.
Usage is well documented from the editor.
nmcli command line interface
nmcli connection modify 'Wired connection 2' setting.propertyvalue. See nmcli(1) for usage. For example you can change its IPv4 route metric to 200 using nmcli connection modify 'Wired connection 2' ipv4.route-metric 200 command.

To remove a setting pass an empty field («») to it like this:

nmcli connection modify 'Wired connection 2' setting.property ""
Connection file
In /etc/NetworkManager/system-connections/, modify the corresponding Wired connection 2.nmconnection file .
Do not forget to reload the configuration file with nmcli connection reload.

Modem-manager with quectel ec21

I’m running Ubuntu Core on a Raspberry Pi Compute Module 3 (and IO board), and have a Quectel EC21 LTE modem connected to it via USB. I’m struggling to get it to work.

Following the guide on the Ubuntu Core docs site, I can see the modem show up:

<code>$ sudo modem-manager.mmcli -L

Found 1 modems:
    /org/freedesktop/ModemManager1/Modem/1 [Quectel] EC21
</code>

And I can see some good information about it:

<code>$ sudo modem-manager.mmcli -m 1

/org/freedesktop/ModemManager1/Modem/1 (device id 'a7dea8991786834fd4f5937baf2bae98f64e16dd')
  -------------------------
  Hardware |   manufacturer: 'Quectel'
           |          model: 'EC21'
           |       revision: 'EC21AUTFAR02A03M4G'
           |      supported: 'gsm-umts, lte'
           |        current: 'gsm-umts, lte'
           |   equipment id: '861108030174782'
  -------------------------
  System   |         device: '/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2'
           |        drivers: 'option1'
           |         plugin: 'Generic'
           |   primary port: 'ttyUSB2'
           |          ports: 'ttyUSB0 (qcdm), ttyUSB2 (at), ttyUSB3 (at)'
  -------------------------
  Numbers  |           own : 'unknown'
  -------------------------
  Status   |           lock: 'none'
           | unlock retries: 'unknown'
           |          state: 'connected'
           |    power state: 'on'
           |    access tech: 'lte'
           | signal quality: '80' (recent)
  -------------------------
  Modes    |      supported: 'allowed: 2g, 3g, 4g; preferred: none'
           |        current: 'allowed: 2g, 3g, 4g; preferred: none'
  -------------------------
  Bands    |      supported: 'unknown'
           |        current: 'unknown'
  -------------------------
  IP       |      supported: 'ipv4, ipv6, ipv4v6'
  -------------------------
  3GPP     |           imei: '861108030174782'
           |  enabled locks: 'none'
           |    operator id: '50501'
           |  operator name: 'Telstra Mobile Telstra'
           |   subscription: 'unknown'
           |   registration: 'home'
  -------------------------
  SIM      |           path: '/org/freedesktop/ModemManager1/SIM/1'

  -------------------------
  Bearers  |          paths: '/org/freedesktop/ModemManager1/Bearer/0'
</code>

If I follow the rest of the guide, i.e.:

<code>$ sudo nmcli c add type gsm ifname ttyUSB2 con-name 4G apn telstra.internet
Connection '4G' (7640a17c-c7f4-40c7-9490-bfb0d22e28f1) successfully added.

$ sudo nmcli r wwan on
</code>

I seem to get an IP address:

<code>$ ip addr
4: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 3
    link/ppp 
    inet 10.98.27.23/32 brd 10.98.27.23 scope global ppp0
       valid_lft forever preferred_lft forever
</code>

This is the output of the logs:

<code>$ sudo journalctl --no-pager -u snap.network-manager.networkmanager.service

Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.0949] settings: Failed to add 7640a17c-c7f4-40c7-9490-bfb0d22e28f1/'4G': Plugin does not support adding connections
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.0984] keyfile: loading from file "/var/snap/network-manager/265/conf/system-connections/4G"...
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.0987] settings-connection[0x12b6590]: constructed (NMKeyfileConnection)
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1014] settings-connection[0x12b6590,7640a17c-c7f4-40c7-9490-bfb0d22e28f1]: replace settings from connection 0x754040c0 (4G)
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <info>  [1523928492.1049] keyfile: add connection /var/snap/network-manager/265/conf/system-connections/4G (7640a17c-c7f4-40c7-9490-bfb0d22e28f1,"4G")
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1055] settings-connection[0x12b6590,7640a17c-c7f4-40c7-9490-bfb0d22e28f1]: failed to read connection timestamp: Key file does not have key '7640a17c-c7f4-40c7-9490-bfb0d22e28f1' in group 'timestamps'
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1088]    connection 'new connection' (0x12b6590/NMKeyfileConnection): [/org/freedesktop/NetworkManager/Settings/2]
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1090]    connection                [ 0x12fd2a8 ]
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1091]    connection.id             = '4G'
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1092]    connection.interface-name = 'ttyUSB2'
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1093]    connection.permissions    = []
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1094]    connection.secondaries    = []
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1095]    connection.type           = 'gsm'
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1096]    connection.uuid           = '7640a17c-c7f4-40c7-9490-bfb0d22e28f1'
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1097]    gsm                       [ 0x1332b30 ]
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1098]    gsm.apn                   = 'telstra.internet'
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1099]    gsm.number                = '*99#'
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1100]    ipv4                      [ 0x1310bc8 ]
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1101]    ipv4.addresses            = ((GPtrArray*) 0x1303660)
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1102]    ipv4.dns                  = []
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1103]    ipv4.dns-search           = []
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1104]    ipv4.method               = 'auto'
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1105]    ipv4.routes               = ((GPtrArray*) 0x12f7fc8)
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1106]    ipv6                      [ 0x1310c90 ]
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1107]    ipv6.addresses            = ((GPtrArray*) 0x12f8180)
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1108]    ipv6.dns                  = []
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1109]    ipv6.dns-search           = []
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1110]    ipv6.method               = 'auto'
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1111]    ipv6.routes               = ((GPtrArray*) 0x12f7478)
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1127] create NMAuditManager singleton (0x75300d50)
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <info>  [1523928492.1129] audit: op="connection-add" uuid="7640a17c-c7f4-40c7-9490-bfb0d22e28f1" name="4G" pid=3186 uid=0 result="success"
Apr 17 01:28:12 localhost.localdomain NetworkManager[1489]: <debug> [1523928492.1168] Saving secrets for connection /org/freedesktop/NetworkManager/Settings/2 (4G)
Apr 17 01:28:28 localhost.localdomain NetworkManager[1489]: <debug> [1523928508.6772] manager: (WWAN): setting radio enabled by user
Apr 17 01:28:28 localhost.localdomain NetworkManager[1489]: <info>  [1523928508.6842] audit: op="radio-control" arg="wwan-enabled:1" pid=3201 uid=0 result="success"
</code>

But, if I do something like ping using the ppp interface, I get nothing:

<code>$ sudo ping -I ppp0 8.8.8.8
</code>

What do I need to do to get the WWAN interface working?

Mounting of smb shares

Some SMB shares are only available on certain networks or locations (e.g. at home). You can use the dispatcher to only mount SMB shares that are present at your current location.

The following script will check if we connected to a specific network and mount shares accordingly:

/etc/NetworkManager/dispatcher.d/30-mount-smb.sh
#!/bin/sh

# Find the connection UUID with "nmcli connection show" in terminal.
# All NetworkManager connection types are supported: wireless, VPN, wired...
if [ "$2" = "up" ]; then
  if [ "$CONNECTION_UUID" = "uuid" ]; then
    mount /your/mount/point & 
    # add more shares as needed
  fi
fi

The following script will unmount all SMB shares before a software initiated disconnect from a specific network:

/etc/NetworkManager/dispatcher.d/pre-down.d/30-umount-smb.sh
#!/bin/sh

if [ "$CONNECTION_UUID" = "uuid" ]; then
  umount -a -l -t cifs
fi

Note: Make sure this script is located in the pre-down.d sub-directory as shown above, otherwise it will unmount all shares on any connection state change.

The following script will attempt to unmount all SMB shares following an unexpected disconnect from a specific network:

/etc/NetworkManager/dispatcher.d/40-umount-smb.sh
#!/bin/sh

if [ "$CONNECTION_UUID" = "uuid" ]; then
  if [ "$2" = "down" ]; then
    umount -a -l -t cifs
  fi
fi

An alternative is to use the script as seen in NFS#Using a NetworkManager dispatcher:

/etc/NetworkManager/dispatcher.d/30-smb.sh
#!/bin/bash

# Find the connection UUID with "nmcli con show" in terminal.
# All NetworkManager connection types are supported: wireless, VPN, wired...
WANTED_CON_UUID="CHANGE-ME-NOW-9c7eff15-010a-4b1c-a786-9b4efa218ba9"

if [[ "$CONNECTION_UUID" == "$WANTED_CON_UUID" ]]; then
    
    # Script parameter $1: NetworkManager connection name, not used
    # Script parameter $2: dispatched event
    
    case "$2" in
        "up")
            mount -a -t cifs
            ;;
        "pre-down");&
        "vpn-pre-down")
            umount -l -a -t cifs >/dev/null
            ;;
    esac
fi

Note: This script ignores mounts with the noauto option, remove this mount option or use auto to allow the dispatcher to manage these mounts.

Create a symlink inside /etc/NetworkManager/dispatcher.d/pre-down/ to catch the pre-down events:

# ln -s ../30-smb.sh /etc/NetworkManager/dispatcher.d/pre-down.d/30-smb.sh

Network services with networkmanager dispatcher

There are quite a few network services that you will not want running until NetworkManager brings up an interface. NetworkManager has the ability to start services when you connect to a network and stop them when you disconnect (e.g. when using NFS, SMB and NTPd).

To activate the feature you need to enable and start the NetworkManager-dispatcher.service.

Once the service is active, scripts can be added to the /etc/NetworkManager/dispatcher.d directory.

Scripts must be owned by root, otherwise the dispatcher will not execute them. For added security, set group ownership to root as well:

# chown root:root /etc/NetworkManager/dispatcher.d/<span>10-script.sh</span>

Make sure the file has correct permissions:

# chmod 755 /etc/NetworkManager/dispatcher.d/<span>10-script.sh</span>

The scripts will be run in alphabetical order at connection time, and in reverse alphabetical order at disconnect time. To ensure what order they come up in, it is common to use numerical characters prior to the name of the script (e.g. 10-portmap or 30-netfs (which ensures that the portmapper is up before NFS mounts are attempted).

Scripts will receive the following arguments:

Warning: If you connect to foreign or public networks, be aware of what services you are starting and what servers you expect to be available for them to connect to. You could make a security hole by starting the wrong services while connected to a public network.

Nmcli examples

List nearby Wi-Fi networks:

$ nmcli device wifi list

Connect to a Wi-Fi network:

$ nmcli device wifi connect <span>SSID_or_BSSID</span> password <span>password</span>

Connect to a hidden Wi-Fi network:

$ nmcli device wifi connect <span>SSID_or_BSSID</span> password <span>password</span> hidden yes

Connect to a Wi-Fi on the wlan1 interface:

$ nmcli device wifi connect <span>SSID_or_BSSID</span> password <span>password</span> ifname wlan1 profile_name

Disconnect an interface:

$ nmcli device disconnect ifname eth0

Get a list of connections with their names, UUIDs, types and backing devices:

$ nmcli connection show

Activate a connection (i.e. connect to a network with an existing profile):

$ nmcli connection up <span>name_or_uuid</span>

Delete a connection:

$ nmcli connection delete <span>name_or_uuid</span>

See a list of network devices and their state:

$ nmcli device

Turn off Wi-Fi:

$ nmcli radio wifi off

Openwrt

OpenWRT doesn’t seem to have complete official support for MBIM/QMI modems. An updated (as of late 2022) patch-set that uses ModemManager is available here. The problem with this solution (and why it will probably not get merged) is that it requires DBus rather than ubus.

The other option is to use the GoldenOrb ROOter firmware which automates everything via a nice web UI, but then you’re no longer running stock OpenWRT.

For now it just doesn’t seem that MBIM and QMI is well-integrated into OpenWRT, but I could be wrong. It could be that it’s simply not documented. The only mention seems to be here. For QMI, using the uqmi utility manually is documented here but it doesn’t seem to be integrated into uci or ubus.

Step-by-step guide for configuring usb modem on ubuntu | telecomtalk

Given the speed and virus-free environment offered by Linux distributions, many users are switching to Linux from Windows these days. Out of the several Linux variants available to a user, Ubuntu has seen wide adoption rates in India.

Soon after installing any operating system a user’s first activity would be to configure internet connection! Though wired (ethernet) and wireless (Wi-Fi) connections work fine with first try, configuring a USB modem can be tricky at times on Linux. This post will throw some light on different ways to configure a USB modem. The instructions are generic and will hold good for different USB modems (like those provided by MTS, TATA Photon etc.).

Also the steps will be similar for other Linux distributions like Mint, OpenSUSE etc.

Using Ubuntu ‘Network Connections’

This is by far the simplest way to configure a USB modem to connect to internet. No additional drivers or software are necessary.

1. Plug your USB Modem into an USB port. The LED light starts blinking and in a while once your modem is recognized you will be able to see an option – New Mobile Broadband (CDMA) connection/New Mobile Broadband (GSM) connection on clicking the Network icon just besides the sound icon on top panel.

2. Once you click that, you will see this screen which will show your device name. Click ‘Continue’ on the dialog.

After Step 2

3. In the next screen select country as ‘India’. This will help Ubuntu list Indian service providers in the next screen.

After Step 3

4. In the ‘Choose your Provider’ screen select your service provider. In case it is not listed (BSNL EVDO is not listed) enter it manually in the space provided. In case of EDGE/GPRS/3G connection the service providers list will be long.

After Step 4

5. The choose your billing plan screen appears only when using a EDGE/GPRS/3G connection. If you are configuring a 3G modem, say BSNL you will be required to select proper zone (Eg. OldSouthZoneA…) to use proper APN settings.

6. The last screen is to confirm all the settings and apply them. Click Apply here.

7. Once you click Apply you will be presented with a dialog to enter authentication credentials and minimal configuration settings. Important parameters are to be entered under ‘Mobile Broadband’ tab. The dialing number would be #777 for CDMA connections. It will be set by default. For GSM connections it would be *99#. The username and passwords should be filled appropriately. Typically for BSNL EVDO it would be a 10 digit number.
You may want to select ‘Connect automatically’ as this would help the connection to reconnect in case of disconnection.

After Step 7

Using Linux version of dialer by Modem vendor

Sometimes the CD which comes along with the modem will have Linux version (.deb package for Debian based distributions like Ubuntu, Mint etc.) of the dialer software. In such cases you just need to install it and use it.

Using wvdial

Most new Ubuntu versions detect a modem in few seconds. Only if it does not happen follow this procedure. In older Ubuntu versions I had faced the issue where my device was not recognized by Ubuntu network manager. In such situations wvdial can come to rescue. Wvdial package does not come preinstalled and will have to be installed separately (Not sure about just released Ubuntu 12.10 though). You may have to used an ethernet connection to download the packages and install automatically via Ubuntu Software Center or download .deb files manually and get it in a USB stick. If wvdial is brought this way, you will also have to get .deb files of dependent packages. There will be atleast 3-4 dependencies which need to installed prior to installing wvdial.

The following instructions are for BSNL’s Capitel CDMA modem but others would be similar.

Once you are done installing wvdial, you will have to edit wvdial.conf file to enter necessary details. In a terminal type
gksudo gedit /etc/wvdial.conf
The file contents should look like this after edits:
[Dialer Defaults]
Modem = /dev/ttyUSB3
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 FCLASS=0
Stupid Mode = 1
Modem Type = Analog Modem
Phone = #777
New PPPD = yes
ISDN = 0
Username = 9180****** (your username)
Password = 9180****** (your password)
Baud = 9600

Once you save the file, run the following commands. (You will have to run these two commands every time you connect to internet. I assume that you boot your PC, log in, plug in the modem, wait for a while and run the commands)
sudo wvdialconf
sudo wvdial

Once you run the second command the modem tries to connect and once connection is successful, you will be shown the IP and DNS addresses. If you close the terminal window, the connection will stop working. So let it remain minimized. To disconnect use Ctrl C with terminal window in focus. To use terminal for other purposes, you can use a new tab.

For advanced users

Advanced users can append & to sudo wvdial to send the process to background and get it back with fg command. The limitation here is you will not be able to see if the connection is successful or not without going to browser. Other options include using screen command, disown etc.

Did you face any issues while configuring your USB modem with Ubuntu or any other Linux distribution? If yes, how did you solve it? Let us know through comments.

§

Birla

Kumar Mangalam Birla, Chairman of the Aditya Birla Group, said that he is “absolutely committed” to Vodafone Idea (Vi), the third-largest private telco in India. Birla told BQ Prime in an interview that the intent right now is to find a partner to come and invest in the company.

Birla said that finding investment right now is not the easiest of things because everyone knows that the company was in trouble. Thus, as per him, finding an investing partner would take some time as people start feeling confident about the business.

Birla said that the company’s performance quarter-on-quarter seems to be improving, and the government’s relief package was a booster for the entire sector.

He dismissed the rumours that the Aditya Birla Group had given up on the telco by explaining that the group didn’t want to invest further until it could see a return coming, but they had certainly not given up on the business prospects of Vodafone Idea.

In a very realistic manner, Birla said that there are still some issues considering the company had “self-deteriorated”, and it is going to take some time for it to pull back.

Vodafone Idea is currently looking for external investors, and from the words of Birla, it is clear that ABG is still focusing on the growth of the telco. But finding investors has been hard for the company given the state of turmoil it in a few months back.

Despite the relief package, Vi hasn’t been able to start adding new subscribers. The telco’s 4G subscriber base increased by 1.1 million users in the last quarter of FY22. The average revenue per user (ARPU) figure is still not where the telco can turn profitable. Vi needs to start adding new users; otherwise, the company’s plans will stay slightly muted in front of its competitors.

§

Unit dbus-org.freedesktop.resolve1.service not found

If systemd-resolved.service is not started, NetworkManager will try to start it using D-Bus and fail:

dbus-daemon[991]: [system] Activating via systemd: service name='org.freedesktop.resolve1' unit='dbus-org.freedesktop.resolve1.service' requested by ':1.23' (uid=0 pid=1012 comm="/usr/bin/NetworkManager --no-daemon ")
dbus-daemon[991]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.resolve1.service': Unit dbus-org.freedesktop.resolve1.service not found.
dbus-daemon[991]: [system] Activating via systemd: service name='org.freedesktop.resolve1' unit='dbus-org.freedesktop.resolve1.service' requested by ':1.23' (uid=0 pid=1012 comm="/usr/bin/NetworkManager --no-daemon ")

This is because NetworkManager will try to send DNS information to systemd-resolved regardless of the main.dns= setting in NetworkManager.conf(5).[8]

This can be disabled with a configuration file in /etc/NetworkManager/conf.d/:

/etc/NetworkManager/conf.d/no-systemd-resolved.conf
[main]
systemd-resolved=false

See FS#62138.

Use dispatcher to connect to a vpn after a network connection is established

/etc/NetworkManager/dispatcher.d/vpn-up
#!/bin/sh
VPN_NAME="name of VPN connection defined in NetworkManager"
ESSID="Wi-Fi network ESSID (not connection name)"

interface=$1 status=$2
case $status in
  up|vpn-down)
    if iwgetid | grep -qs ":"$ESSID""; then
      nmcli connection up id "$VPN_NAME"
    fi
    ;;
  down)
    if iwgetid | grep -qs ":"$ESSID""; then
      if nmcli connection show --active | grep "$VPN_NAME"; then
        nmcli connection down id "$VPN_NAME"
      fi
    fi
    ;;
esac

If you would like to attempt to automatically connect to VPN for all Wi-Fi networks, you can use the following definition of the ESSID: ESSID=$(iwgetid -r). Remember to set the script’s permissions accordingly.

Trying to connect with the above script may still fail with NetworkManager-dispatcher.service complaining about ‘no valid VPN secrets’, because of the way VPN secrets are stored. Fortunately, there are different options to give the above script access to your VPN password.

1: One of them requires editing the VPN connection configuration file to make NetworkManager store the secrets by itself rather than inside a keyring that will be inaccessible for root: open up /etc/NetworkManager/system-connections/name of your VPN connection and change the password-flags and secret-flags from 1 to 0.

If that alone does not work, you may have to create a passwd-file in a safe location with the same permissions and ownership as the dispatcher script, containing the following:

/path/to/passwd-file
vpn.secrets.password:YOUR_PASSWORD

The script must be changed accordingly, so that it gets the password from the file:

/etc/NetworkManager/dispatcher.d/vpn-up
#!/bin/sh
VPN_NAME="name of VPN connection defined in NetworkManager"
ESSID="Wi-Fi network ESSID (not connection name)"

interface=$1 status=$2
case $status in
  up|vpn-down)
    if iwgetid | grep -qs ":"$ESSID""; then
      nmcli connection up id "$VPN_NAME" passwd-file /path/to/passwd-file
    fi
    ;;
  down)
    if iwgetid | grep -qs ":"$ESSID""; then
      if nmcli connection show --active | grep "$VPN_NAME"; then
        nmcli connection down id "$VPN_NAME"
      fi
    fi
    ;;
esac

2: Alternatively, change the password-flags and put the password directly in the configuration file adding the section vpn-secrets:

 [vpn]
 ....
 password-flags=0
 
 [vpn-secrets]
 password=<span>your_password</span>

Note: It may now be necessary to re-open the NetworkManager connection editor and save the VPN passwords/secrets again.

Vpn not working in gnome

When setting up OpenConnect or vpnc connections in NetworkManager while using GNOME, you will sometimes never see the dialog box pop up and the following error appears in /var/log/errors.log:

localhost NetworkManager[399]: <error> [1361719690.10506] [nm-vpn-connection.c:1405] get_secrets_cb(): Failed to request VPN secrets #3: (6) No agents were available for this request.

This is caused by the GNOME NM Applet expecting dialog scripts to be at /usr/lib/gnome-shell, when NetworkManager’s packages put them in /usr/lib/networkmanager.As a «temporary» fix (this bug has been around for a while now), make the following symlink(s):

  • For OpenConnect: ln -s /usr/lib/networkmanager/nm-openconnect-auth-dialog /usr/lib/gnome-shell/
  • For VPNC (i.e. Cisco VPN): ln -s /usr/lib/networkmanager/nm-vpnc-auth-dialog /usr/lib/gnome-shell/

This may need to be done for any other NM VPN plugins as well, but these are the two most common.

Wvdial

Подключаться при помощи этой команды не просто, а очень просто. Открываем root консоль и вводим команду wvdialconf. Программа сама определит модем и создаст файл /etc/wvdialconf. Вам нужно только немного его отредактировать: вписать другую строку инициализации, проставить пароль и имя пользователя, и обязательно строку «Stupid Mode = yes». Вот как выглядит этот файл у меня:

Заодно проверьте, есть ли в директории /etc файл /etc/resolv.conf. Если нет, то создайте пустой текстовый файл с этим именем.

Все. Под root’ом набираем команду wvdial и соединение будет установлено. Когда в выводе команды появятся URL’ы (в виде цифр) значит коннект есть. Открывайте браузер и проверяйте.

Чтобы прервать соединение, нужно обязательно нажать комбинацию клавиш CTRL C. Если просто закрыть окно терминала, то соединение будет продолжать работать, и чтобы его разорвать придется убивать процесс командой kill.

Единственный недостаток программы wvdial — невозможность следить за скоростью и объемом трафика. Но для этого существуют другие программы, описывать которые здесь не будем.

Вариант 1 — простое подключение любых usb-модемов в ubuntu

Этот вариант подойдет почти для всех известных модемов, т.к. Ubuntu Linux прекрасно знает их все в лицо. Запускаем Synaptic (Система — Администрирование), набираем в поиске:

usb-modeswitch

и устанавливаем вместе с зависимостями, потом перегружаемся (вроде надо, но не уверен). Расскажу, что произойдет:

Все эти модемы используют технологию ZeroCD, т.е. модем определяется как CD-ROM, запускает автозапуск, который проверяет наличие драйверов в системе и либо запускает специальную программу связи, либо ставит ее вместе с дровами. Само собой эта радость нифига не работает в Linux.

Теперь открывает NetworkManager (иконку сети на верхней панели) и создаем новое мобильное широкополосное соединение.

Недостатком этого метода является то, что возможны вылеты модема. Это может происходить как из-за модема, так и из-за конфигурации вашего компьютера. Поэтому рекомендую попробовать этот метод, и, если все работает правильно и стабильно, на нем остановться и не мучать больше комп.

Если же наблюдаются сбои или вы таки добыли Хуёвай модем, то переходим к Варианту 2.

Для пользователей rpm дистрибутивов

Вам нужно установить программу usb_modeswitch. Эта программа не является редкой и имеет всего одну зависимость — libusb соответствующей версии.

После инсталляции программы в вашей системе, вам потребуется создать текстовой файл /etc/usb-modeswitch.conf. (Будьте внимательны с черточкой в имени файла и программы: программа называется usb_modeswitch, а файл usb-modeswitch.conf).

В этом файле нужно прописать следующее (лучше скопировать и вставить):

После этого следует подключить модем к USB порту, дождаться пока он будет определен системой как CD-ROM, а затем запустить команду (как root):

Немедленно после этого значок CD-ROM пропадает на некоторое время, а через 20-30 секунд снова появляется. Команда отключила эмуляцию CD-ROM, udev и hal тут же распознали собственно модем, а затем снова произошла эмуляция CD-ROM.

Но нам этих секунд достаточно чтобы в директории /dev появились три новых устройства: ttyUSB0-ttyUSB2. В этом нужно убедиться:

Все идет по плану. Теперь нельзя вынимать модем из USB порта, иначе придется повторять все сначала.

Не пытайтесь сейчас наладить дозвон — это бесполезно. Нужно сначала отключить эмуляцию CD-ROM навсегда.

Запускаем в root консоли команду minicom -s:

Выбираем строку «Настройка последовательного порта» и жмем ENTER.

В строке: «Какую настройку изменить?» печатаем А. Курсор перейдет в верхнюю строку «А — Последовательный порт: /dev/modem». Вместо /dev/modem пишем /dev/ttyUSB0. Потом нажимаем ENTER, верхнее окно пропадает, и нажимаем ESC чтобы выйти из режима конфигурации.

Немедленно появится окошко «Инициализируется модем», затем оно сменится следующей информацией:

Введите команду AT и нажмите ENTER. Появится ответ — OK.

Осталось ввести (лучше всего скопировать) команду AT^U2DIAG=0 и нажать ENTER. Снова появится ответ — OK.

Теперь нажимаем CTRL A и внизу окна миникома появится красная панель. Нажав Z можно просмотреть список команд. Нам нужна «Выход без сброса»- Q. Нажимаем Q и покидаем программу миником. Модем доработан.

Чтобы убедиться в этом, вытащим его из гнезда USB, а затем снова включим (лучше в другое гнездо). Если никакого CD-ROM’а не появляется, повторим команду:

Что и требовалось. Можно налаживать дозвон.

Примечание: Теоретически возможно, что модем окажется не устройством ttyUSB0. Тогда нужно повторить все операции с миникомом для устройств ttyUSB1 и ttyUSB2.

Идентификация 3g-модема в системе ubuntu server

Команды выполняются при подключении к терминалу модема, с помощью minicom или иной программы.

Серийный номерAT CGSN

AT CIMI

Модель модемаAT GMM

Для Мегафон модема (Huawei E1550) вывело:E1550OK

Для МТС модема (Huawei E171) вывело: E171OK

Для встроенного модема Toshiba-Ericsson F3607gwF3607gwOK

Определение готовности модема

AT CPAS — информация о текущем состоянии модемаответ: CPAS: 0OK

0 — готовность,2 — не известно что делает,3 — идет входящий звонок,4 — есть голосовое соединение.

Определение регистрации модема в сети провайдера

AT CREG?либо AT CGREG?

Ответ модема: CREG: 0, 1OK

Первый 0 — установлен запрет на выдачу сообщений о смене регистрации в сети, вторая 1- зарегистрирован в домашней сети

Первая цифра, диапазон значений [0..2]0 — запрет на выдачу сообщений о смене регистрации в сети, вторая 1- зарегистрирован в домашней сети1 — резрешить сообщения о смене состояния регистрации2 — 1 доп. отладочная информация

Режим выдачи сообщений о регистрации устанавливается командойAT CREG=0

Вторая цифра, диапазон значений[0..5]

0 — не зарегистрирован, поиск сети не ведется,1 — зарегистрирован в своей домашней сети,2 — не зарегистрирован, идет поиск сети,3 — регистрация отклонена,4 — неизвестное состояние,5 — зарегистрирован в роуминге.

Информация о возможностях сети поставщика

AT*ERINFO

Для модемов Huawei E1550

Вывести список портов модемаAT^GETPORTMODE

 ^GETPORTMODE:TYPE:WCDMA:Qualcomm,MDM:0,DIAG:1,PCUI:2,SD:3OK

Сброс модуля Toshiba-Ericcson 3607gw

AT*E2RESETВыполняется отсоединение модема от USB шины и присоединение заново.

※※※

Как подключить 3g usb модем (мегафон, мтс, билайн) в ubuntu linux 12.04

В этой статье будет рассмотрена настройка и подключение 3G USB модема
(МТС, Мегафон) в Ubuntu 12.04. Это предельно
простая инструкция как подключить сотовый 3G модем в графической среде
Unity, с использованием интерфейса
Network Manager. Инструкция применима не только к
Ubuntu установленной на жесткий диск, но и к
Live варианту запускаемому с
USB флешки или с лазерного диска.

В Linux, в графических оболочках
Gnome, KDE, XFCE, Unity в качестве графического
интерфейса для настройки сетевых подключений используется программа Network Manager. Точнее Network
Manager обеспечивает plug and play работу с
физическими сетевыми устройствами, а графический интерфейс этой программы
называется Network Manager
Applet (nm-applet). Network Manager
Applet отображается в виде значка в системном трее
и если на этом значке кликнуть мышью откроется меню с функциями программы:

Как подключить 3G USB модем (Мегафон, МТС, Билайн) в Ubuntu Linux 12.04

Для подключения 3G USB модема нужно воткнуть модем в USB разъем
компьютера и через 1-2 минуты (необходимо некоторое время на то, чтобы модем
был опознан системой и подключен) кликнуть на значке «Сеть» в трее и выбрать
пункт меню «Edit connections» (иллюстрация
выше). В результате откроется окно, в котором
нужно выбрать вкладку «Mobile broadband»
и там нажать кнопку «Add»:

Как подключить 3G USB модем (Мегафон, МТС, Билайн) в Ubuntu Linux 12.04

Запустится мастер настройки соединения, в первом окне нажать кнопку
«Continue»:

Как подключить 3G USB модем (Мегафон, МТС, Билайн) в Ubuntu Linux 12.04

Примечание.

Если вкладка «Широкополосный доступ (Mobile
broadband)» недоступна или в первом окне
настройки не определена модель модема, тогда:

нужно добавить новую строку в файле /lib/udev/rules.d/40-usb_modeswitch.rules
в которой прописать vid и pid вашего модема. Эти данные вы можете
узнать через консоль командой lsusb.

Во втором окне выбрать страну и нажать кнопку
«Continue»:

Как подключить 3G USB модем (Мегафон, МТС, Билайн) в Ubuntu Linux 12.04

В следующем окне выбрать оператора и нажать кнопку
«Continue»:

Как подключить 3G USB модем (Мегафон, МТС, Билайн) в Ubuntu Linux 12.04

В следующем окне нажать кнопку «Continue»:

Как подключить 3G USB модем (Мегафон, МТС, Билайн) в Ubuntu Linux 12.04

В следующем окне нажать кнопку «Apply»:

Как подключить 3G USB модем (Мегафон, МТС, Билайн) в Ubuntu Linux 12.04

В следующем окне нажать кнопку «Save»:

Как подключить 3G USB модем (Мегафон, МТС, Билайн) в Ubuntu Linux 12.04

В этом окне можно отключить опцию «Allow roaming …»
(роуминг) и включить опцию «Connect automatically».

Готово. Теперь, для того чтобы подключиться к Интернет достаточно
кликнуть на значке «Сеть» и в меню выбрать название созданного соединения:

Как подключить 3G USB модем (Мегафон, МТС, Билайн) в Ubuntu Linux 12.04

И через несколько секунд соединение будет установлено:

Как подключить 3G USB модем (Мегафон, МТС, Билайн) в Ubuntu Linux 12.04

Можно сделать так, чтобы соединение устанавливалось автоматически, как
только модем будет воткнут в USB разъем. Для этого
необходимо открыть окно соединений, выбрать вкладку «Mobile
broadband» и там нажать кнопку «Edit»
затем отметить опцию «Connect automatically»
и нажать кнопку «Save»:

Как подключить 3G USB модем (Мегафон, МТС, Билайн) в Ubuntu Linux 12.04

P.S.

По моим длительным наблюдениям в Ubuntu
«сотовый» Интернет работает немного быстрее чем в Windows.
Бывает даже и такое, что в Windows соединения
вообще нет (оно устанавливается но не работает), а в
Ubuntu все нормально.

Если у вас возникли проблемы с подключением читайте другую статью —
установка и настройка 3G USB модема на Ubuntu
Linux
, в ней более подробно описан процесс установки и настройки.

Иван Сухов, 2020 г.

Получение баланса счёта

Т.к. модем и симкарта находятся в корпусе, и доставать их неудобно, то

можно использовать AT-команды для получения баланса.

Для модема Toshiba-Ericcson F3607gw

Если выполнить на терминале /dev/ttyACM1 ( это управляющий порт) команду:AT CUSD=1,»*100#»,15через несколько секунд вернет ответ

CUSD — это префикс для выполнения команд USSD.

Проверка баланса у Мегафона: *100#Проверка баланса у МТС: *100#Проверка баланса у Билайна *100#Проверка баланса у Теле2: *105#

Для модема Huawei E1550

Модем не может работать в текстовом режим, ему требуется закодированное послание.

Для модема Huawei E171 

Модем Huawei E171 подключенный к Микротик нужно настроить в режиме Advanced Mode, у созданного PPP-подключения:Data Channel 0Info Channel 2После этого, информационный канал будет работать и сообщать информацию об уровне сигнала и пр.

※※※

Регистрация модемов в системе ubuntu

Корректно подключенный модем (например, F3607gw со вставленной SIM-картой) отображается в системе следующим образом:

# lsusb

Для модема F3607gwBus 001 Device 002: ID 0930:130c Toshiba Corp. F3607gw Mobile Broadband Module

Для модема E1550Bus 001 Device 005: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem

Для модема E171

Bus 001 Device 006: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem

Вывод сообщений ядра.

# dmesg

Для модема Huawei E1550

[ 8792.027386] usb 1-1.5: New USB device found, idVendor=12d1, idProduct=1001[ 8792.027392] usb 1-1.5: New USB device strings: Mfr=2, Product=1, SerialNumber=0[ 8792.027395] usb 1-1.5: Product: HUAWEI Mobile[ 8792.

027397] usb 1-1.5: Manufacturer: HUAWEI Technology[ 8792.032452] usb-storage 1-1.5:1.0: USB Mass Storage device detected[ 8792.032593] option 1-1.5:1.0: GSM modem (1-port) converter detected[ 8792.032731] usb 1-1.5:

GSM modem (1-port) converter now attached to ttyUSB0[ 8792.032787] usb-storage 1-1.5:1.1: USB Mass Storage device detected[ 8792.033032] option 1-1.5:1.1: GSM modem (1-port) converter detected[ 8792.

033148] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB1[ 8792.033185] usb-storage 1-1.5:1.2: USB Mass Storage device detected[ 8792.033427] option 1-1.5:1.2: GSM modem (1-port) converter detected[ 8792.

033477] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB2[ 8792.033510] usb-storage 1-1.5:1.3: USB Mass Storage device detected[ 8792.034564] scsi25 : usb-storage 1-1.5:1.3[ 8792.034696] usb-storage 1-1.5:1.4:

USB Mass Storage device detected[ 8792.035550] scsi26 : usb-storage 1-1.5:1.4[ 8793.035728] scsi 25:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2[ 8793.038573] scsi 26:0:0:0:

Direct-Access     HUAWEI   MMC Storage      2.31 PQ: 0 ANSI: 2[ 8793.047079] sr0: scsi-1 drive[ 8793.047183] sr 25:0:0:0: Attached scsi CD-ROM sr0[ 8793.047240] sr 25:0:0:0: Attached scsi generic sg3 type 5[ 8793.048641] sd 26:0:0:0: Attached scsi generic sg4 type 0[ 8793.058444] sd 26:0:0:0: [sdd] Attached SCSI removable disk

Для модема Huawei E171

[ 8340.864006] usb 1-1.5: new high-speed USB device number 6 using ehci-pci[ 8340.958541] usb 1-1.5: New USB device found, idVendor=12d1, idProduct=1001[ 8340.958546] usb 1-1.5: New USB device strings: Mfr=3, Product=2, SerialNumber=0[ 8340.

958548] usb 1-1.5: Product: HUAWEI Mobile[ 8340.958560] usb 1-1.5: Manufacturer: HUAWEI Technology[ 8340.960056] usb-storage 1-1.5:1.0: USB Mass Storage device detected[ 8340.960155] option 1-1.5:1.0:

GSM modem (1-port) converter detected[ 8340.960265] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB0[ 8340.960337] usb-storage 1-1.5:1.1: USB Mass Storage device detected[ 8340.960380] option 1-1.5:1.1:

GSM modem (1-port) converter detected[ 8340.960442] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB1[ 8340.960504] usb-storage 1-1.5:1.2: USB Mass Storage device detected[ 8340.960550] option 1-1.5:1.2:

Примечание: этот модем был переключен в состояние только модем, поэтому storage не видно.

Переключение модемов Huawei E1550, E171 в режим только модема

Ubuntu Desktop содержит программу usb_modeswitch, которая выполняет автоматическое переключение модема, но каждый раз при подключении.

Для переключение этого конкретного модема Huawei E1550 в режим только модема, под Linux, надо сделать следующее:1. Подключиться к третьему порту (/dev/ttyUSB2) со скоростью 9600N1.2. Отправить команду AT^U2DIAG=0 либо AT^U2DIAG=256 (с флешкой).

Переименовывание модема

Т.к. подключенный к разъёму mini-pcie модем, является системным (несъёмным), то можно освободить автоматические имена и сформировать свои собственные в ветке /dev.Например:/dev/modem3g/dev/modem3g-control/dev/modem3g-control2Для этого используется правила udev.Пока не делал.

Рисуем свой скин для mobile partner

Заходим в папку:

/usr/local/MegaFon_Internet/config/images где MegaFon_Internet — это папка по умолчанию (вы можете выбрать любую другую при установке). В этой папке хранятся все картинки/заставки/иконки, поэтому берем и тупо перерисовываем их для себя (если вам не один фиг логотип какого ОпСоСа там нарисован). Вот и всего делофф! А я следующим постом выложу подборку скинов для Mobile Partner. Что-то стырю, что-то нарисую 🙂 PS: Отдельно хочу удивленно восхититься Мегафоном (компанией, не устройством). Молодцы, ребята! Позаботились о пользователях linux, что так редко бывает в наши дни. Я, конечно, понимаю, что вы это случайно и совсем не нарочно, но все равно спасибо! PPS: К вопросу о профессионализме сотрудников некоторых ОпСоСов (привет, МТС!). Когда мой друг позвонил в сервисный центр одного известного ОпСоСа (не буду его называть, чтоб не посчитали рекламой — кому надо сами догадаются). У него произошел следующий диалог (пересказ с его слов):

— Здравствуйте! Я купил у вас МТС-модем и не могу его подключить.— Какой у вас модем?— mf627. Как мне его заставить работать в Линукс?

(театральная пауза)— А… Простите, что Вы имеете в виду под словом Линукс?

(апплодисменты и занавес)

Вот такие пироги :))

Материал был опубликован тут.

Теперь о 3g

3G — это проколол высокоскоростной связи. В него входит как голосовая передача, так и пакетная (в 4G планируется только пакетная). Это позволяет достигать хорошей скорости передачи данных (аж до 2 МиБ/сек, а стандарт 3G подразумевает скорость до 14 МиБ/сек).

Скорости, конечно же, условные и достигают хотя бы половины обещанного только в лаборатории и у пряморукого везунчика в каждое четвертое новолуние  года осла.  Для работы вы должны находиться в зоне покрытия 3G (даже не во всех городах, хотя цифры отчетности и говорят об обратном). На случай плохой связи у ОпСоСов отработана фраза: “Это из-за погоды!”. И ведь не поспоришь 🙂

Т.о. в зоне уверенного покрытия, с нормальным ОпСоСом и при хорошей погоде можно смело рассчитывать на 500-700 КиБ/с, что  отнюдь не плохо для мобильного интернета.

А в это время Европа уже начала переход на 4G, что нам не светит пока там не внедрят 5G. Хотя компания Теле2 вынашивает хитрый план построить 4G сеть в Росии, но лично я не верю в успех этих халтурщиков. Дествительно, на фига, если бабло и так прет.

В общем так: если вы много ездите с ноутбуком или нетбуком, то купить 3G usb-модем вам придется.

Но давайте подключим свежекупленный модем к нашей Ubuntu Lucid (или что там у вас…).

Часть первая — ищем сам модем!

Много современных USB-модемов для 3G сетей являются «составным USB-устройством». То есть, в таком многофункциональном «USB-свистке» присутствует как сам модем, так и виртуальный компакт-диск с драйверами и ПО, плюс, у ряда моделей — картридер, а также служебный интерфейс, который нас в данном случае не интересует вовсе.

dmitry@hotspot-server:~$ <span><span>lsusb</span></span>
Bus 001 Device 002: ID <span><span>19d2:2000</span></span>
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Как показано выше, в ответ на наш запрос система выдала список обнаруженных ей USB устройств с их идентификаторами. В ответе я выделил идентификатор только что подключенного мной модема. Красным он выделен потому, что это идентификатор не модемной части, а виртуального CDROM-а. То есть, нам нужно что-то сделать с этим устройством, чтобы оно переключилось из CDROM-а в модем.

Програмное решение для этой цели уже давно существует. Оно называется usb-modeswitch, и на сегодняшний день включено в большинство современных дистрибутивов Linux. И вот теперь, я вернусь к тому, почему был выбран такой старый дистрибутив — в дистрибутиве Ubuntu 9.

dmitry@hotspot-server:/usr/src/usb$ <span><span>sudo apt-get install usb-modeswitch</span></span>
Чтение списков пакетов... Готово
Построение дерева зависимостей
Чтение информации о состоянии... Готово
E: <span><span>Не удалось найти пакет usb-modeswitch</span></span>

Очень жаль, ибо без него нам никак!

ВНИМАНИЕ: Еще раз повторюсь — речь идет именно про дистрибутив Ubuntu 9.04 (и возможно, более старые версии, но я не проверял)! Если же у вас дистрибутив Ubuntu 9.10 и новее, то описанные ниже действия по ручному скачиванию пакетов и ручной же их установке вам не нужны.

Use dispatcher to automatically toggle wireless depending on lan cable being plugged in

The idea is to only turn Wi-Fi on when the LAN cable is unplugged (for example when detaching from a laptop dock), and for Wi-Fi to be automatically disabled, once a LAN cable is plugged in again.

Create the following dispatcher script[5], replacing LAN_interface with yours.

Note that there is a fail-safe for the case when the LAN interface was connected when the computer was last on, and then disconnected while the computer was off. That would mean the radio would still be off when the computer is turned back on, and with a disconnected LAN interface, you would have no network.

/etc/NetworkManager/dispatcher.d/wlan_auto_toggle.sh
#!/bin/sh

if [ "$1" = "<span>LAN_interface</span>" ]; then
    case "$2" in
        up)
            nmcli radio wifi off
            ;;
        down)
            nmcli radio wifi on
            ;;
    esac
elif [ "$(nmcli -g GENERAL.STATE device show LAN_interface)" = "20 (unavailable)" ]; then
    nmcli radio wifi on
fi

Оцените статью
Huawei Devices
Добавить комментарий