先日同じような記事を書いたんですが,サーバからドングルが切断される(?)問題が出たので,ドングルを変えて再チャレンジしました.
3G/LTE USBドングルを備えた遠隔地のオンプレサーバにSORACOM Napterを使ってSSH接続して保守を行う
https://qiita.com/nc30mtd/items/82e889caf3c91d7e57c3
今回使うのはNCXX UX302NC-R
UX302NC-R|NCXX
https://www.ncxx.co.jp/product/ux302ncr
Windows上でドングルの試運転
まずはWindows上で使ってみることにした.
SIMを挿してWindowsPCにドングルを挿すとインストーラが入っているのでインストールする.
Connection Managerを起動すると初期状態ではプロファイルがないので作って接続する.
接続ボタン押したら接続できた.かんたんすぎる.
Windowsでは無事,接続できたのでドングルの試運転完了.
本命のjetson-nanoで動かす.
まずはUSB接続.
$ lsusb
Bus 001 Device 026: ID 11f6:1034 Prolific
見えている模様なので,次にネットワーク設定まわり
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether d2:28:09:c7:2c:02 brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:e0:4c:68:00:01 brd ff:ff:ff:ff:ff:ff
inet 192.168.11.20/24 brd 192.168.11.255 scope global dynamic noprefixroute eth0
valid_lft 258846sec preferred_lft 258846sec
inet6 fe80::844:c77e:7587:fe2f/64 scope link noprefixroute
valid_lft forever preferred_lft forever
4: l4tbr0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether a6:c9:64:c3:b4:59 brd ff:ff:ff:ff:ff:ff
inet 192.168.55.1/24 brd 192.168.55.255 scope global l4tbr0
valid_lft forever preferred_lft forever
inet6 fe80::1/128 scope link tentative
valid_lft forever preferred_lft forever
5: rndis0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master l4tbr0 state DOWN group default qlen 1000
link/ether a6:c9:64:c3:b4:59 brd ff:ff:ff:ff:ff:ff
6: usb0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast master l4tbr0 state DOWN group default qlen 1000
link/ether a6:c9:64:c3:b4:5b brd ff:ff:ff:ff:ff:ff
こちらは挿しただけではまだ見えてない模様.
前回踏んだ手順と同様に,SORACOMさんで用意してくれているセットアップスクリプトを走らせてみる.
$ wget https://soracom-files.s3.amazonaws.com/setup_air.sh
$ chmod +x setup_air.sh
$ sudo ./setup_air.sh
--- 1. Check required packages
please execute as root or use sudo command.
ubuntu@jetson-nano:~$ sudo ./setup_air.sh
[sudo] password for ubuntu:
--- 1. Check required packages
ok.
--- 2. Patching /lib/systemd/system/ifup@.service
ok.
--- 3. Generate config files
ok.
--- 4. Initialize Modem
Found un-initilized modem. Trying to initialize it ...
ok.
Now you are all set.
Tips:
- When you plug your usb-modem, it will automatically connect.
- If you want to disconnect manually or connect again, you can use 'sudo ifdown wwan0' / 'sudo ifup wwan0' commands.
- Or you can just execute 'sudo wvdial'.
言われたとおりにsudo wvdialしてみる.
$ sudo wvdial
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: AT+CFUN=1
--> Sending: ATQ0
--> Re-Sending: AT+CFUN=1
--> Modem not responding.
だめっぽい.が何度かドングルを挿し直してwvdialを試してみると下記の通りうまくつながったような雰囲気があるが,コマンドが終了しなかったりとか何やら心配である.
$ sudo wvdial
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: AT+CFUN=1
OK
--> Sending: ATZ
OK
--> Sending: AT+CGDCONT=1,"IP","soracom.io"
OK
--> Modem initialized.
--> Sending: ATD*99***1#
--> Waiting for carrier.
CONNECT 150000000
--> Carrier detected. Starting PPP immediately.
--> Starting pppd at Sat Jan 18 11:39:42 2020
--> Pid of pppd: 14851
--> Using interface ppp0
--> local IP address 10.XXX.XXX.XXX
--> remote IP address 10.XXX.XXX.XXX
--> primary DNS address 100.XXX.XXX.XXX
--> secondary DNS address 100.XXX.XXX.XXX
(ここでコマンド完了しないのでCtrl-Cで強制終了)
^CCaught signal 2: Attempting to exit gracefully...
--> Terminating on signal 15
--> Connect time 0.7 minutes.
--> Disconnecting at Sat Jan 18 11:40:19 2020
強制終了する前に別のコンソールからデバイス名を確認するとppp0で接続はされている模様.
コマンド終了しないけど,こういうものなんだろうか.
10: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 3
link/ppp
inet 10.XXX.XXX.XXX peer 10.XXX.XXX.XXX/32 scope global ppp0
valid_lft forever preferred_lft forever
このときのdmesgを参考までに貼っておく.
[137494.343446] usb 1-2.3: USB disconnect, device number 19
[137494.349442] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[137494.351428] option 1-2.3:1.0: device disconnected
[137494.352215] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[137494.352294] option 1-2.3:1.1: device disconnected
[137494.353091] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[137494.353127] option 1-2.3:1.2: device disconnected
[137494.354669] option1 ttyUSB3: GSM modem (1-port) converter now disconnected from ttyUSB3
[137494.354706] option 1-2.3:1.3: device disconnected
[137504.292865] usb 1-2.3: new high-speed USB device number 20 using tegra-xusb
[137504.327626] usb 1-2.3: New USB device found, idVendor=11f6, idProduct=1035
[137504.327677] usb 1-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[137504.327715] usb 1-2.3: Product: NCXX UX302NC
[137504.327750] usb 1-2.3: Manufacturer: NCXX Inc.
[137504.327786] usb 1-2.3: SerialNumber: 1234567890
[137504.335982] usb-storage 1-2.3:1.0: USB Mass Storage device detected
[137504.336185] scsi host0: usb-storage 1-2.3:1.0
[137510.215241] usb 1-2.3: USB disconnect, device number 20
[137510.448796] usb 1-2.3: new high-speed USB device number 21 using tegra-xusb
[137510.483473] usb 1-2.3: New USB device found, idVendor=11f6, idProduct=1034
[137510.483523] usb 1-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[137510.483561] usb 1-2.3: Product: NCXX UX302NC
[137510.483596] usb 1-2.3: Manufacturer: NCXX Inc.
[137510.489831] option 1-2.3:1.0: GSM modem (1-port) converter detected
[137510.490260] usb 1-2.3: GSM modem (1-port) converter now attached to ttyUSB0
[137510.490527] option 1-2.3:1.1: GSM modem (1-port) converter detected
[137510.490797] usb 1-2.3: GSM modem (1-port) converter now attached to ttyUSB1
[137510.491122] option 1-2.3:1.2: GSM modem (1-port) converter detected
[137510.491317] usb 1-2.3: GSM modem (1-port) converter now attached to ttyUSB2
[137510.491627] option 1-2.3:1.3: GSM modem (1-port) converter detected
[137510.491861] usb 1-2.3: GSM modem (1-port) converter now attached to ttyUSB3
UX302NC-RはWindowsで利用したときのように,USBに挿すとMass Storageデバイスとして認識されるようなので,setup_air.shを実行した時点で/etc/udev/rules.d/30-soracom.rules に下記の設定を追記してくれているようです.
# UX302NC-R
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="11f6", ATTRS{idProduct}=="1035", RUN+="/usr/sbin/usb_modeswitch -v 11f6 -p 1035 -M '55534243123456780000000080000606f50402527000000000000000000000'"
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="11f6", ATTRS{idProduct}=="1034", RUN+="/bin/bash -c 'modprobe option && echo 11f6 1034 > /sys/bus/usb-serial/drivers/option1/new_id'"
KERNEL=="ttyUSB*", ATTRS{../idVendor}=="11f6", ATTRS{../idProduct}=="1034", ATTRS{bNumEndpoints}=="03", ATTRS{bInterfaceNumber}=="01", SYMLINK+="modem", ENV{SYSTEMD_WANTS}="ifup@wwan0.service"
診断くんで自分のIPアドレス確認する
$ curl http://taruo.net/e/ | grep host
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 3651 100 3651 0 0 2287 0 0:00:01 0:00:01 --:--:-- 2287
host=XXX-XXX-XXX-XXX.soracom.io (XXX.XXX.XXX.XXX)
接続はできたみたい.
この状態でSORACOMのユーザーコンソールからオンデマンドリモートアクセスを使うと端末へのSSH接続を確認できた
こういうものなのかもしれないですが,毎度wvdial叩かないと接続できないの気持ちが悪いですね.なんか対策したい.
次回はHuaweiのMS2372を試してみたい