2016-11-16 42 views
1

使本地主機正常工作時出現問題。本地主機在Windows(8.1)版本上建立流動和虛擬機 - 流浪文件規範

運行git bash的我已經成功地漂泊不定的init 「hashicorp/precise32」

無業遊民了

也許我把我的本地主機IP在錯誤的地方:127.0.0.1

確認我的虛擬機正在運行,這是我的無業遊民文件:

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

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 

Vagrant.configure(2) do |config| 

    config.vm.box = "hashicorp/precise32" 

    # config.vm.boot_timeout = "300" 
    # Setting this above never worked for me when i had a config.vm.boot_timeout 

    config.vm.network :forwarded_port, guest: 80, host: 8082 

    # config.vm.network :public_network 
    config.vm.network "private_network", ip: "127.0.0.1" 

    config.vm.synced_folder ".", "/vagrant", type: "nfs" 


    config.vm.provider :virtualbox do |vb| 
    vb.gui = true 

# I turned this vb.gui = true on when i was having a problem with config.vm.boot_timeout 

    vb.customize ["modifyvm", :id, "--memory", "4096"] 
    vb.cpus = 4 

    end 

end 

我已經添加了一些額外的選擇,但我覺得我的IP或端口都是錯誤的。任何幫助將不勝感激。謝謝。

編輯************************

主機文件看起來像這樣:

# Copyright (c) 1993-2006 Microsoft Corp. 
# 
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows. 
# 
# This file contains the mappings of IP addresses to host names. Each 
# entry should be kept on an individual line. The IP address should 
# be placed in the first column followed by the corresponding host name. 
# The IP address and the host name should be separated by at least one 
# space. 
# 
# Additionally, comments (such as these) may be inserted on individual 
# lines or following the machine name denoted by a '#' symbol. 
# 
# For example: 
# 
#  102.54.94.97  rhino.acme.com   # source server 
#  38.25.63.10  x.acme.com    # x client host 

# localhost name resolution is handle within DNS itself. 
     127.0.0.1  localhost 
     ::1    localhost 

後我流浪的重裝:

$ vagrant reload 
==> default: [vagrant-hostsupdater] Removing hosts 
==> default: Attempting graceful shutdown of VM... 
==> default: Checking if box 'hashicorp/precise32' is up to date... 
==> default: Clearing any previously set forwarded ports... 
==> 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: 80 (guest) => 8082 (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: Machine booted and ready! 
[default] GuestAdditions 5.1.8 running --- OK. 
==> default: Checking for guest additions in VM... 
==> default: [vagrant-hostsupdater] Checking for host entries 
==> default: Configuring and enabling network interfaces... 
==> default: Mounting shared folders... 
    default: /vagrant => C:/Users/Timothy/Documents/Magento 
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision` 
==> default: flag to force provisioning. Provisioners marked to run always will still run. 

這是爲什麼現在這麼混亂,我從來沒有這麼麻煩建立一個本地開發。環境。

回答

1

你不能使用你的主機的私人網絡127.0.0.1這是你的環回適配器,所以它永遠不能到達你的虛擬機。

您應該使用在3個以下範圍(見https://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces

  • 10.0.0.0 - 10.255.255.255
  • 172.16.0.0 - 172.31.255.255
  • 192.168.0.0 - 192.168.255.255

vagrant已經創建了一個NAT適配器10.0.2.15通過ssh進行通信。

我建議採取在192.168.x.x範圍內的IP,你將能夠與你的虛擬機

+0

正常工作,有沒有辦法只使用本地主機IP,而不是利用專用網絡在所有。它不需要是私人的。我只想運行燈泡環境,就像我在xampp或wamp上一樣。 @Frederic Henri – Supplement

+0

我是否將我的主機文件更改爲192.168.7.7 localhost ????? – Supplement

+0

所以我現在正在爲localhost工作,但它沒有找到我的文件夾與我的文件。它的工作http://127.0.0.1:8082/ – Supplement