Hello i am trying to access my Webrick rails server that i started on my ubuntu to my windows 7 pc locally. I checked on ifconfig in my virtual box and used the inet:10.0.2.15 when i run my rails server and also used port 80 like this:
rails server -b 10.0.2.15 -p 80
It didn't gave me an error in the terminal but when i try to go to 10.0.2.15 on my windows browser, it says it can't connect. I tried disabling the firewall in windows but still wont work. Thank you.
Choose another network type for your VM ubuntu. I suggest the Bridged Network. Reboot vm, it should obtain ip in same network as your windows host (example 192.168.0.XXX). Then you will be able reach your rails server from network At any port 80 or 3000.
Can you share your ubuntu with the vm, via the apache server too? is that started? In macs you have to enable web sharing (or something similar to that wording). ON ubuntu what happens when you do localhost:80... if i recall it should say it works! or something like that.
Related
I'm using docker inside VirtualBox (Ubuntu Server 20.04), since I cannot use Docker Desktop in the host (Windows 10).
I have a docker nodejs container on port 3000. In my host I can access it through 192.168.56.110:3000, where 192.168.56.110 is the IP address of the VM but I need to access it through localhost:3000.
The setup is of course similar to a docker-toolbox installation (as in this question), for which I've found that the host localhost also does not work, to put it simple.
I've tried to map localhost in Windows 10, as suggested in a few answers like this one adding to C:\Windows\System32\Drivers\etc\hosts:
192.168.56.110 localhost
192.168.56.110 dev.com
But while dev.com works right away as expected, localhost doesn't.
Is there a workaround?
When I run an Angular development server in the guest, I can access it via localhost:4200 from the host but it is not completely clear to me what happens behind the scenes. Side question, how does ng serve lead to the "redirection" of localhost in the host OS?
Run as administor a windows command prompt and enter:
netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=3000 connectaddress=<replace with docker ip address> connectport=3000
To confirm, run
netsh interface portproxy show all
Good luck.
I've tried from all Stack Overflow's existing answer for this topic but they're not working for me. I've tried using http proxy with Squidman, created local network between my iPhone and my mac with static IP, then accessing it using my machine IP address. I've also tried ping my mac using my Windows pc, it can't ping to my mac but my Mac can ping my Windows, both firewall are disabled.
Any configuration that I missed?
if your desktop is (192.168.0.101), you need to run your service as 0.0.0.0:8080 (example port). Usually ports are bound to 127.0.0.1
This way your router can direct requests from 192.168.0.101:8080 to your application. Ensure you undo this in case you exposing sensitive data.
Assuming your mac ip is $ip, you can do the following to make port $port accessible from your local network:
$ ssh -R $ip:$port:localhost:$port localhost
It will relay all requests from $ip:$port to the localhost server.
Example:
$ ssh -R 172.16.0.111:3000:localhost:3000 localhost
(Posted on behalf of the OP)
The main problem that causes my Mac can't be accessed by other device is the firewall blocked ICMP. Then I disabled it using this command below:
pfctl -d
My firewall rules list:
Box requires you to use HTTPS for any URL other than localhost. Unfortunately, I developed on a Linux virtual machine running inside a Windows machine, and I want to access the server running on Linux from a browser in Windows. Therefore, I cannot use localhost.
Is there a way that I test out my box application without needing to create a certificate on my Linux machine?
Yes. You can use an SSH tunnel.
Set up an SSH server on the Linux machine (make sure you secure it if it's accessible from the Internet)
Use a Windows SSH client (like plink or cygwin's SSH client) to create a tunnel to the desired port (80?) of the Linux box. For example, if you're using plink:
C:\>plink.exe -L 1234:127.0.0.1:80 <username>#<Linux machine IP>
using cygwin, the command would be the same:
$ ssh -L 1234:127.0.01:80 <username>#<Linux machine IP>
This will establish a tunnel between the Windows machine's local port 1234 (127.0.0.1:1234) and the Linux machines port 80 (127.0.0.1:80). So if you open a browser on the Windows machine and point it to 127.0.0.1:1234, you'll really be connecting to 127.0.0.1:80 of the Linux machine.
There are some nice tutorials on SSH tunnels, but make sure you're reading about the right type of tunnel. They come in 3 forms - Local (-L), Remote (-R) and Dynamic (-D). You need the local one.
To debug the tunnel, you can use nc. Use something like nc -l 127.0.0.1 80 to get nc to listen on 127.0.0.1:80, then try using the tunnel from the Windows browser. You should see the HTTP request in nc.
I need to test my site on IE. I have Ubuntu installed. My Rails app is running on localhost:3000. Now, when I try to go to myIP:3000, I get the error:
Site can't be reached.
I had previously used the same IP to access the server, and it worked. I am not sure why it no longer works.
Is there a way to fix this to make it work as I expect? I don't want to push to Heroku every time I need to test on IE.
Method 1
Update:
No need to start with IP address. Thanks to Thorin. Starting server with 0.0.0.0 will do the trick.
rails server -b 0.0.0.0 -p 3000
On a linux machine, type ifconfig and note down your local IP.
Run your server like this
rails server -b 192.168.X.XXX -p 3000
where you pass your local ip to -b
Now make sure both the machines are connected to your local Wi-Fi. On your windows machine navigate to http://192.168.X.XX:3000
Method 2
Install wine in your ubuntu machine and install IE preferable version. Will be easier to access everything from a single machine.
i am developing a facebook app and i am using for that facebooker plugin and webrick server.
i have configured correctly my router to froward ports to my machine for 2 ports (80 and 3000)
the apache server can be accessed from the net http://ip:80 amd the webrick server can http://ip:3000 ,
i dont understand why , please help me.
What IP address do you have WEBrick set to listen on? My guess is it could be set to “127.0.0.1” which would cause the problem you’re describing. If so, set it to “0.0.0.0” and see if that works. If you’re starting the server with script/server, you can specify the IP to bind to with the -b flag:
script/server webrick -b 0.0.0.0 -p 3000
You have to access it from another Network not in your network. Because your server is running on IP and your accessing machine is also connected to the same IP[because of port forwarding]. So it will not work in same network. You have to access it from different WAN IP Network.