VirtualBox VM 不获取 Vagrant 指定的已定义 IP 地址
VirtualBox VM does not acquire defined IP address specified with Vagrant
所以我有这个 Vagrant 文件:
# -*- 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.
Vagrant.configure("2") do |config|
#Box settings
config.vm.box = "ubuntu/bionic64"
config.vm.hostname = "vagrant.demo"
#Networks settings
# config.vm.network "forwarded_port", guest: 22, host: 2222
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
config.vm.network "private_network", ip: "192.168.56.4"
# config.vm.network "public_network"
#Provider settings
config.vm.provider "virtualbox" do |vb|
vb.memory = 2048
vb.cpus = 2
vb.name = "vagrant.demo"
end
在我执行我的 vagrant up
命令后,我使用 vagrant ssh
ssh 进入虚拟机并检查虚拟机是否具有定义的 IP 地址,但我只看到这个:
Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-173-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Thu Mar 31 14:39:57 UTC 2022
System load: 0.24 Processes: 106
Usage of /: 2.8% of 38.71GB Users logged in: 0
Memory usage: 8% IP address for enp0s3: 10.0.2.15
Swap usage: 0%
192.168.56.4
IP 地址未按预期显示。知道缺少什么吗?
我在 Ubuntu 20.04.3
上使用 Vagrant 6.1.32
。
所以解决方案是降级到 VirtualBox 6.1.26
。查看讨论 here
所以我有这个 Vagrant 文件:
# -*- 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.
Vagrant.configure("2") do |config|
#Box settings
config.vm.box = "ubuntu/bionic64"
config.vm.hostname = "vagrant.demo"
#Networks settings
# config.vm.network "forwarded_port", guest: 22, host: 2222
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
config.vm.network "private_network", ip: "192.168.56.4"
# config.vm.network "public_network"
#Provider settings
config.vm.provider "virtualbox" do |vb|
vb.memory = 2048
vb.cpus = 2
vb.name = "vagrant.demo"
end
在我执行我的 vagrant up
命令后,我使用 vagrant ssh
ssh 进入虚拟机并检查虚拟机是否具有定义的 IP 地址,但我只看到这个:
Welcome to Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-173-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Thu Mar 31 14:39:57 UTC 2022
System load: 0.24 Processes: 106
Usage of /: 2.8% of 38.71GB Users logged in: 0
Memory usage: 8% IP address for enp0s3: 10.0.2.15
Swap usage: 0%
192.168.56.4
IP 地址未按预期显示。知道缺少什么吗?
我在 Ubuntu 20.04.3
上使用 Vagrant 6.1.32
。
所以解决方案是降级到 VirtualBox 6.1.26
。查看讨论 here