Cisco の VIRL は有償のネットワークシミュレータで、Cisco IOSv や CSR1000v、XRv、Nexus を簡単に検証することが出来ます。通常は $199 の製品ですが、公式サイト右下にある「GET $50 DISCOUNT」をクリックして表示される文字列を購入時に入力すると $149 で購入することが出来ます。VIRL には 3 種類の提供形態があるので、自分に適した形態を購入時に選択する必要があります。
VIRL は「VMMaestro」という専用ツールから操作します。VIRL 内で作成した仮想ルータにコンソール接続する際、初期状態では VMMaestro 内のコンソールウインドウが利用されますが、これではやや不便です。そこで、今回は OS X 環境で VIRL のコンソール接続を(VMMaestro では無く)iTerm2 上で実行する方法を記載します。尚、本記事の元ネタは以下です。下記 URL には OS X だけでなく、Windows での設定例も記載されていますので、英語に不自由しない方は下記をご覧になった方が有効です。
AppleScript の用意
VMMaestro からコンソール接続時に利用する TELNET / SSH Client を呼び出せるように AppleScript を用意しておきます。今回は下記の内容を /usr/bin/osascript /Users/xxxx/Software/VIRL/AppleScript/iterm.scpt に保存しました。
on run argv -- last argument should be the window title set windowtitle to item (the count of argv) of argv as text -- all but last argument go into CLI parameters set cliargs to "" repeat with arg in items 1 thru -2 of argv set cliargs to cliargs & " " & arg as text end repeat tell application "iTerm" activate if current terminal exists then set t to current terminal else set t to (make new terminal) end if tell t launch session "Default Session" tell the current session write text cliargs set name to windowtitle end tell end tell end tell end run
VMMaestro の設定
VMMaestro からコンソール接続時に利用するアプリケーションを変更します。「環境設定 → Terminal → Cisco Terminal」と辿ると、画面中部の「Internal vs. External Terminals」のデフォルト設定が「Use internal Terminal view」になっていますので、これを「Use external terminal applications (specified below)」を選択しつつ、Telnet command と SSH command を以下のように設定します。iterm.scpt のファイルパスは自分の環境に合わせて変更します。
項目 | 値 |
---|---|
Telnet command | /usr/bin/osascript /Users/xxxx/Software/VIRL/AppleScript/iterm.scpt telnet %h %p %t |
SSH command | /usr/bin/osascript /Users/xxxx/Software/VIRL/AppleScript/iterm.scpt ssh -Atp%p guest@%h %r |
実際の設定例は以下のようになります。
これで VIRL から Console 接続を実行した際に iTerm2 が起動されます。