Networking – Configure Laptop to Serve Website Through OpenSSH

networkingopensshroutersshwireless-networking

I am trying to give a friend of mine access to a website I am developing for him. I am on a Ubuntu 16.04 Desktop machine, running a Flask (python) webserver on it, and I am using a Vodafone R216-Z 4G WiFi router. He (my friend) is using an Adroid smartphone.

From this answer, I understood that I could be able to serve the website through ssh, so I installed openssh. Moreover, in the same answer I was told to forward port 22 from my router. I am not sure how to do it and the steps afterwards.

I came across the router's session called "NAT settings", which (according to this discussion) would allow me to forward port 22. But I don't know what to input as "destination IP". I tried with the ip found launching the ifconfig command from terminal (as far as I know it is my private IP), and port 22 as both the source and destination port.

Then I downloaded an ssh client on the phone and I tried to configure it giving the same IP address as "server IP", the username found in the terminal session (after the @ sign), and port 22. Nothing happened.

I am unsure on what to do now:

  1. What am I supposed to enter from terminal (server side) as ssh command to "start" the service (if it's not already started)?
  2. Do I need to use my private IP or the public IP (which I found googling, but it also reads "it can be hidden by a proxy or can be the router's IP")?

EDIT1

So here is the situation after following TomEus suggestion.

I set up a static IP in my Ubuntu Desktop so that it is now 192.168.0.100.

Then, I set up the router's NAT settings as in the image below as suggested.

NAT configuration

Now, when I start the Flask webserver, I can see the page from my own laptop as expected by doing localhost:5000, but I cannot see it from another device connected to the same network doing 192.168.0.100:5000 (before setting the static IP it was working, the IP was obviously different). Strangely, I can see from the webserver debugger that the device is trying to connect but it receives a 404 status.

Also, when trying to access the same page from a device which is not in my local network (my final aim), I insert the IP found at www.whatismyip.com like as URL (without port), but the browser says it cannot visualize the page.

Just to give one more info, if it makes some sense: my router is setup with DHCP activated, do I need to deactivate it? thanks again in advance for any help!

Best Answer

I am not sure why the SSH answer but I think this can be done in a much more simple way:

In you router find the NAT settings (not NAS!), sometimes also called port forwarding. Set it up as following:

IP of your desktop (destination) with port 80

Source port 80

enter image description here

Next find the public IP of your router by going to www.whatismyip.com and give it to your friend.

You can test that it all works by first entering IP of your desktop to your own browser - you should get the website, next enter the IP of your router found in the previous step, you should again get the website.

Complete guide for your specific router is here

Related Question