在Windows上使用流浪时,vm实例未将默认设置为桥接模式



我试着遵循这个线程:Vagrant如何设置网络类型,使其连接到虚拟盒上的网桥适配器,也有类似的问题,但没有成功。

还尝试了一下:如何在Vagrant中自动选择桥接的网络接口?

和流浪医生https://www.vagrantup.com/docs/providers/virtualbox/configuration是特定于Linux的。

这是我的流浪档案。

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

Vagrant.configure("2") do |config|
config.vm.box = "xoan/proxmox-ve_6.4"
config.vm.box_version = "1.0.0"
config.vm.network "forwarded_port", guest: 8006, host: 8006
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network", auto_config: false, Bridged: 'Realtek PCIe GbE Family Controller #5',  ip: "192.168.56.2",
nic_type: "virtio"
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
vb.gui = true

# Customize the amount of memory on the VM:
vb.memory = 2048
vb.cpus = "2"
vb.name = "proxmox1"
end
end

我将NAT指定为桥接模式,并为其提供VirtualBox看到的以太网卡名称。(指定名称是因为我有多个nic接口(

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'xoan/proxmox-ve_6.4'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'xoan/proxmox-ve_6.4' version '1.0' is up to date...
==> default: Setting the name of the VM: proxmox1
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: bridged
==> default: Forwarding ports...
default: 8006 (guest) => 8006 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...

但每次我漫游时,我都会将NAT 1作为默认

转发到127.0.0.1的端口是否到了正确的NAT,您应该尝试从主机ping ip192.168.56.2。您应该能够使用pivate密钥(即(对该ip进行ssh

ssh -i private_key 192.168.56.2

最新更新