Changes between Version 6 and Version 7 of expansion/gw16126


Ignore:
Timestamp:
11/29/2018 11:21:20 PM (6 years ago)
Author:
Tim Harvey
Comment:

add more modem usage examples

Legend:

Unmodified
Added
Removed
Modified
  • expansion/gw16126

    v6 v7  
    5858''' Note, because this modem uses raw-ip, DHCP does not work and a IP will not automatically be applied to the interface. The provider will give an IP and then it must manually be applied to the wwan0 interface.'''
    5959
    60 Sample set of commands for Ventana Ubuntu Bionic:
    61 {{{
    62 systemctl stop ModemManager #Stop modem manager, doing things manually
    63 ifdown eth0  #bring down eth0 so not confused for WAN/LAN link.
    64 
    65 echo "APN=ATT.APNI" > /etc/qmi-network.conf #replace with appropriate APN
    66 echo "PROXY=yes" >> /etc/qmi-network.conf # add prox
    67 qmicli -p -d /dev/cdc-wdm0 --wda-set-data-format=raw-ip #set raw ip format
    68 qmicli -p -d /dev/cdc-wdm0 --set-expected-data-format=raw-ip #set raw ip format
    69 qmi-network /dev/cdc-wdm0 start #start the interface
    70 
    71 qmicli --device /dev/cdc-wdm0 --wds-get-current-settings #retrieve IP address information
    72 
    73 ifconfig wwan0 100.22.44.187 netmask 255.255.255.248 #assign IP
    74 route add default gw 100.75.76.188 wwan0 #assign route
    75 echo "nameserver 198.224.182.135" > /etc/resolv.conf #assign nameserver
     60Examples: (set APN env var appropriately)
     61 * Ubuntu using !NetworkManager:
     62{{{#!bash
     63root@xenial-newport:~# nmcli --version
     64nmcli tool, version 1.2.6
     65root@xenial-newport:~# nmcli connection down id 'Wired connection 1'
     66Connection 'Wired connection 1' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/0)
     67root@xenial-newport:~# nmcli connection add type gsm ifname cdc-wdm0 con-name mymodem apn $APN
     68Connection 'mymodem' (1c6d1b7f-2c89-4e21-93ee-231073605578) successfully added.
     69root@xenial-newport:~# nmcli connection up id mymodem
     70Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
     71root@xenial-newport:~# ifconfig wwan0
     72wwan0     Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
     73          inet addr:100.75.76.187  P-t-P:100.75.76.187  Mask:255.255.255.248
     74          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
     75          RX packets:581 errors:0 dropped:0 overruns:0 frame:0
     76          TX packets:676 errors:0 dropped:0 overruns:0 carrier:0
     77          collisions:0 txqueuelen:1000
     78          RX bytes:354005 (354.0 KB)  TX bytes:54090 (54.0 KB)
     79
     80root@xenial-newport:~# ping -c2 www.google.com
     81PING www.google.com (216.58.192.196) 56(84) bytes of data.
     8264 bytes from ord30s25-in-f196.1e100.net (216.58.192.196): icmp_seq=1 ttl=52 time=568 ms
     8364 bytes from ord30s25-in-f196.1e100.net (216.58.192.196): icmp_seq=2 ttl=52 time=188 ms
     84
     85--- www.google.com ping statistics ---
     862 packets transmitted, 2 received, 0% packet loss, time 1000ms
     87rtt min/avg/max/mdev = 188.688/378.624/568.561/189.937 ms
     88}}}
     89 * Ubuntu using !ModemManager:
     90{{{#!bash
     91root@xenial-newport:~# mmcli --modem 0
     92
     93/org/freedesktop/ModemManager1/Modem/0 (device id '5cbc1489609fb1b95308ccf41b45f14e0f57771d')
     94  -------------------------
     95  Hardware |   manufacturer: 'u-blox'
     96           |          model: 'SARA-R410M-52B'
     97           |       revision: 'L0.0.00.00.06.05  1  [Aug 01 2018 14:05:07]'
     98           |   H/W revision: '10000'
     99           |      supported: 'lte'
     100           |        current: 'lte'
     101           |   equipment id: '357812090840163'
     102  -------------------------
     103  System   |         device: '/sys/devices/platform/soc@0/848000000000.pci/pci0000:00/0000:00:10.0/usb1/1-1/1-1.3/1-1.3.3'
     104           |        drivers: 'option1, qmi_wwan'
     105           |         plugin: 'Generic'
     106           |   primary port: 'cdc-wdm0'
     107           |          ports: 'ttyUSB0 (qcdm), ttyUSB1 (at), cdc-wdm0 (qmi), wwan0 (net)'
     108  -------------------------
     109  Numbers  |           own : '16127498744'
     110  -------------------------
     111  Status   |           lock: 'sim-pin2'
     112           | unlock retries: 'sim-pin (3), sim-pin2 (3), sim-puk (10), sim-puk2 (10)'
     113           |          state: 'disabled'
     114           |    power state: 'on'
     115           |    access tech: 'unknown'
     116           | signal quality: '0' (cached)
     117  -------------------------
     118  Modes    |      supported: 'allowed: 4g; preferred: none'
     119           |        current: 'allowed: 4g; preferred: none'
     120  -------------------------
     121  Bands    |      supported: 'eutran-1, eutran-2, eutran-3, eutran-4, eutran-5, eutran-8, eutran-12, eutran-13, eutran-17, eutran-18, eutran-19, eutran-20, eutran-39'
     122           |        current: 'eutran-1, eutran-2, eutran-3, eutran-4, eutran-5, eutran-8, eutran-12, eutran-13, eutran-17, eutran-18, eutran-19, eutran-20, eutran-39'
     123  -------------------------
     124  IP       |      supported: 'ipv4, ipv6, ipv4v6'
     125  -------------------------
     126  3GPP     |           imei: '357812090840163'
     127           |  enabled locks: 'none'
     128           |    operator id: 'unknown'
     129           |  operator name: 'unknown'
     130           |   subscription: 'unknown'
     131           |   registration: 'unknown'
     132           |    EPS UE mode: 'csps-2'
     133  -------------------------
     134  SIM      |           path: '/org/freedesktop/ModemManager1/SIM/0'
     135
     136  -------------------------
     137  Bearers  |          paths: 'none'
     138
     139root@xenial-newport:~# mmcli --modem 0 | grep imei
     140  3GPP     |           imei: '357812090840163'
     141root@xenial-newport:~# mmcli --modem 0 --enable
     142successfully enabled the modem
     143root@xenial-newport:~# mmcli --modem 0 --simple-connect="apn=$APN" # Note 'CallFailed' is likely an invalid APN
     144successfully connected the modem
     145root@xenial-newport:~# mmcli --modem 0 --bearer 0
     146Bearer '/org/freedesktop/ModemManager1/Bearer/0'
     147  -------------------------
     148  Status             |   connected: 'yes'
     149                     |   suspended: 'no'
     150                     |   interface: 'wwan0'
     151                     |  IP timeout: '20'
     152  -------------------------
     153  Properties         |         apn: 'NIMBLINK.GW12.VZWENTP'
     154                     |     roaming: 'allowed'
     155                     |     IP type: 'none'
     156                     |        user: 'none'
     157                     |    password: 'none'
     158                     |      number: 'none'
     159                     | Rm protocol: 'unknown'
     160  -------------------------
     161  IPv4 configuration |   method: 'static'
     162                     |  address: '100.75.76.187'
     163                     |   prefix: '29'
     164                     |  gateway: '100.75.76.188'
     165                     |      DNS: '198.224.182.135', '198.224.183.135'
     166                     |      MTU: '1428'
     167  -------------------------
     168  IPv6 configuration |   method: 'unknown'
     169  -------------------------
     170  Stats              |          Duration: '0'
     171                     |    Bytes received: 'N/A'
     172                     | Bytes transmitted: 'N/A'
     173root@xenial-newport:~# ifdown eth0
     174Killed old client process
     175Internet Systems Consortium DHCP Client 4.3.3
     176Copyright 2004-2015 Internet Systems Consortium.
     177All rights reserved.
     178For info, please visit https://www.isc.org/software/dhcp/
     179
     180Listening on LPF/eth0/00:d0:12:0f:f5:83
     181Sending on   LPF/eth0/00:d0:12:0f:f5:83
     182Sending on   Socket/fallback
     183DHCPRELEASE on eth0 to 172.24.0.2 port 67 (xid=0x3cab7268)
     184Restarting ntp (via systemctl): ntp.service.
     185root@xenial-newport:~# ifconfig wwan0 100.75.76.187/29
     186root@xenial-newport:~# route add default gw 100.75.76.188
     187root@xenial-newport:~# echo "nameserver 198.224.182.135" > /etc/resolv.conf
     188root@xenial-newport:~# ping www.google.com
     189root@xenial-newport:~# ping -c2 www.google.com
     190PING www.google.com (216.58.192.196) 56(84) bytes of data.
     19164 bytes from ord30s25-in-f196.1e100.net (216.58.192.196): icmp_seq=1 ttl=52 time=568 ms
     19264 bytes from ord30s25-in-f196.1e100.net (216.58.192.196): icmp_seq=2 ttl=52 time=188 ms
     193
     194--- www.google.com ping statistics ---
     1952 packets transmitted, 2 received, 0% packet loss, time 1000ms
     196rtt min/avg/max/mdev = 188.688/378.624/568.561/189.937 ms
     197}}}
     198 * Ubuntu using libqmi only (no !NetworkManager or !ModemManager)
     199{{{#!bash
     200root@xenial-newport:~# qmicli --version
     201
     202qmicli 1.20.2
     203Copyright (C) 2012-2018 Aleksander Morgado
     204License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>
     205This is free software: you are free to change and redistribute it.
     206There is NO WARRANTY, to the extent permitted by law.
     207
     208root@xenial-newport:~# systemctl stop NetworkManager # don't conflict with NetworkManager
     209root@xenial-newport:~# systemctl stop ModemManager # don't conflict with ModemManager
     210root@xenial-newport:~# ifdown eth0 # bring down eth0 so not confused for WAN/LAN link.
     211root@xenial-newport:~# cat << EOF > /etc/qmi-network.conf
     212> APN=$APN
     213> PROXY=yes
     214> EOF
     215root@xenial-newport:~# qmicli -p -d /dev/cdc-wdm0 --wda-set-data-format=raw-ip
     216[/dev/cdc-wdm0] Successfully set data format
     217                        QoS flow header: no
     218                    Link layer protocol: 'raw-ip'
     219       Uplink data aggregation protocol: 'disabled'
     220     Downlink data aggregation protocol: 'disabled'
     221                          NDP signature: '0'
     222Downlink data aggregation max datagrams: '0'
     223     Downlink data aggregation max size: '0'
     224root@xenial-newport:~# qmicli -p -d /dev/cdc-wdm0 --set-expected-data-format=raw-ip
     225[/dev/cdc-wdm0] expected data format set to: raw-ip
     226root@xenial-newport:~# qmi-network /dev/cdc-wdm0 start
     227Loading profile at /etc/qmi-network.conf...
     228    APN: NIMBLINK.GW12.VZWENTP
     229    APN user: unset
     230    APN password: unset
     231    qmi-proxy: yes
     232Checking data format with 'qmicli -d /dev/cdc-wdm0 --wda-get-data-format --device-open-proxy'...
     233Device link layer protocol retrieved: raw-ip
     234Getting expected data format with 'qmicli -d /dev/cdc-wdm0 --get-expected-data-format'...
     235Expected link layer protocol retrieved: raw-ip
     236Device and kernel link layer protocol match: raw-ip
     237Starting network with 'qmicli -d /dev/cdc-wdm0 --wds-start-network=apn='NIMBLINK.GW12.VZWENTP'  --client-no-release-cid --device-open-proxy'...
     238Saving state at /tmp/qmi-network-state-cdc-wdm0... (CID: 4)
     239Saving state at /tmp/qmi-network-state-cdc-wdm0... (PDH: 2194536080)
     240Network started successfully
     241root@xenial-newport:~# qmicli --device /dev/cdc-wdm0 --wds-get-current-settings
     242[/dev/cdc-wdm0] Current settings retrieved:
     243           IP Family: IPv4
     244        IPv4 address: 100.75.76.187
     245    IPv4 subnet mask: 255.255.255.248
     246IPv4 gateway address: 100.75.76.188
     247    IPv4 primary DNS: 198.224.182.135
     248  IPv4 secondary DNS: 198.224.183.135
     249                 MTU: 1428
     250             Domains: none
     251root@xenial-newport:~# ifconfig wwan0 100.22.44.187 netmask 255.255.255.248 # assign IP
     252root@xenial-newport:~# route add default gw 100.75.76.188 wwan0 # assign route
     253root@xenial-newport:~# echo "nameserver 198.224.182.135" > /etc/resolv.conf # assign nameserver
    76254}}}
    77255