Virtual server port forwarding - web

local connection
Nmap scan of public ip address
Open Port Check Tool result
Virtual server configuration
I have a linux machine on a dekstop with arch linux installed that I use as a server running Apache2 (it works perfectly fine locally), and I want to use port forwarding to access it from the public ip address.
I tried using the router's virtual server service, so I redirected my local to port 2112 of my public ip address, I already used http://www.portchecktool.com/ to scan the port, and it says that the port is open whenever I enable it (I tried changing the port number many times, 443, 22, 5555...). But when I try to connect, it says 'Unable to connect'.
(Even thought the port scanner tool says the port is open on my public ip, when I scan my router's port with nmap it says it's closed)
I know I didn't provide many details, but is there something that I'm missing ?
EDIT:
It seems that the problem only occurs locally, which is why the nmap and port checker results are different, I asked a friend of mine to connect to my public ip address on port 2112, and he told me that it's working fine, and that he could see the page, why does this problem occur ? Why can I access it from outside LAN but not from the inside ?

There are a few parts to this answer:
To keep it simple I am going to assume a few things as you did not specify too many things.
What you have
Ubuntu Server VM running on your Windows machine
What you are trying to do
Connect to the VM (running Apache2) to view a website on the server via your public IP
If either of these are incorrect let me know
Ensure you first have port-fording setup on your main router to go to your Windows machine local IP. Open the correct port that your Appache2 server is running on.
Ensure you have opened the correct port on your windows machine firewall to allow that inbound traffic
Change the network settings for your VM to bridge the connection

Related

how to connect to a server running on computer using computer's IP address?

I am working on IOT project in which I have to change some variables(fans speed, lights, etc). So just as a starter, I created a node.js server and tried to send requests to the server through a local network using local IP as
http://localhost:7000/users=mandar?lights=OFF
or
http://192.168.43.248:7000/users=mandar?lights=OFF
and it works fine.
Now I want to do the same over the internet. So I got Computer's IP address from https://www.google.co.in/search?q=myip and tried to send a request to the following URL:
http://(IP_address):7000/users=mandar?lights=OFF
This time it keeps on loading and finally shows this site can't be loaded.
So what is the right way to connect to the server through the internet?
Thank you.
You have to do port forwarding.
The IP address you get from the google search is the out-facing IP address of your router. However, your router knows your computer by your local IP address (i.e. 192.168.x.y).
You have to configure your router to send packets coming from internet destined to port 7000(or any other port) to your computer's port 7000.
Check your router's documentation on port forwarding. Likely there is a settings page on the web interface of your router that you can do the desired port forwarding. After configuring the router, there are several tools online to test if the port forwarding is actually working. I suggest you use one of those tools to verify the configuration before testing with your project.
You also might want to check if your router has a firewall. You can add an exception to the firewall such that a specific port number is reachable from the internet.

NodeJS works only on my network

I have my nodejs server app running on my windows 10 machine which uses my home internet connection.
When I am connected with my phone to my home internet and write the IPv4 Address and port I get a response and my web page loads, but when I use a different internet connection it doesn't load.
I turned off the firewall, tried a lot of different ports but nothing worked.
I tried app.listen(8000) or app.listen(8000, "0.0.0.0") but both didnt fix the problem.
Any ideas what might be the problem?
OK I found out how to do this, my port forwarding was not configured correctly.
Here is how I solved it in case someone has the same problem:
Connected to my router (in cmd write ipconfig, copy the Default Gateway ip and paste in browser).
Clicked port forwarding (each router have it in different place), set external IP to 0.0.0.0 and my app port, and set internal ip to my computer ip (you can just write "what is my ip" in google) and same app port.
I hope it will help someone.

Node server fails to listen to public IP

I am trying to get my Node.js server to listen to a public IP so that I can access it on a different network than my home network.
I've purchased a domain and used a DNS host - right now I'm using No-IP and have downloaded their client to push my IP to their servers.
When I set the IP on No-IP configuration to my local IP I can use the domain name and hit my server on another computer on my network. But if I change this to my public IP and use the domain, the request hangs for about 10 seconds and then fails. I've set up port forwarding (I believe correctly) and opened inbound / outbound traffic on the port I'm listening to (not 80 right now). I even pulled my firewall completely.
I tried changing server.listen(4444) to server.listen(4444, '0.0.0.0') as I've seen all over the web. But this doesn't work.
Anyone have ideas out there? I feel like maybe my ISP is blocking it somehow? I'm fairly new to networking, so maybe I'm missing something critical?
Thanks!
server.listen(4444) should be fine. As long as you don't have multiple active network connections in your server, you don't need to specify an IP address. Port forwarding from your router (if configured correctly) will direct the request that came from to public IP address to the actual local IP address of your host.
Note that for port forwarding to work reliably, you will have to give your host a fixed private IP address (not a DHCP assigned address) so the IP address will not vary. Then, you configure port forwarding to that fixed IP address.
Then, you need to do some network debugging. From a computer outside your own network (e.g. something out on the internet), you should do a couple commands to your public DNS name:
ping yourserver.net
tracert yourserver.net
If your DNS entry is not working, ping should tell you immediately that it didn't find yourserver.net.
If the DNS entry is working, but the IP address can't be reached, then ping will tell you that the server is unreachable. At that point, you will know you have a networking issue with connecting to your public IP address from the internet.
If ping is initially finding your server, but packets aren't flowing properly, then either the ping results or the tracert results should give you an idea where to look next.
If ping and tracert are finding your public IP and packets are flowing to/from it, but you still can't connect to it with the browser, then you either don't have the IP address set correctly (so you're not connecting to the right server) or your node.js server isn't listening appropriately or you aren't using the right ip/port in the browser that represents the actual node.js process. If you suspect this to be the case, then back up and make sure you have everything working purely on your own private network where the browser tries to connect directly to the local IP address and port. When that is working, you will know the node.js server is working appropriately and you can move back to working on the public IP.
FYI, if you tell us what the public DNS name and public IP address is, we here can do a few steps of this debugging from our computers.
It may be that your router can only forward a port to a computer on your network, but not change the port when forwarding. If that's the case, then you have these options:
Put everything on port 4444. Have your server listen to 4444, specify 4444 in the port forwarding in the router and then put 4444 in the URL like http://thecastle.ninja:4444.
Set up the port forwarding for port 80, put your server on port 80. Change the port forwarding to port 80. Change your server to listen to port 80 (if your server is Unix, you will need elevated privileges to listen to port 80 directly). You should then be able to use a URL like http://thecastle.ninja.
Set up the port forwarding for port 80, put your server on port 4444 and use ip table settings to route 80 to 4444 on your server. This allows your server to run in the less privileged 4444 port, but lets the end-user use the default port 80. I have a node.js server on a Linux Raspberry Pi configured this way. You should then be able to use a URL like http://thecastle.ninja
Run a proxy on your server that will route port 80 to port 4444. This is probably more than you need, but nginx is a popular one and it can do port forwarding on the server.

Port forward not working to set a local web server

I have just created a simple web server using node server and it's running fine. I can access it from the same PC by going to address http://127.0.0.1:1337.
Now I want to access that web server from my WAN IP. I got my my using whatismyip and got something like 110.36.xxx.xxx.
When I tried http://110.36.xxx.xxx:1337, I got:
Firefox can't establish a connection to the server at 110.36.xxx.xxx:1337.
Here is the screenshot how I created the port forwarding in my router:
What's wrong here?
Localhost is only accessible from the same pc. You have to launch your webserver either on address 0.0.0.0 (it will be available on all network interfaces) or 192.186.0.5 so that it is accessible from your wan interface

How to login into beaglebone black remotely

I have my beaglebone black running stock Angstrom Linux and is connected to ethernet at my home. I can login from any PC connected to my home network using SSH. I would like to know how can I login from another network, say I am at my office and I am connected to internet. I want to login into my beaglebone black which is connected to internet at my Home. How can I do this?
Thanks in Advance
You have a public IP address, that is given to you by your Internet operator. This public IP however will be different than the IP of your Beagle in your local network.
To login to your Beagle from the Internet, you need to connect to your public IP address, and need to add port forwarding to your router, so that port 22, which is the socket port that is used by ssh, is forwarded from your public IP to your local IP.
So, you need to login to your router management console, and go to "port forwarding" options, and select to forward TCP/IP connections to port 22 be forwarded to your Beagle IP. For this to work longer term, you should set static IP address to your Beagle, otherwise if your board stays offline for long time, the DHCP server on your router will probably assign different IP at some point, and the forwarding would need to be setup again.
There is a good guide on the static IP address setting in Beagle/Angstrom here: http://derekmolloy.ie/set-ip-address-to-be-static-on-the-beaglebone-black/
One more thing: Since your operator will also assign different public IP for you from time to time, you might want to have some kind of Dynamic DNS service in use. With this kind of service, you can create your "custom" DNS address (for example user3180454.no-ip.com), that will always point to your Public IP address to which you can create ssh connection (the service will require some method to keep this IP address up to date, you will see instructions on how to do it from the service you use).
Couple services like this:
http://no-ip.com/
http://freedns.afraid.org/
You might also want to try out the Weaved connection service installer for BeagleBone Black. I'm using it to connect:
SSH on port 22
BBB web server on port 80
tightVNC server on port 5901
Shell in a Box on port 4200
Apache web server on port 8080
See:
https://developer.weaved.com/portal/members/betabeagle.php
If you are:
Connecting to from a BeagleBoard via USB Ethernet
from Mac Air running Mavericks & connected to web via Wifi
I found this very helpful:
http://makezine.com/2012/07/16/use-your-mac-laptop-as-a-wireless-proxy-for-raspberry-pi/
In short >> install/run a proxy server (with Squidman) & your life will be easier.
I know this is an old question. But I thought I'd suggest another option. I use TeamViewer (https://www.teamviewer.com) to connect to my work/home computers. You could use something like this to connect to your home computer from the office. Once connected to your home computer, you could then do whatever you need to do on your home network. No port forwarding required.

Resources