问题
vagrant有三种网络连接方法:端口映射(Forwarded port) ,私有网络(Private network),公有网络(Public network)。
只有使用第一种端口映射能成功连接。当配置改为public_network或private_network时提示:
Vagrant attempted to execute the capability 'configure_networks'
on the detect guest OS 'linux', but the guest doesn't
support that capability. This capability is required for your
configuration of Vagrant. Please either reconfigure Vagrant to
avoid this capability or fix the issue by creating the capability.
解决方法
登入系统(Ubuntu)后,创建文件/etc/os-release
, 写入以下内容:
NAME="Ubuntu"
VERSION="12.04 LTS, Precise Pangolin"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu precise (12.04 LTS)"
VERSION_ID="12.04"
重启vagrant reload
另外,在配置文件中设置的IP必须与宿主在同一网段。
比如, 宿主ip是192.168.17.1
, 配置文件 config.vm.network "public_network", ip: "192.168.30.10"
。这样是访问不了的,修改配置为"192.168.17.10"
即可。
@link https://github.com/mitchellh/vagrant/issues/6426#issuecomment-234977448
版权声明:本文为Allen_Tsang原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。