如果从一开始就没有 LTE 连接,nmcli 连接会停留在激活状态

如果从一开始就没有 LTE 连接,nmcli 连接会停留在激活状态

我想通过 nmcli 设置 LTE 连接,该连接在启动时自动连接。

我当前的配置如下所示:

# mmcli -m 0
  --------------------------------
  General  |            dbus path: /org/freedesktop/ModemManager1/Modem/0
           |            device id: ****
  --------------------------------
  Hardware |         manufacturer: Sierra Wireless, Incorporated
           |                model: ****
           |             revision: ****
           |            supported: gsm-umts, lte
           |              current: gsm-umts, lte
           |         equipment id: ****
  --------------------------------
  System   |               device: /sys/devices/3530000.xhci/usb1/1-3/1-3.2
           |              drivers: GobiSerial driver, GobiNet
           |               plugin: Generic
           |         primary port: ttyUSB2
           |                ports: ttyUSB0 (qcdm), eth2 (net), eth3 (net), ttyUSB2 (at)
  --------------------------------
  Numbers  |                  own: ****
  --------------------------------
  Status   |       unlock retries: sim-pin (3), sim-puk (10)
           |                state: connected
           |          power state: on
           |          access tech: lte
           |       signal quality: 0% (recent)
  --------------------------------
  Modes    |            supported: allowed: 2g, 3g, 4g; preferred: none
           |              current: allowed: 2g, 3g, 4g; preferred: none
  --------------------------------
  IP       |            supported: ipv4, ipv6, ipv4v6
  --------------------------------
  3GPP     |                 imei: ****
           |          operator id: ****
           |        operator name: ****
           |         registration: home
  --------------------------------
  3GPP EPS | ue mode of operation: csps-2
  --------------------------------
  SIM      |            dbus path: /org/freedesktop/ModemManager1/SIM/0
  --------------------------------
  Bearer   |            dbus path: /org/freedesktop/ModemManager1/Bearer/1
           |                       /org/freedesktop/ModemManager1/Bearer/0

# nmcli c show LTE
connection.id:                          LTE
connection.uuid:                        ****
connection.stable-id:                   --
connection.type:                        gsm
connection.interface-name:              --
connection.autoconnect:                 yes
connection.autoconnect-priority:        0
connection.autoconnect-retries:         -1 (default)
connection.auth-retries:                -1
connection.timestamp:                   1606296274
connection.read-only:                   no
connection.permissions:                 --
connection.zone:                        --
connection.master:                      --
connection.slave-type:                  --
connection.autoconnect-slaves:          -1 (default)
connection.secondaries:                 --
connection.gateway-ping-timeout:        0
connection.metered:                     unknown
connection.lldp:                        default
connection.mdns:                        -1 (default)
ipv4.method:                            auto
ipv4.dns:                               --
ipv4.dns-search:                        --
ipv4.dns-options:                       ""
ipv4.dns-priority:                      0
ipv4.addresses:                         --
ipv4.gateway:                           --                          
ipv4.routes:                            --
ipv4.route-metric:                      -1
ipv4.route-table:                       0 (unspec)
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-timeout:                      0 (default)
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.dhcp-fqdn:                         --
ipv4.never-default:                     no
ipv4.may-fail:                          yes
ipv4.dad-timeout:                       -1 (default)
ipv6.method:                            auto
ipv6.dns:                               --
ipv6.dns-search:                        --
ipv6.dns-options:                       ""
ipv6.dns-priority:                      0
ipv6.addresses:                         --
ipv6.gateway:                           --
ipv6.routes:                            --
ipv6.route-metric:                      -1
ipv6.route-table:                       0 (unspec)
ipv6.ignore-auto-routes:                no
ipv6.ignore-auto-dns:                   no
ipv6.never-default:                     no
ipv6.may-fail:                          yes
ipv6.ip6-privacy:                       -1 (unknown)
ipv6.addr-gen-mode:                     stable-privacy
ipv6.dhcp-send-hostname:                yes
ipv6.dhcp-hostname:                     --
ipv6.token:                             --
gsm.number:                             *99#
gsm.username:                           --
gsm.password:                           <hidden>
gsm.password-flags:                     0 (none)
gsm.apn:                                --
gsm.network-id:                         --
gsm.pin:                                <hidden>
gsm.pin-flags:                          0 (none)
gsm.home-only:                          no
gsm.device-id:                          --
gsm.sim-id:                             --
gsm.sim-operator-id:                    --
gsm.mtu:                                auto
proxy.method:                           none
proxy.browser-only:                     no
proxy.pac-url:                          --
proxy.pac-script:                       --
GENERAL.NAME:                           LTE
GENERAL.UUID:                           ****
GENERAL.DEVICES:                        ttyUSB2
GENERAL.STATE:                          activated
GENERAL.DEFAULT:                        yes
GENERAL.DEFAULT6:                       no
GENERAL.SPEC-OBJECT:                    --
GENERAL.VPN:                            no
GENERAL.DBUS-PATH:                      /org/freedesktop/NetworkManager/ActiveConnection/4
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/Settings/1
GENERAL.ZONE:                           --
GENERAL.MASTER-PATH:                    --
IP4.ADDRESS[1]:                         ****
IP4.GATEWAY:                            ****
IP4.ROUTE[1]:                           ***
IP4.ROUTE[2]:                           ****
IP4.DNS[1]:                             ****
IP4.DNS[2]:                             ****

有了这个配置,基本上一切都可以正常工作,只要我在 Linux 设备启动时确实有连接。

如果我没有连接,mmcli -m 0将正确地注意到没有连接,一旦有可用连接,它就会立即连接。另一方面,无论是否已有 LTE 连接,nmcli c show LTE都会停留在该状态。向下和向上GENERAL.STATE: activating设置nmcli连接,将使nmcli连接正确。

如何nmcli在 LTE 连接建立后立即建立连接,而无需不断地设置连接?

相关内容