在 Vagrant 上为 Snappy 配置具有静态 IP 的私有网络

在 Vagrant 上为 Snappy 配置具有静态 IP 的私有网络

我正在尝试使用两个适配器 NAT 和 Host-Only 运行 Vagrant box ubuntu/ubuntu-15.04-snappy-core-stable,但是这不适用于此配置:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/ubuntu-15.04-snappy-core-stable"
  config.vm.box_check_update = false
  config.ssh.forward_agent = true

  config.vm.network "forwarded_port", guest: 22, host: 2222, id: 'ssh', auto_correct: true
  config.vm.network "private_network", ip: "192.168.33.10", auto_correct: false
  config.ssh.username = "ubuntu"
  config.ssh.host = "192.168.33.10"
end

结果:

> vagrant destroy --force; vagrant up 
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/ubuntu-15.04-snappy-core-stable'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: test_default_8376498
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 192.168.33.10:2222
    default: SSH username: ubuntu
    default: SSH auth method: password
    default: Warning: Connection timeout. Retrying...
    default: Warning: Host appears down. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Host appears down. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Host appears down. Retrying...
    default: Warning: Connection timeout. Retrying...

答案1

我们有一个可直接使用的流浪者形象,这样您就不必遇到这些障碍!

如果您下载并安装我们向您展示的图像https://developer.ubuntu.com/en/snappy/start/#vagrantvagrant ssh,一旦镜像启动,您就可以简单地通过它连接到您的 vagrant 镜像。

相关内容