VirtualBox with bridged network mode on Debian 7.1

ようやく、Debian 上で VirtualBox を Bridged network モードで動かせるようになったので、メモ。

環境:

  • OS: Debian 7.1 (x64)
  • VirtualBox 4.1.18 (2013.8.中旬に apt-get でインストール)
  • NICは一枚 (eth0)

手順:

(1) bridge-utils をインストール
# apt-get install bridge-utils

(2) コマンドで br0 インターフェースを作成
# brctl addbr br0

(3) /etc/network/interface を以下のように編集<ここから>--------
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 0.0.0.0

auto br0 inet static
address 192.168.0.1 # ここには実際に存在する NIC の IP を設定
netmask 255.255.255.0
gateway 192.168.0.254
dns-nameservers 192.168.0.254
bridge_ports eth0<ここまで>--------

(4) 上記 interface ファイルの設定を反映
# /etc/init.d/networking restart

(5) VirtualBox を起動し、Network の設定で Bridge 接続を選択/設定


  • Attached to: は "Bridged Adapter" に。
  • Name: は手順(2) で作成した Bridge Interface を選択。
  • あとは適当に設定

これで、VirtualBox 上で LAN 内 IP を持つ仮想PCを動作させることができる。\(^o^)/