Advertisement
Guest User

Untitled

a guest
May 1st, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.95 KB | None | 0 0
  1. # まずは確認
  2. pi@raspberrypi:~$ ll /dev/tty [TAB]キーを押す
  3. tty tty17 tty26 tty35 tty44 tty53 tty62
  4. tty0 tty18 tty27 tty36 tty45 tty54 tty63
  5. tty1 tty19 tty28 tty37 tty46 tty55 tty7
  6. tty10 tty2 tty29 tty38 tty47 tty56 tty8
  7. tty11 tty20 tty3 tty39 tty48 tty57 tty9
  8. tty12 tty21 tty30 tty4 tty49 tty58 ttyAMA0
  9. tty13 tty22 tty31 tty40 tty5 tty59 ttyprintk
  10. tty14 tty23 tty32 tty41 tty50 tty6
  11. tty15 tty24 tty33 tty42 tty51 tty60
  12. tty16 tty25 tty34 tty43 tty52 tty61
  13.  
  14. # 仮想CD-ROMを取り出す(これ大事)
  15. pi@raspberrypi:~$ eject
  16.  
  17. # L-02C接続有無の確認
  18. pi@raspberrypi:~$ ll /dev/tty [TAB]キーを押す
  19. tty tty18 tty28 tty38 tty48 tty58 ttyprintk
  20. tty0 tty19 tty29 tty39 tty49 tty59 ttyUSB0 # 追加
  21. tty1 tty2 tty3 tty4 tty5 tty6 ttyUSB1 # 追加
  22. tty10 tty20 tty30 tty40 tty50 tty60 ttyUSB2 # 追加(wvdial.confで使う)
  23. tty11 tty21 tty31 tty41 tty51 tty61 ttyUSB3 # 追加
  24. tty12 tty22 tty32 tty42 tty52 tty62
  25. tty13 tty23 tty33 tty43 tty53 tty63
  26. tty14 tty24 tty34 tty44 tty54 tty7
  27. tty15 tty25 tty35 tty45 tty55 tty8
  28. tty16 tty26 tty36 tty46 tty56 tty9
  29. tty17 tty27 tty37 tty47 tty57 ttyAMA0
  30.  
  31. # wvdialの設定
  32. pi@raspberrypi:~$ sudo cp -p /etc/wvdial.conf /etc/wvdial.conf.old # コピーを忘れずにね!
  33. pi@raspberrypi:~$ sudo vi /etc/wvdial.conf
  34.  
  35. [Dialer Defaults]
  36. Init1 = ATH
  37. Init2 = AT&F
  38. Init3 = ATZ
  39. Init4 = ATQ0 V1 E1 S0=0 &C1 &D2
  40. Init5 = AT+CGDCONT=1,"IP","soracom.io"
  41. Dial Attempts = 3
  42. Modem Type = Analog Modem
  43. Dial Command = ATD
  44. Stupid Mode = yes
  45. Baud = 460800
  46. New PPPD = yes
  47. Modem = /dev/ttyUSB2 # ここがポイント
  48. ISDN = 0
  49. Phone = *99***1#
  50. APN = soracom.io
  51. Username = sora
  52. Password = sora
  53. Carrier Check = no
  54. Auto DNS = 1
  55. Check Def Rpoute = 1
  56.  
  57. # インターフェース確認(wlan0がある)
  58. pi@raspberrypi:~$ ip a | grep wlan0
  59. 3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
  60. inet 192.168.xx.x/24 brd 192.168.xxx.255 scope global wlan0
  61.  
  62. # ネットワーク経路確認
  63. pi@raspberrypi:~$ netstat -nr
  64. Kernel IP routing table
  65. Destination Gateway Genmask Flags MSS Window irtt Iface
  66. 0.0.0.0 192.168.xx.x 0.0.0.0 UG 0 0 0 wlan0
  67. 192.168.xx.x 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
  68.  
  69. # wvdialコマンドの実行( & はバックグランドで動かすため)
  70. pi@raspberrypi:~$ sudo wvdial& # [Enter]キーでコマンド入力が可能
  71.  
  72. # インターフェースの確認(ppp0が追加)
  73. pi@raspberrypi:~$ ip a | grep ppp0
  74. 6: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 3
  75. inet 10.xxx.xxx.xxx [略] scope global ppp0
  76.  
  77. # ルーティングテーブルの確認
  78. pi@raspberrypi:~$ netstat -nr
  79. Kernel IP routing table
  80. Destination Gateway Genmask Flags MSS Window irtt Iface
  81. 0.0.0.0 192.168.xx.x 0.0.0.0 UG 0 0 0 wlan0
  82. 10.xxx.xxx.xxx 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 # 追加!
  83. 192.168.xx.x 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
  84.  
  85. # 経路確認
  86. pi@raspberrypi:~$ traceroute google.com
  87. traceroute to google.com (216.58.197.206), 30 hops max, 60 byte packets
  88. 1 192.168.xx.x (192.168.xx.x) 4.395 ms 4.564 ms 4.520 ms # wlan0経路で通信!
  89.  
  90. # デフォルトゲートウェイを ppp0 へ変更
  91. pi@raspberrypi:~$ sudo route add default dev ppp0
  92.  
  93. # ルーティングテーブルの確認
  94. pi@raspberrypi:~$ netstat -nr
  95. Kernel IP routing table
  96. Destination Gateway Genmask Flags MSS Window irtt Iface
  97. 0.0.0.0 0.0.0.0 0.0.0.0 U 0 0 0 ppp0 # 追加!
  98. 0.0.0.0 192.168.xx.x 0.0.0.0 UG 0 0 0 wlan0
  99. 10.xxx.xxx.xxx 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
  100. 192.168.xx.x 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
  101.  
  102. # 経路確認
  103. pi@raspberrypi:~$ traceroute google.com
  104. traceroute to google.com (216.58.196.238), 30 hops max, 60 byte packets
  105. 1 ec2-xxx-xxx-xxx-xxx.ap-northeast-1.compute.amazonaws.com (xxx.xxx.xxx.xxx) 47.839 ms [略] # ppp0経路で通信!
  106.  
  107. pi@raspberrypi:~$ fg # フォアグランドにする。
  108. sudo wvdial
  109.  
  110. [CTRL]+[C]キーを押すと接続停止
  111.  
  112. # インターフェースの確認(ppp0がないことを確認)
  113. pi@raspberrypi:~$ ip a | grep ppp0
  114. pi@raspberrypi:~$
  115.  
  116. # ラズパイの停止
  117. pi@raspberrypi:~$ sudo shutdown -h now
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement