3

设置:在我的笔记本电脑上,我安装了 windows 10 pro。为此,我安装了最新的 virtualbox 5.1.2、最新的 vagrant 1.9.1 和最新的打包程序 0.12.1。我的笔记本电脑很高端,配置也很强大。我在wifi上。

目的:我想要三个运行 Windows 2012 r2 的 vagrant box,这样我就可以在其中一个上安装 SQL Server,在另一个上安装两个不同的 Web 应用程序。

成功:到目前为止,我已经成功地创建了 vagrant box,没有任何麻烦。如果我使用转发端口方法,我什至可以 rdp 进入那些机器。

失败:我的计划是给这些机器配置私网,让它们有自己的ip地址,可以互相通信。但到目前为止,我无法做到这一点。vagrantup.com 和其他网站上推荐的专用网络设置似乎对我不起作用,因为我确信我在某处犯了一些错误。

有人可以帮我解决这个问题吗?我也在这个网站上进行了很多搜索,并提出了很多建议,但似乎没有任何帮助。

下面是我正在使用的流浪文件。

Vagrant.configure(2) do |config|

    config.vm.box = "xxxx.box"

    config.vm.communicator = "winrm"
    config.vm.hostname = "xxxserver"    

    # Admin user name and password
    config.winrm.username = "vagrant"
    config.winrm.password = "vagrant"

    config.vm.guest = :windows
    config.windows.halt_timeout = 600
    config.vm.network "private_network", ip: "192.168.50.4"

end

以下是我运行 vagrant rdp * 时收到的错误消息

==> 默认值:检测 RDP 信息... 无法检测到此机器的 RDP 连接信息。这通常是在我们找不到要连接到 RDP 的 IP 或端口时引起的。请验证您正在转发 RDP 端口并且您的计算机可访问。

*

但如果我更换

config.vm.network "private_network", ip: "192.168.50.4" 

config.vm.network "forwarded_port" , host: 33390 , guest: 3389

然后重新加载该框,然后 vagrant rdp 工作正常,我可以登录它。我想为我的虚拟机使用静态 ips。

请指导..谢谢。

4

1 回答 1

0

我还使用带有静态 IP 的 private_network。仅添加(而不是替换)该行config.vm.network "forwarded_port" , host: 33390 , guest: 3389有效。

$ vagrant rdp
==> fe: Detecting RDP info...
    fe: Address: 127.0.0.1:33389`enter code here`
    fe: Username: vagrant
==> fe: Vagrant will now launch your RDP client with the connection parameters
==> fe: above. If the connection fails, verify that the information above is
==> fe: correct. Additionally, make sure the RDP server is configured and
==> fe: running in the guest machine (it is disabled by default on Windows).
==> fe: Also, verify that the firewall is open to allow RDP connections.
于 2018-08-08T07:57:45.903 回答