0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ヤマハルーター NVR700Wで APNを簡単切り替え

Posted at

ヤマハのNVR700Wを利用して提供元が異なるSIMを利用するので、APNを簡単に切り替えたいという話があり、コード化してみました。

マクロ

引数 部分は順番に APN, ユーザID, パスワード です。
この部分の設定を上書きします。

macro change_apn <<EOM
  disconnect wan1
  wwan select 1
  wwan auth myname $2 $3
  wwan access-point name $1
  save
EOM

トグル切り替え

今回は2個の切り替えだったので、順番に入れ替わればいいかな、と。
ダミーデータとして、DOCOMO(Mopera),AU(5G)の設定を入れています。

embedded file switch_apn.lua <<EOF
  ret, apn = rt.command("show config wwan 1 | grep access-point")
  if string.match(apn, /\S+$/) == "mopera.net" then
    rt.command("@change_apn uad5gn.au-net.ne.jp au@uad5gn.au-net.ne.jp au")
  else
    rt.command("@change_apn mopera.net mopera mopera")
  end
EOF

トリガー

アナログですが、Download ボタンで切り替えを実行するようにしました。

operation button function download execute lua emfs:/switch_apn.lua

参考

YAMAHA (RTPRO): マクロの設定
YAMAHA (RTPRO): Lua スクリプト機能
YAMAHA (RTPRO): EMFS

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?