vagrantでbridge接続でエラーがでたときの対処法

Windows10を使っていて、vagrant+virtualBOXでbridge接続をしようとしたらエラーとなりました

エラー箇所

01PS D:\vm\centos7> vagrant up
02Bringing machine 'default' up with 'virtualbox' provider...
03==> default: Importing base box 'centos/7'...
04==> default: Matching MAC address for NAT networking...
05==> default: Checking if box 'centos/7' version '2004.01' is up to date...
06==> default: Setting the name of the VM: buildree-dev
07==> default: Clearing any previously set network interfaces...
08==> default: Specific bridge 'VirtualBox Host-Only Ethernet Adapter' not found. You may be asked to specify
09==> default: which network to bridge to.
10==> default: Available bridged network interfaces:
11==> default: When choosing an interface, it is usually the one that is
12==> default: being used to connect to the internet.
13==> default:
14    default: Which interface should the network bridge to?
15    default: Which interface should the network bridge to?
16    default: Which interface should the network bridge to?
17    default: Which interface should the network bridge to?

default: Which interface should the network bridge to? となり、この後何も進みません。しょうがないのでCtrl+Cでキャンセルします

マシンの状態

マシンのスペックなどは以下になります

  • OS:Windows10
  • エディション:Pro
  • バージョン:21H1
  • ビルド番号:19043.1055
  • vagrantバージョン:2.2.14
  • バーチャルBOXバージョン:6.1.14
  • LAN:192.168.1.x

となります。インストールしようとしたOSはCentOS7となります

原因:バーチャルBOXのバージョンが古かった?

バーチャルBOXのバージョンを最新の6.1.22にしたところ、問題なく動作しました

01PS D:\vm\centos7> vagrant up
02Bringing machine 'default' up with 'virtualbox' provider...
03==> default: Importing base box 'centos/7'...
04==> default: Matching MAC address for NAT networking...
05==> default: Checking if box 'centos/7' version '2004.01' is up to date...
06==> default: Setting the name of the VM: buildree-dev
07==> default: Fixed port collision for 22 => 2222. Now on port 2200.
08==> default: Clearing any previously set network interfaces...
09==> default: Specific bridge 'VirtualBox Host-Only Ethernet Adapter' not found. You may be asked to specify
10==> default: which network to bridge to.
11==> default: Preparing network interfaces based on configuration...
12    default: Adapter 1: nat
13    default: Adapter 2: bridged
14==> default: Forwarding ports...
15    default: 22 (guest) => 2200 (host) (adapter 1)
16==> default: Running 'pre-boot' VM customizations...
17==> default: Booting VM...
18==> default: Waiting for machine to boot. This may take a few minutes...
19    default: SSH address: 127.0.0.1:2200
20    default: SSH username: vagrant
21    default: SSH auth method: private key
22    default:
23    default: Vagrant insecure key detected. Vagrant will automatically replace
24    default: this with a newly generated keypair for better security.
25    default:
26    default: Inserting generated public key within guest...
27    default: Removing insecure key from the guest if it's present...
28    default: Key inserted! Disconnecting and reconnecting using new SSH key...
29==> default: Machine booted and ready!
30==> default: Checking for guest additions in VM...
31    default: No guest additions were detected on the base box for this VM! Guest
32    default: additions are required for forwarded ports, shared folders, host only
33    default: networking, and more. If SSH fails on this machine, please install
34    default: the guest additions and repackage the box to continue.
35    default:
36    default: This is not an error message; everything may continue to work properly,
37    default: in which case you may ignore this message.
38==> default: Configuring and enabling network interfaces...
39==> default: Rsyncing folder: /cygdrive/d/vm/centos7/ => /vagrant

vagrantのファイル

vagrantはブリッジ接続は以下のようにしてます

1config.vm.network "public_network", ip: "192.168.1.200"

個人支援・寄付について

サイトラボでは個人支援・寄付を受けております。ご協力いただける方はお願いいたします。当サイトではビットコインで受け付けております。

  • ビットコイン:3LHnADwZwUbic2L45EnVJEykiG6KfbqrwS