Nov272011

How can I access my Ubuntu Maverick server remotely?

Robert asks:

Running Ubuntu Maverick. Apache, MySQL, PHP work great. I can work locally on my webpage, view it, access database. All is cool.

But how do I access this stuff off-site, remotely?

My ISP provides a static public IP. I’m almost sure I should be able to use that address and log in remotely to my ‘localhost’ web pages. But just don’t know how to go about this. Something to do with port forwarding?



Comments for this Question are closed.

If you are looking for help, please ask a new question here.

We will be happy to help you!

9 Answers -

0 votes

Mike

November 27, 2011

Yes, you access your server via your public IP. For a simple webserver it would be http://your_public_ip/

Since you probably have a firewall or router you are right about setting up port forwarding. What ports to forward depends on the access you want to be available from the WAN (internet) side.

For a simple Apache webpage you will need port 80 (http) and maybe port 443 (https). If your webstuff is running on a special port e.g. 5000 you have to forward this one too.

For remote access to the console you will have to setup an sshd (SSH server daemon) within Ubuntu and forward the port specified in it’s configuration (default being port 22).

James Bruce

So basically, add a port forward setting for 80,443,and 22 (TCP) to your router config, pointing at the local IP address of your ubuntu server. 

November 27, 2011
0 votes

Amalafrida

November 27, 2011

Tried this in router configuration. No success. Set up 80,443,22 under port-forwarding menu of my Netgear router. Still, when I attempt to open the public IP, I am taken to the modem configuration page. On that page, among other items, is this menu choice:

A very limited number of applications require that the public IP address
assigned to the modem be used by the local LAN device.
Let LAN device share Internet address?    
No, use private IP address.
Yes, use public IP address
Is this part of the struggle? Should I select “Yes?”

0 votes

Anonymous

November 27, 2011

Connect to Ubuntu 10.04/10.10 Maverick Meerkat via Secure Shell (SSH)
http://www.liberiangeek.net/2010/09/connect-ubuntu-10-0410-10-maverick-meerkat-secure-shell-ssh/

Basic SSH Setup On Ubuntu 10.10 Maverick Meerkat Using OpenSSH Server
http://www.jonathanmoeller.com/screed/?p=2097

How Do I Enable Remote Access To MySQL Database Server?
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

0 votes

Amalafrida

November 27, 2011

Thanks, ha14. My LAN hosts all have working SSH connections. Not a problem. However, perhaps I should break this down to a more simple scenario. Apache, MySql are running fine on my server (10.0.0.2). If I navigate to http://localhost, I do indeed receive the proper web page (index.html). Data is successfully queried out of the database, etc.

But, for starters, how do I access that web page from one of my other LAN devices, e.g. 10.0.0.3?

What do I place in the address bar of my 10.0.0.3 machine? Not http://localhost, of course, because that simply takes me to 10.0.0.3′s localhost page.

I certainly appreciate all the responses.

A.

Anonymous

have you tried to add your pc name http://myPcsName? instead of localhost

try
http://10.0.0.2

if doesnt work, there is a chance that there is a firewall running on your computer, or the httpd.conf is only listening on 127.0.0.1

if you are using python
sudo python2.5 dev_appserver.py -a 192.168.1.103 -p 8080 myapp/
http://stackoverflow.com/questions/3496165/how-to-access-http-localhost8080-from-another-computer-in-the-network
modify to match your configuration

November 27, 2011
0 votes

Amalafrida

November 27, 2011

Thanks, ha14, for staying with me on this.

10.0.0.3 will not connect to server using http://hostname_of_10.0.0.2

However, 10.0.0.3 DOES connect to 10.0.0.2 server web page via http://10.0.0.2.

This works with firewall enabled/disabled.

Great, thanks for that. I can access the server pages from any machine on the LAN.

But now, how about access from a remote machine? As I say, accessing my public IP 74.181.252.241 takes me to my modem config/info page. An effort to connect to this same address from a remote machine, receives a ‘connection time-out’ response.

A.

0 votes

Anonymous

November 27, 2011

your router supports NAT reflection?

can you hack your hosts file (before make a safe copy of hosts file)
Add this to your hosts file.
74.181.252.241 http://www.yourwebsite.com
or
74.181.252.241 servername.yoursite.com

0 votes

Mike

November 28, 2011

1. the hosts file only applies to the computer you set it up on.
2. the hosts file is used to resolve host names which means if add “74.181.252.241 working.server.com” you can enter “http://working.server.com” in your browser and the request will be routed to “74.181.252.241″ nothing more or less

All in all it has nothing to do with you being forwarded to your routers interface. 

From within the LAN it doesn’t matter whether you enter “http://your_routers_ip” or “http://your_public_ip” because both will end up at the router. And like most home routers do your internal http request is not processed by port forwarding which is why you see the routers configuration page instead of your local server.

As for the “canyouseeme.org” result I can only assume that you either didn’t save the port forwarding of “port 80 to 10.0.0.2″ or your router doesn’t allow forwarding of http (e.g. some Thomson models with a certain firmware restrict that).

0 votes

Amalafrida

November 28, 2011

In order to keep this as simple as possible, I’ve pulled the router out of the loop.

Numbers look like this:
HOST: 192.168.1.64 –>
browser serves web page;
google translate: fails, of course (invalid url)

MODEM: 192.168.1.254 –>
browser serves modem config/info page;
google translate: ditto

INTERNET IP ADDRESS: 74.181.252.241 –>
browser serves modem config/info page;
google translate: fail

INTERNET GATEWAY ADDRESS: 72.157.8.14 –>
browser yields ‘time out’;
google translate: fail

all four addresses ping out nicely

Anonymous

go to this link and to Configuring Static ip address in Ubuntu server
it might give you some ideas
http://www.ubuntugeek.com/ubuntu-804-hardy-heron-lamp-server-setup.html

try
 http://74.181.252.241:80/
 move it to another port such as 8080 if you have trouble
After port forwarding has been setup, you can direct someone to your site at your external/WAN IP on port 8080. Ex: http://74.181.252.241:8080/

November 28, 2011