GNS3 メモ


<適宜更新します>

Login from Local

通常は環境にあるマシンに GNS3 の用意した console で接続するが、それ以外にも手元から並行して接続したいことも出てくる。

  • 方法1:「Cloud」を使うと、ネットワークが外に出てくる。ここを逆に入り口として環境内のホストにアクセスできる。
  • 方法2:「VPC」を使って対象機器の telnet や ssh にアクセスできる。

Qemu

  • 最初 NIC 無しで起動する
  • qemu monitor からのコマンド入力で NIC が追加される
  • NIC は socket で構成されていて、あて先は動的に変更される

Windows 10 packet capture

最初 npmap でインストールしていたけど pcap ファイルに書き込まれていく様子がなかった。結局 WinPcap に入れ替えると動作した。

ubridge は telnet で待ち受けて起動する。このインターフェースでコマンドを受け付ける。start_capture で pcap ファイルを書き始める。それを tail / cygwin で読み出して Wireshark に渡す、というのが基本的な流れ。

基本的には上記の流れで pcap ファイルを経由するが、Windows ではファイル open 時の挙動が Linux などと異なる。read access を許さないロックがかかるかかからないかの違いが原因のようだ(最後まで突き止めてはいない)。

dynamips binary

Ubuntu bionic に ppa:gns3/ppa でインストールしたバイナリ。

$ apt-cache showpkg dynamips
Package: dynamips
Versions:
0.2.18-1~bionic1 (/var/lib/apt/lists/ppa.launchpad.net_gns3_ppa_ubuntu_dists_bionic_main_binary-amd64_Packages)

普通にインストールすると、amd64 のバイナリがはいる。ところがこのバージョンは segmentation fault した。valgrind で眺めると、こんな感じで JIT で起こっている様子。

vex amd64->IR: unhandled instruction bytes: 0x48 0xEB 0x20 0x48 0xB8 0xFC 0xB 0xC0 0xBF 0xFF
vex amd64->IR:   REX=1 REX.W=1 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:   VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=NONE
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
==11080== valgrind: Unrecognised instruction at address 0x10ada002.
==11080==    at 0x10ADA002: ???
==11080==    by 0x143D11: mips64_jit_run_cpu (in /tmp/dynamips)
==11080==    by 0x54696DA: start_thread (pthread_create.c:463)
==11080==    by 0x59E388E: clone (clone.S:95)
==11080== Your program just tried to execute an instruction that Valgrind
==11080== did not recognise.  There are two possible reasons for this.
==11080== 1. Your program has a bug and erroneously jumped to a non-code
==11080==    location.  If you are running Memcheck and you just saw a
==11080==    warning about a bad jump, it's probably your program's fault.
==11080== 2. The instruction is legitimate but Valgrind doesn't handle it,
==11080==    i.e. it's Valgrind's fault.  If you think this is the case or
==11080==    you are not sure, please let us know and we'll try to fix it.
==11080== Either way, Valgrind will now raise a SIGILL signal which will
==11080== probably kill your program.
==11080==
==11080== Process terminating with default action of signal 4 (SIGILL)
==11080==  Illegal opcode at address 0x10ADA002
==11080==    at 0x10ADA002: ???
==11080==    by 0x143D11: mips64_jit_run_cpu (in /tmp/dynamips)
==11080==    by 0x54696DA: start_thread (pthread_create.c:463)
==11080==    by 0x59E388E: clone (clone.S:95)
==11080==
==11080== HEAP SUMMARY:
==11080==     in use at exit: 3,414,955 bytes in 154 blocks
==11080==   total heap usage: 184 allocs, 30 frees, 3,460,236 bytes allocated
==11080==
==11080== LEAK SUMMARY:
==11080==    definitely lost: 0 bytes in 0 blocks
==11080==    indirectly lost: 0 bytes in 0 blocks
==11080==      possibly lost: 9,368 bytes in 25 blocks
==11080==    still reachable: 3,405,587 bytes in 129 blocks
==11080==         suppressed: 0 bytes in 0 blocks
==11080== Rerun with --leak-check=full to see details of leaked memory
==11080==
==11080== For counts of detected and suppressed errors, rerun with: -v
==11080== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

-j で JIT を無効化して起動させると segmentation fault は起こらないけれども、とーっても遅い。i386 なバイナリで実行しても segmentation fault は起こらなかったので、これで使うのが良さそう。

sudo dpkg --add-architecture i386
sudo apt-get install dynamips:i386