Note that there are some explanatory texts on larger screens.

plurals
  1. POVagrant refuses to connect in private_network mode
    text
    copied!<p>I have set my Vagrant (1.2.2) VM running VistualBox to <strong>:private_network</strong> and I have started a Sinatra server on it. However I am not able to connect to that Sinatra instance. However the VM runs and responds to pings.</p> <p>Here is my Vagrantfile</p> <pre><code>Vagrant.configure("2") do |config| config.vm.box = "precise64" config.vm.network :private_network, ip: "192.168.33.10" end </code></pre> <p>So I start the Vagrant VM and ssh into it</p> <pre><code>prodserv$ vagrant up Bringing machine 'default' up with 'virtualbox' provider... [default] Setting the name of the VM... [default] Clearing any previously set forwarded ports... [default] Creating shared folders metadata... [default] Clearing any previously set network interfaces... [default] Preparing network interfaces based on configuration... [default] Forwarding ports... [default] -- 22 =&gt; 2222 (adapter 1) [default] Booting VM... [default] Waiting for VM to boot. This can take a few minutes. [default] VM booted and ready for use! [default] Configuring and enabling network interfaces... [default] Mounting shared folders... [default] -- /vagrant prodserv$ vagrant ssh Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-23-generic x86_64) * Documentation: https://help.ubuntu.com/ Welcome to your Vagrant-built virtual machine. Last login: Thu May 23 14:01:05 2013 from 10.0.2.2 </code></pre> <p>So up to here all is fine and dandy. A ping to the VM will work fine (I also checked that this is really the VMs ip. So pinging without vagrant up will lead to package loss)</p> <pre><code>prodserv$ ping 192.168.33.10 PING 192.168.33.10 (192.168.33.10): 56 data bytes 64 bytes from 192.168.33.10: icmp_seq=0 ttl=64 time=0.543 ms 64 bytes from 192.168.33.10: icmp_seq=1 ttl=64 time=0.328 ms </code></pre> <p>great! Now I start the server on the VM</p> <pre><code>vagrant@precise64:~$ sudo ruby /vagrant/server.rb == Sinatra/1.4.2 has taken the stage on 4567 for development with backup from Thin &gt;&gt; Thin web server (v1.5.1 codename Straight Razor) &gt;&gt; Maximum connections set to 1024 &gt;&gt; Listening on localhost:4567, CTRL+C to stop </code></pre> <p>this is the corresponding <strong>server.rb</strong></p> <pre><code>require 'rubygems' require 'sinatra' get '/' do puts "WOW!" 'Hello, world!' end </code></pre> <p>if I <strong>curl</strong> now from the <strong>guest VM</strong> to Sinatra everything works fine and "hello, world!" will be returned.</p> <pre><code>vagrant@precise64:~$ curl 'http://localhost:4567' Hello, world!vagrant@precise64:~$ #and the Sintra/Ruby process gets me this WOW! 127.0.0.1 - - [23/May/2013 16:06:36] "GET / HTTP/1.1" 200 13 0.0026 </code></pre> <p>However if I try to to <strong>curl</strong> from the <strong>host machine</strong> the connection gets refused.</p> <pre><code>prodserv$ curl -v 'http://192.168.33.10:4567' * About to connect() to 192.168.33.10 port 4567 (#0) * Trying 192.168.33.10... * Connection refused * couldn't connect to host * Closing connection #0 curl: (7) couldn't connect to host </code></pre> <p>So whats up?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload