NMCLI设备不可用

时间:2017-08-15 10:54:30

标签: ubuntu network-programming iot

我正在尝试在ubuntu核心16.04上配置带有蜂窝接口的新设备。我运行了NMCLI包。在我添加连接之前,我检查了接口

# nmcli dev
DEVICE    TYPE      STATE         CONNECTION         
eth1      ethernet  connected     Wired connection 1 
wlan0     wifi      disconnected  --                 
eth0      ethernet  unavailable   --                 
cdc-wdm0  gsm       unavailable   --                 
lo        loopback  unmanaged     --     

我添加了我的连接:

nmcli con add type gsm ifname cdc-wdm0 con-name MyConnection apn myapn.com

最后,我尝试通过运行来启动连接:

nmclil con up MyConnection 
Error: Connection activation failed: No suitable device found for this connection

我也粘贴了Config的输出:

# nmcli -p con show MyConnection

                  Connection profile details (MyConnection)

connection.id:                          MyConnection
connection.uuid:                        25dc3eec-ca8a-4861-bfcc-089d558972d4
connection.interface-name:              cdc-wdm0
connection.type:                        gsm
connection.autoconnect:                 yes
connection.autoconnect-priority:        0
connection.timestamp:                   0
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:                        -1 (default)

ipv4.method:                            auto
ipv4.dns:                               
ipv4.dns-search:                        
ipv4.dns-options:                       (default)
ipv4.addresses:                         
ipv4.gateway:                           --
ipv4.routes:                            
ipv4.route-metric:                      -1
ipv4.ignore-auto-routes:                no
ipv4.ignore-auto-dns:                   no
ipv4.dhcp-client-id:                    --
ipv4.dhcp-timeout:                      0
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:                       (default)
ipv6.addresses:                         
ipv6.gateway:                           --
ipv6.routes:                            
ipv6.route-metric:                      -1
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:                     --

gsm.number:                             *99#
gsm.username:                           <hidden>
gsm.password:                           <hidden>
gsm.password-flags:                     0 (none)
gsm.apn:                                myapn.com
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:                    --

我的问题是如何启用不可用的设备以及为什么它不可用?我可以检查什么来帮助我解决问题。

任何帮助都会很棒,因为我只是在Snappy上开始。

1 个答案:

答案 0 :(得分:0)

好的,所以我设法解决了自己的问题,我采取的步骤如下:

1)检查我的网关上的调制解调器是否被ubuntu核心读取:

$ sudo mmcli -L

Found 1 modems:
    /org/freedesktop/ModemManager1/Modem/0 [Generic] MBIM [1519:0020]

2)检查SIM是否正确读取:

$ sudo mmcli -m 0

/org/freedesktop/ModemManager1/Modem/0 (device id 'd8b328efa783ca35a022d6b44b878981e67a5903')
  -------------------------
  Hardware |   manufacturer: 'Generic'
           |          model: 'MBIM [1519:0020]'
           |       revision: 'MOD_6260_V05.1412.00_R07_VCTCX'
           |      supported: 'gsm-umts'
           |        current: 'gsm-umts'
           |   equipment id: '014752000020933'
  -------------------------
  System   |         device: '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-3'
           |        drivers: 'cdc_acm, cdc_mbim'
           |         plugin: 'Generic'
           |   primary port: 'cdc-wdm0'
           |          ports: 'cdc-wdm0 (mbim), wwan0 (net), ttyACM0 (at)'
  -------------------------
  Numbers  |           own : 'unknown'
  -------------------------
  Status   |           lock: 'none'
           | unlock retries: 'sim-pin (3)'
           |          state: 'connected'
           |    power state: 'on'
           |    access tech: 'gprs'
           | signal quality: '67' (cached)
  -------------------------
  Modes    |      supported: 'allowed: 2g, 3g; preferred: none'
           |        current: 'allowed: 2g, 3g; preferred: none'
  -------------------------
  Bands    |      supported: 'unknown'
           |        current: 'unknown'
  -------------------------
  IP       |      supported: 'ipv4, ipv6, ipv4v6'
  -------------------------
  3GPP     |           imei: '<censored>'
           |  enabled locks: 'fixed-dialing'
           |    operator id: '27203'
           |  operator name: 'IRL - METEOR'
           |   subscription: 'unknown'
           |   registration: 'home'
  -------------------------
  SIM      |           path: '/org/freedesktop/ModemManager1/SIM/0'

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

这是我意识到我的SIM卡未在网关中找到并且我的SIM卡已损坏,我已经更换了我的SIM卡并想出了上面的输出。

3)配置新APN或编辑现有APN。 (我发现重新添加连接更容易)

确保您使用root(sudo su -

a)删除失败的现有连接

 #nmcli con delete MyConnection

b)创建新连接

#nmcli con add type gsm ifname cdc-wdm0 con-name MyWorkingConnection apn MyNewApn.com

4)将用户名和密码添加到新连接

#nmcli con edit MyWorkingConnection

此时你将进入nmcli&gt;提示。输入 help 以获取可帮助您编辑连接的命令列表。对我来说,我需要添加用户名和密码,所以我通过输入以下内容来实现:

nmcli> set gsm.username data
nmcli> set gsm.password <passwordgoeshere>
nmcli> save
nmcli> quit

此时我的连接已建立。我找到了命令

#nmcli m

在另一个会话中打开,有助于检查接口更改的状态。

希望这可以帮助一些人!