LoginSignup
15
16

More than 5 years have passed since last update.

Vagrant + VirtualBox でネットワークアダプタのハードウェアを変更する

Posted at

VBoxManage modifyvmコマンドでは下記のように変更できる。

$ VBoxManage modifyvm VM_NAME --nictype1 Am79C970A
$ VBoxManage modifyvm VM_NAME --nictype2 82540EM

これを Vagrantfile に書く。

下記では、Adapter1(NAT)にAm79C970A(AMD PCNet PCI II)を、Adapter2(Host-only Adapter)に82540EM(Intel PRO/1000 MT Desktop)を指定している。

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "opscode-centos65"
  config.vm.network :private_network, ip: "192.168.33.99"

  config.vm.provider "virtualbox" do |v|
    v.customize ["modifyvm", :id, "--nictype1",  "Am79C970A"]
    v.customize ["modifyvm", :id, "--nictype2",  "82540EM"]
  end
end

modifvvmでは、様々なパラメータが指定できるので、VirtualBox のドキュメントを参考にすると良い。

15
16
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
15
16