Accssing server having private IP with a URL

While I am new to OpenWrt, I managed to setup and run OpenWrt on NanoPi R5C for my home.

I have a home assistant server with IP of 192.168.1.254 connected to R5C via LAN.

I also setup no-ip.com DDNS (xxxyyy.ddns.net).

When I am outside (not on WIFI), I can access my home assistant server via android home assistant app using the URL xxxyyy.ddns.net

However, when I am home with my phone on WIFI (let say my phone has private IP of 192.168.0.100), I cannot access my home assistant server using the URL xxxyyy.ddns.net

I must to use 192.168.1.254 to access my home assistant server.

Before I started using OpenWrt, I used Asus router RT-AC68U (flashed with Merlin firmware).
With RT-AC68U, I could access my home assistant server using the URL xxxyyy.ddns.net even when I was on WIFI at home.

I'd like to know if I can setup OpenWrt in a way that I can access my home assistant server with a URL no matter where I am.

I tried searching the forum but I was not able to find any solution because I sadly do not know what this function is called.

Any help would be appreciated.

I have a similar setup using NGIX proxy manager but don't face this issue behind OpenWrt.

How is your Openwrt configured?

It seems your phone and HA are in a different subnet.

1 Like

The simplest solution is to add a static IP-hostname mapping on your local DNS server.
Make sure your DDNS client is configured to use the external DNS server.

1 Like

They are in the same subnet.

Example rule here:

1 Like

I tried below but it does not work.

config redirect
option target 'DNAT'
option src 'wan'
option proto 'tcp'
option src_dport '8123'
option dest_port '8123'
option src_ip '192.168.1.0/24'
option dest 'lan'
option dest_ip '192.168.1.254'
option name 'HA-local'

They need to be in different networks and subnets.

The traffic doesn't cross the routing plane/firewall.

You can use the DNS solution if you prefer to keep them in the same network.

1 Like