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 5 years have passed since last update.

Vagrant1.8.6 + ubuntu16.04.1 + virtual box5.1. 8で private_networkが動かなかったことについてメモ

Last updated at Posted at 2016-11-02

環境はWindows10。

以下のような設定で立ち上げていたが、2回目から繋がらない障害が発生。

Vagrantfile
Vagrant.configure(2) do |config|
  config.vm.box = "bento/ubuntu-16.04"
  config.vm.box_version = "2.2.9"
  config.vm.network "private_network", ip: "192.168.33.11"
end

以下のような表示が出ていたため、問題の切り分けのためにbentoではなく
自分でboxファイルを作って試してみた。

Guest Addition version 5.0.26
VirtualBox version 5.1 

起動して最初は繋がるが、bentoのboxと同じように2回目の立ち上げから繋がらない不具合が発生。
バージョンが原因ではないようだ。

$ ifconfig

で確認したところ、enp0s8が存在しなくなっていた。

ネットワーク設定を確認してみる。

/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp0s3
iface enp0s3 inet dhcp
# VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
auto enp0s3
iface enp0s3 inet static
      address 192.168.33.11
      netmask 255.255.255.0
# VAGRANT-END

#VAGRANT BEGIN以降の記述がおかしい。
enp0s8であったところがenp0s3になっている。
試しに以下のように書き直して再起動したところ、ネットワークは設定された。

/etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp0s3
iface enp0s3 inet dhcp
# VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
auto enp0s8
iface enp0s8 inet static
      address 192.168.33.11
      netmask 255.255.255.0
# VAGRANT-END

boxを作るときに、ネットワーク設定を保存したまま作ってしまった可能性がある。
bentoのほうも要確認していきたい。

ifconfigで確認したところ、ipv6のアドレスが設定されていた。
Windowsのネットワークカードの設定の可能性もでてきた。

network.png

ipv6を外してやると繋がった。

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?