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")?


So here is the situation after following TomEus suggestion.

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

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 (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!

  • 1
    "But I don't know what to input as destination IP" - You have to use the ip address, of the device, you want to forward all traffic that exists on port 22 to. Most internal networks, are not configured, to support naviating to a website with the public ip address of the router/modem.
    – Ramhound
    Dec 8, 2016 at 21:56
  • 1
    It appears that you are using a mobile broadband connection. This may prevent you from doing port forwarding as most mobile carriers do not allow (or do not support) services to be hosted through their IPs.
    – Ryan Tse
    Dec 9, 2016 at 10:45
  • According to the guide TomEus provided, this seems feasible, isn't it? I hope it is.... otherwise I am learning something new I guess.
    – umbe1987
    Dec 9, 2016 at 10:57
  • Seems like I need to purchase a static public IP from my ISP before doing port forwarding.
    – umbe1987
    Dec 9, 2016 at 17:17
  • @Ryan Tse Quoting Vodafone's customer center (just called) :"It can't be done because it does not work with mobile networks.".... You were right, thanks.
    – umbe1987
    Dec 9, 2016 at 17:44

1 Answer 1


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

  • Thanks, corrected the NAS to NAT typo. Anyway, seems I need static IP address, and I dont' really know how to do it... Because, entering the desktop IP does not seem to work unfortunately. After inserting it in the NAT page along with port 80, I tried to insert the IP found at whatsmyip from the smartphone but nothing shows up. maybe the IP I am entering is the wrong one? I found it with the ifconfig command.
    – umbe1987
    Dec 8, 2016 at 23:04
  • if you enter the desktop IP(internal) (the one you get from ifconfig) it means your webserver is not running. Fix that first.
    – TomEus
    Dec 8, 2016 at 23:50
  • Only after that you should move onto the port forwarding setup
    – TomEus
    Dec 8, 2016 at 23:51
  • but it is running. Indeed, I can see the webpage doing localhost:5000 from the browser. I edited my question with some updates.
    – umbe1987
    Dec 9, 2016 at 16:15
  • 1
    See, that is the problem - you use localhost:5000 - so you are NOT running the webserver on the default port 80! In this case your destination port must be 5000 instead of 80.
    – TomEus
    Dec 9, 2016 at 21:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .