0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

vagrantで複数のbridgeネットワークがある場合

Posted at

はじめに

vagrantで複数のbridge(public)ネットワークがある場合、vagrantfileにbridgeを指定していないと、vagrant upの際、「youどっちにする?」って聞かれてうざいです。
その場合のvagrantfileの記述方法

vagrantfile

ホストマシンに複数のNIC(LAN A,LAN B)があって、それぞれの仮想ネットワークにbridgeします。
ネットワークの設定にbridgeの指定が無いと、vagrant upの際、以下のように聞かれます。

==> router: Available bridged network interfaces:
1) LAN A - 仮想ネットワーク
2) LAN B - 仮想ネットワーク
==> router: When choosing an interface, it is usually the one that is
==> router: being used to connect to the internet.
==> router:
    router: Which interface should the network bridge to?

起動時にvagrant upを自動起動させたい場合、途中で止まってしまいます。

ではどうするか

以下のようにvagrantfileにネットワークアダプタ名をbridgeの引数として書けばOK。
※windowsのvagrantでハマったんですが、NICの名前に全角文字がある場合、vagrantfileがshift-jisだとエラーが出ます。文字コードを「UTF-8」にして保存。気をつけましょう。

vagrantfile
config.vm.network "public_network", bridge: "LAN A - 仮想ネットワーク"
config.vm.network "public_network", bridge: "LAN B - 仮想ネットワーク"
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?