My rails server (WEBrick 1.3.1) is set on the virtual machine (ubuntu 12.04) and use NAT. The default IP address is 10.0.2.15 with port 3000. How can I access from my host machine (win8) ?
I have tried to use port forwarding but it doesn't work.
Settings -> Network -> Port forwarding
Protocol | Host IP | Host Port | Guest IP | Guest Port
TCP 127.0.0.1 3308 10.0.2.15 3000
By setting your port forwarding as you did, you are telling your host PC that when you visit 127.0.0.1 at port 3308 in your browser, you want that resolved to be your guest virtual machine's I.P. address at port 3000.
With your virtual machine's Rails server running, open a browser on your host PC and navigate to 127.0.0.1:3308.
If your browser doesn't render your guest server's web pages, I'd suspect you have a port conflict (that port 3308 may already be in use). In that case, search for ways to view what ports are currently in use on your PC. Find a port which is not in use and use that in your port forwarding's host port settings.
If anyone faces the same problem, after port forwarding, I resolved this problem running the server binding the ip address of the virtual machine like this:
rails server -b 10.0.2.15
Related
I have laravel app which is running in my windows local server. This laravel app is running port:80. I want to load this app in my Ubuntu VirtualBox.
My IP Config:
IPv4 Address : 192.168.8.157
Subnet Mask : 255.255.255.0
Default Gateway: 192.168.8.1
I have config my virtualbox as Bridged Adapter. In my /etc/hosts (ubuntu virtualbox), I have this :
127.0.0.1 localhost
127.0.1.1 asus
192.168.8.157 v2.my.local
I have made a hello word app (node.js) in my local windows which is running on port :3000, and it is running in my VirtualBox by typing v2.my.local:3000, but if I type v2.my.local on my VirtualBox, it is not working (although app is running on windows local machine). it says:
This v2.my.local page can’t be found
Any suggestion? Thanks in Advance.
May be windows firewall blocking connections via port 80. turn off firewall and try it, if it works. Start windows firewall and add firewall rule to allow connections via port 80. If your windows version is 10 then, it will block all virtual box related connections. make sure to add correct rules.
I am having problem accessing polymer serve from WLAN via local IPv4 address on port 8080 on Windows 10.
I have open up the port 8080 on Windows Firewall for TCP, but it doesn't resolve the problem.
I can access 127.0.0.1:8080 on local machine, but fail to access 192.168.0.x (i.e. local IPv4 address) from the same local machine on my web browser. Any idea?
use polymer serve -H 0.0.0.0
polymer serve defaults to localhost which typically is 127.0.0.1 only.
I'm running OS X Mountain Lion on a machine with local IP address 192.168.1.6 (as reported by both the Network utility and ifconfig) and am running a local (Django) development web server on port 8000 that I would like to connect to from a virtual machine running a guest OS on the same machine.
On the host OS (ie, OS X running on the metal of the machine w/ address 192.168.1.6) I can connect to my test web server through the browser by navigating to 127.0.0.1:8000; or localhost:8000; but not when using the machine's local IP address. Here's what makes this extra confusing:
The router is not filtering the ports; and, just to be sure, I've set it to explicitly forward ports 8000 and 22 to 192.168.1.6; And speaking of port 22,
When I start the SSH service, I can connect (from the command line) via ssh 192.168.1.6
It's not a browser issue, because I also can't telnet to 192.168.1.6 port 8000 (connection refused) while I can telnet to 127.0.0.1 port 8000, and I can also telnet to 192.168.1.6 port 22
The firewall is set to off (as reported in System Preferences) but to be extra safe, I've also set an ipfw rule to allow everything through
Here are the ipfw rules:
00100 allow tcp from any to any dst-port 8000
65535 allow ip from any to any
Here is additional confirmation that the port is, indeed, being listened to by my test server:
netstat -an | grep 8000
tcp4 0 0 127.0.0.1.8000 *.* LISTEN
so what's going on here? Somehow port 22 is being treated differently than port 8000, but every place I can think to look for those differences I can't find any. Why can't I get into this machine's port 8000 using its local ip address?
When you start Django development server you need to give the address explicitly:
python manage.py runserver 192.168.1.6:8000
Or if you want the server to run on all interfaces you can use:
python manage.py runserver 0.0.0.0:8000
In other case Django development server defaults to running on the local interface only.
The problem for me was I accidentally quit the server whenever trying to copy the server address. So instead of using ctrl+C just write down the address into your browser.
I solved the issue.There are a few things you might be missing.Listing them below-
1.Once it starts the server, do not press Ctrl+C anyhow .u might be pressing it to copy to url and that accidently closes the server due to which it might be happening.
2.instead of http://127.0.0.1:8000/ ...change the port number to http://127.0.0.1:8080/ ...That would work.
3.Try changing the firewall setting and allow the app.
4.Try opening it with different browsers and incognito too.
The above steps helped solve my issue.Hope they help u too...:)
I am using Pycharm and testing on local dev server. All goes well until I try to connect to the local dev server from another laptop (windows).
My dev server is 127.0.0.1:8000 on a mac. On the second computer, I am able to ping the server's LAN ip 10.0.2.2 successfully. But enter 10.0.2.2:8000 in browser address bar doesn't connect to anything.
telnet 10.0.2.2 8000 in command line also fails.
How can I do this?
Listen to address 0.0.0.0 instead of 127.0.0.1
This means it will listen to all, you can listen to specific IP but this would work on both local and network.
For beginner like me, screenshot can help.
If leaving Host field to be empty, it will default to 127.0.0.1, which is not we want in such situation.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Here is my setup:
- Host: Windows XP
- Guest: Ubuntu 10.04
- Networking: NAT
I am setting an Apache web server on the Guest, but I want to be able to do this on the Windows machine:
- go to the browser, type http://localhost:8000
Also, I tried to change my networking to bridge and I got a new IP. But when I tried to do http://:8000, it says that it could not connect.
Network communication Host -> Guest
Connect to the Guest and find out the ip address:
ifconfig
example of result (ip address is 10.0.2.15):
eth0 Link encap:Ethernet HWaddr 08:00:27:AE:36:99
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
Go to Vbox instance window -> Menu -> Network adapters:
adapter should be NAT
click on "port forwarding"
insert new record (+ icon)
for host ip enter 127.0.0.1, and for guest ip address you got from prev. step (in my case it is 10.0.2.15)
in your case port is 8000 - put it on both, but you can change host port if you prefer
Go to host system and try it in browser:
http://127.0.0.1:8000
or your network ip address (find out on the host machine by running: ipconfig).
Network communication Guest -> Host
In this case port forwarding is not needed, the communication goes over the LAN back to the host.
On the host machine - find out your netw ip address:
ipconfig
example of result:
IP Address. . . . . . . . . . . . : 192.168.5.1
On the guest machine you can communicate directly with the host, e.g. check it with ping:
# ping 192.168.5.1
PING 192.168.5.1 (192.168.5.1) 56(84) bytes of data.
64 bytes from 192.168.5.1: icmp_seq=1 ttl=128 time=2.30 ms
...
Firewall issues?
#Stranger suggested that in some cases it would be necessary to open used port (8000 or whichever is used) in firewall like this (example for ufw firewall, I haven't tested):
sudo ufw allow 8000
That's not possible. localhost always defaults to the loopback device on the local operating system.
As your virtual machine runs its own operating system it has its own loopback device which you cannot access from the outside.
If you want to access it e.g. in a browser, connect to it using the local IP instead:
http://192.168.180.1:8000
This is just an example of course, you can find out the actual IP by issuing an ifconfig command on a shell in the guest operating system.