Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an Ubuntu box running Ubuntu 12.04 LTS server edition, which acts as a DHCP server and is also the gateway for my network. IP forwarding is turned on. Additionally, the server acts as a secondary DNS for websites I host. I am looking to install ownCloud on the server, and that's where my question arises.

When I attempt an SSH connection to the server from behind the server, using its public IP address, the connection times out. I assume this is because it appears that my computer is using the same IP address, and that creates an issue at some point along the way.

I'm worried that installing ownCloud on the server will produce the same issue. In other words, if I create a DNS record for, that points to the server's public IP address, then I worry that if I try and access from behind the server (and thus, because of IP forwarding, appear to have the same IP address as the server), I simply won't get a proper response.

If this is the case, how do I fix this?

Thank you so much!



UPDATE: Let me provide more information about the setup, as it may be relevant. The server has Shorewall installed. All necessary ports are open. IP_FORWARDING in shorewall.conf is set to On. The server itself sits behind a NAT. So it amounts to a NAT within a NAT. I know this isn't the best setup, but it's what I'm stuck working with. The DSL modem that generates the first NAT is configured to forward all open ports (in this case, 22, 53, and 80) to the server. The server provides DNS for the outside world, and for my local network. Today (12/5) I set up Apache on the server, opened port 80 on both the server and the modem, and the problem persisted: I can access the default Apache page from outside my network, but not from behind the server. Any help you can provide would be much appreciated!

share|improve this question
Unless you've opened the ssh port (which I would strongly recommend NOT doing) on you public IP, it's no wonder the connection times out. And I don't think that you will get the same problem with your domains; NAT should handle the routing just fine even if you are creating a loop through external DNS back to your own server. – douggro Dec 4 '13 at 8:36
SSH is open on the public IP. (Fail2ban is installed to help deter brute force attacks.) Just installed Apache and opened up port 80. I can load the default Apache page from outside my network, but not from the inside. Inside it times out. Also worth noting that by default, DNS is provided by the server. However, to ensure that it wasn't the issue, I told my computer to use an external DNS server instead. Problem persisted. Thoughts? (Thanks again for the help!) – Spencer Young Dec 5 '13 at 22:12
Have you tried ssh your_admin_account@your_server_hostname.local rather than through an IP? – douggro Dec 6 '13 at 8:08
@douggro, that will of course work. But that wasn't what I was trying to accomplish. – Spencer Young Jan 29 '14 at 21:16
Is the modem also providing DHCP service? The server has dual-NICs? I'm trying to get an idea of your routing. I also don't see why you need to run internal DNS if you effectively have only one web server - nothing needs to be routed to secondary servers inside your network, and virtual hosts on the same server can accomplish that. – douggro Jan 30 '14 at 8:05
up vote 0 down vote accepted

So, I ended up abandoning this setup, but as I've learned more about the interplay between routers, DNS, etc., I believe the issue I was experiencing was a NAT/IP forwarding issue. When, from behind the double NAT, I typed in the domain I would have liked to use (e.g.,, the query would return the public IP of the network (e.g.,, at the top of the double NAT), which because of IP forwarding would cause issues.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.