Question

I'm running vmware fusion 5 on osx 10.8, my guest OS is Arch Linux, currently I'm able to ssh into the guest os perfectly fine via ssh 172.16.4.191 however when i try a simple sinatra app

require 'sinatra'

get '/hi' do
  "Hello world!!!!!!!"
end

ruby hi.rb

2013-04-06 19:45:18] INFO  WEBrick 1.3.1
[2013-04-06 19:45:18] INFO  ruby 2.0.0 (2013-02-24) [x86_64-linux]
== Sinatra/1.4.2 has taken the stage on 4567 for development with backup from WEBrick
[2013-04-06 19:45:18] INFO  WEBrick::HTTPServer#start: pid=426 port=4567

it is not available from my host OS

curl 172.16.4.191:4567
curl: (7) couldn't connect to host

Any suggestions would be great, and of course I will provide more information as needed.

Edit:

Share with my mac is selected, "The virtual machine shares the ip address of the Mac on the external network. The mac provides NAT for network traffic form the virtual machine"

Edit:

I've switched over to bridged mode, and it's now sitting on my lan, i can still ssh into it, still no such luck connecting to my sinatra app.

and the iptables shows no rules

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
Was it helpful?

Solution

You need this line in your hi.rb:

set :bind, '0.0.0.0'

The Document says '0.0.0.0' is the default value. It's wrong.

OTHER TIPS

Just in case anyone is trying to do this on mac / windows 7 with vmware with NAT/sinatra, make sure IIS manager is installed and configured with (connect to server -> localhost:4567).

from my windows browser , localhost:4567/promo_id/ works

from my browser in mac, http://172.16.178.xxx:4567/promo_id/ where 172.16.178.xxx is the IPv4 Address from ipconfig

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top