0
votes

I'm running VirtualBox on a ubuntu (host), the VM i'm using is fedora (guest). VirtualBox is setup to use the NAT network adapter, and I'm able to get to the internet. i use Port Forwarding to access ssh and the rails web server

port Forwarding Rules

  <NAT>
    <DNS pass-domain="true" use-proxy="false" use-host-resolver="false"/>
    <Alias logging="false" proxy-only="false" use-same-ports="false"/>
    <Forwarding name="Rule 1" proto="1" hostport="5679" guestport="22"/>
    <Forwarding name="Rule 2" proto="1" hostport="3080" guestport="3000"/>
  </NAT>

now i can access internet on guest machine , and i can logging through ssh but i cannot access the Rails web server on port 3080

i tried : 
localhost:3080
10.0.2.15:3080 #the guest IP

what i can do all i need is SSH and internet connection and open the web site i host on gust machine by Browser in host machine

thanks

2
You need to add port forward localhost:3080 to guest:3080Ruby Racer
why i need that , WEBrick the rails web server use port 3000 on guest machine and i need to access it through port 3080 on host machine.Tarek Saied
Oh, sorry, I missed your last line in the conf...Ruby Racer

2 Answers

1
votes

Just a stab in the dark here but this might be your issue...

When you provision a new Linux Virtual Machine in VirtualBox, the Network settings for that VM are set to 'NAT'. This results in your new VM being assigned a 10.x.x.x address.

Change this setting to Bridged mode, which will assign your VM an address within the same subnet as your host (most likely 192.168.x.x).

Try to connect to the site running on your host.

If you're still not able to access the site running on localhost, confirm the app isn't blocking connections from your new VM. Add a rule in to your access list (possible iptables) permitting tcp port 80 traffic from your VM's address (found using ifconfig).

Happy hunting!

0
votes

In your VB you have to set network only with host. It is in preferences->network. Then you can access your virtual machine via 192.168.56.101 from ubuntu. Port forwarding set on this network card. List it with ifconfig. I recommend to use iptables for port redirects.