Configure clients on laptop/mobile using private/public ip

Hi all,

I have been wondering on how to solve an issue that i have.
I want to use nextcloud on my office laptop. Due to corona, the laptop now travels home with me.
While at home, obviously my laptop can’t connect to my public ip address.
How do you solve this issue of clients that travel between my private and public ip address.
The same for mobile phone.

Br,

It seems easy to solve:

  1. Register public domain, e.g. via noip.com or http://dot.tk
  2. Open needed ports and setup port forwarding on your router, e.g. 80 and 443 routes to your Nextcloud instance.
  3. Set Dynamic DNS IP update for a selected provider.
  4. Setup in clients connection not via IP, but via public domain name.
  5. Profit.

Hi, i didn’t make myself very clear i believe.
I have already done all the above you mentioned.
And yesterday, when i was at work, it worked great.
However, today i am working from home. And when i am at home i can’t connect to my own FQDN, which resolves to my own public ip, from within my own network. so i get a connection error. Unless there is some option i can enable on my router? I have a ubiquiti edegrouter

In the past I ran my own DNS server. but it is a pain to maintain in my opinion, certainly to just intervene for 1 FQDN. Was hoping that there would be some configuration options in the nextcloud clients to link 2 connections to 1 sync or something like that.

Basically, i want to know how other people circumvent this issue. Surely i can’t be the only one that runs into this issue? The same for mobile phones. they are super “fluid” on which networks they connect…

It suddenly came to me.
I have a pihole running in my network, apparently that has some functionality to manually specify a DNSrecord. So i did that.
For the office router that i have, i added a manual DNS forward for my domain since i can’t link that router to my pihole.
Ex: set service dns forwarding options address=/domain.com/192.168.1.10

Although, if there are other options on how to accomplish this, i would still like to know :slight_smile:

1 Like

Did you checked if Port Forwarding is still enabled?

Did you checked that FQDN is still bounded to your IP? Check if it returns your external IP address, it could be changed with time

dig yourFQDN

Sorry, not familiar with your Router.

Could you please trace it?

  1. Try to connect to the FQDN with curl
    curl -v -k https://FQDN
    Check in output of it, is it able to connect? What IP Address is there?
  2. Try to connect directly to your Internal IP to the NC and check if it works:
    curl -v -k https://IP
  3. Try to connect directly to your External IP (that you see in a dig command) to the NC and check if it works:
    curl -v -k https://externalIP
  4. Check in WebServer Logs. Are you hitting WebServer at all and if an error comes.

Search

hairpinning
Hairpin-NAT
NAT loopback

with your router name and/or with nextcloud

2 Likes

Oh, so that is what hairpin nat does. It was already enabled on my router. however. i am doing double NAT. since i have my network provider’s router and behind that i have my own router doing all my static dhcp stuff and firewall rules…
I can’t disable the routing functionality of the provider router. however, i did set up the DMZ to my own router.
But reading this: https://help.ui.com/hc/en-us/articles/204952134-EdgeRouter-Hairpin-NAT
it would seem that it would probably work if i didn’t do double NAT. But since my router’s “public” address is in fact a private address of the provider router, it most likely doens’t work because i want to connect to my actual PUBLIC ip address, not the private address that my router thinks is his public address. If that makes sense…