VirtualBoxではVirtualBox 3.1から準仮想ネットワーク(virtio-net)をサポートしています。 これを使うと簡単に言えばネットワークパフォーマンスが向上します。少しでも速くて「軽い」ほうがいいですよね?
で、どうするかというと次のページにあるようにそれぞれの設定に「nic_type: “virtio"」を追加すれば良いみたいです。
以下にVagrantfileのサンプルを例示してみます。 注意点としてはなぜかこの記述を入れるとFedoraの公式Vagrantファイルがログインできる状態にならないということです。CentOS 7とUbuntu Xenial(16.04)の公式イメージでは問題なく利用できました。
ちなみにデフォルトで割り当てられるNATネットワークの方は手動でvirtio-netに切り替えると準仮想ネットワークが利用できるようです。これで多少CPU使用率が下がればいいですね。仕組み上は完全仮想ドライバーよりもCPU使用率は下がるはずですから。
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
#custum config
Vagrant.configure(2) do |config|
VAGRANTFILE_API_VERSION = "2"
config.vbguest.auto_update = false
#Global
config.vm.provider "virtualbox" do |vb|
# Use VBoxManage to customize the VM.
vb.customize [
"modifyvm", :id,
"--cpus", "1",
"--memory", "1024",
"--paravirtprovider", "kvm",
]
end
#CentOS7
config.vm.define :cent7n0 do |cent7n0|
cent7n0.vm.box = "cent/7"
cent7n0.vm.hostname = "cent0"
cent7n0.vm.network "private_network", ip: "192.168.0.211", nic_type: "virtio"
end
...
end