Problem with DuckDNS and (Double Router) PortForwarding

Hey guys. I am a new in HA and I am trying to configure DuckDNS on mi HA with no luck.

I have 2 routers. The first, a ZTE F680, and a second, wired to the first one, a Xiaomi Mi Router 4A, with fixed IP 192.168.1.128. All my devices are connected to the Xiaomi Router, including the raspberry with a fixed IP 192.168.2.2.

I followed the step by step guide from “DuckDNS - It’s not just me, It’s you” (https://community.home-assistant.io/t/duckdns-its-not-just-me-its-you) as I thought I would fix my problem, but It didn’t.

Following the steps in the post above:

  1. DuckDNS correctly installed
  2. NGINX correctly installed
  3. Port Forward 443

Here I forwarded external port 443 to 192.168.1.128:443 (Xiaomi Router), and from there, to 192.168.2.2:443 (Raspberry). I am not sure if this is correct or there is a better way to do this (like DMZ?)

F680 Router:
portforwardingf360

Xiaomi Router:

  1. Port Forward 80: I am able to forward this port on F630 router, but I can’t in Xiaomi.
  2. Take note of my external IP: OK
  3. Go to DuckDNS, create a domain, take note of the token, etc… : OK
  4. Change DuckDNS Add-on config and replace “mydomain.duckdns.org” and “token”: OK
  5. Save and start DuckDNS. OK

Log:

  • INFO: Using main config file /data/workdir/config
  • Account already registered!
    [12:03:51] INFO: OK
    MY EXTERNAL IP
    NOCHANGE
  • INFO: Using main config file /data/workdir/config
    Processing MYDOMAIN.duckdns.org
  • Creating new directory /data/letsencrypt/MYDOMAIN.duckdns.org …
  • Signing domains…
  • Generating private key…
  • Generating signing request…
  • Requesting new certificate order from CA…
  • Received 1 authorizations URLs from the CA
  • Handling authorization for MYDOMAIN.duckdns.org
  • 1 pending challenge(s)
  • Deploying challenge tokens…
    OK + Responding to challenge for MYDOMAIN.duckdns.org authorization…
  • Challenge is valid!
  • Cleaning challenge tokens…
    OK + Requesting certificate…
  • Checking certificate…
  • Done!
  • Creating fullchain.pem…
  • Done!
  1. Change confing in NGINX addon, replace the domain
  2. Start NGINX: OK. No errors in the log, at the bottom shows “INFO: Running nginx…”
  3. Goto your configuration.yaml and comment out ANYTHING under http: including the “http:” itself. OK
  4. Reboot routers. OK
  5. Reboot Hass. OK
  6. Goto [https://mydomain.duckdns.org] and login to your HA instance.

Of course step 14 does not work at all.
Also:

  • I checked my ports in www.yougetsignal.com/ and they appear to be closed (or the device not answering. It just time out)
  • I cannot get samba to work either. Maybe this is all related to the same router configuration

This is all driving me crazy…
What am I missing? What am I doing wrong?

Thanks!!

is nginx setup properly? I.e domain set to your domian and you filled in 80/tcp to 80 and 443/tcp to 443?

I used to run with two routers as well and this is pretty much what I did, and mine worked, though my second router did allow me to forward port 80 also (though as I suspected and have since proven, you don’t need 80 after set up (had certs renewed 3 times since without intervention and without port 80) Still not sure about initial set up though (next time I rebuild I’ll skip that step to check).

So can you connect locally to your HA instance on 192.168.2.2:8123 ??? (this will show nginx is running ok)
Did you reboot BOTH routers ??? (AND then check status to see if they are still showing 443 as forwarded ?)
I suspect that your problem lies with your routers (or at least the port forwarding through them) as my tests using your yougetsignal shows ALL commonly used ports closed but my 443 is open.
Don’t tell me, but have you checked what your first router (ZTE F680) WAN address is ? AND is this what DuckDNS is aimed at ?
Can you ping this WAN address from your terminal ? (just pinged mine with < 1ms response which shows it supports hairpin).
Have you checked with your ISP whether they implement CGNAT ? (NAT layering within their systems)

One of my issues with my old routers was that none of them supported enough fixed IP addresses. So I bought a Draytek Vigor (never looked back) Not suggesting that this is your issue but can you move your pi to have just 1 router (between your LAN and the outside world (just to test)) then swap to the other and see if it is one of them (or both) ???

I think it is. Domain is set to “mydomain.duckdns.org” and the ports 80 and 443 set in NGINX config

if the fields aren’t empty, then yes they are set. If the fields are empty, they are disabled.

I have tried everything you said:

  • I can connect HA through 192.168.2.2:8123, so I guess NGINX is running properly
  • I did reboot both routers and all configuration was OK. Ports were still forwarded and static IPs were saved and assigned to each device
  • The WAN address is the same in DuckDNS than in whatismyip.com, but I cant find it in the F680 settings
  • I pinged that WAN and got an average of 20ms (a bit high, isnt it?)
  • And finally, I have just googled my ISP and yes, it does implements CGNAT… (Which now makes sense considering the response time for the ping). I have just contacted them to fix this.

It seems all my headaches and frustration were because of CGNAT. So… I’ll try all again when I have a public IP. Sorry if this was too obvious, I am learning from zero as I go.

I’ll let you guys know if this was the only problem and if I can make it work.

Thank you for the quick responses!

Eh ? That’s where we all start :wink:

You know a LOT more now than you did. given what you found out you at least know YOU didn’t make any stupid mistakes :rofl: (I’ve made loads ! )

And the CGNAT thing :face_vomiting: , well if they “solve it” you should be good, if not … when is your contract up ? can you switch providers ? failing ALL that you may just have to go nabu casa (which has a LOT to recomend it)

Hello @Alvizq, I have the exact same issue, with a double router setup. My ports wont open either. Have you already found a solution to the problem?

Thanks!

Hey @MerijnKo, my setup was OK. The only error was that I was under CGNAT.

Try figurig out if you are also under CGNAT and contact your ISP to check if they cant get you out.

Good luck!