What's new

miniupnpd outdated, doesn't work when WAN is a private address.

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

iMoc

Occasional Visitor
My WAN is behind the modem which set this router as a DMZ.
A new upstream patch is available.
Source:

Not compiled with IPv6 support too. Well, I guess it's not that needed, entware version can do it.


PS. It work yesterday for whatever reason.
 
RMerlin was aware of this issue back in 2020 and patched his version of miniupnpd. Are you saying you still have this problem?
 
Yes, 386.7_2 latest.
It works yesterday for whatever reason, today 501 fail.
What works? What fails?

I've been running my router behind another router using DMZ and UPnP for the past couple of months and everything works fine.

Show us exactly what you are doing and where you're seeing this error.
 
Last edited:
eth0 IP 192.168.1.100

Config:
ext_ifname=eth0 listening_ip=br0 port=0 enable_upnp=yes enable_natpmp=yes secure_mode=yes upnp_nat_postrouting_chain=PUPNP upnp_forward_chain=FUPNP upnp_nat_chain=VUPNP notify_interval=60 system_uptime=yes friendly_name=RT-AC86U-9308 model_name=RT-AC86U model_description=ASUS Wireless Router model_number=386.7 serial=a8:5e:43:67:93:08 uuid=3dddc1d3-2380-45f5-b069-a85e66666668 lease_file=/tmp/upnp.leases clean_ruleset_interval=600 clean_ruleset_threshold=20 presentation_url=https://172.16.1.1/ allow 1-65535 172.16.1.1/255.255.255.0 1024-65535 min_lifetime=120 max_lifetime=86400 deny 0-65535 0.0.0.0/0 0-65535

Xbox UPnP failed.
Only after adding ext_ip="a random public IP"
Then It works.
 
version: miniupnpd 2.3.0 master-021766bdf9 Jul 24 2022

miniupnpd shows 501 error. Pretty common.
 
Only after adding ext_ip="a random public IP"
Then It works.
I don't know why you're missing that line. On my router (running 386.5_2) it's already there. So miniupnpd works fine if the config file is correct.

I think this problem is probably part of the dual-WAN problem that you were having. I'm guessing the config file was never fully created.


Code:
nvram show | grep ^wan.*_realip | sort
 
Last edited:
wan0_realip_ip=
wan0_realip_state=1
wan1_realip_ip=
wan1_realip_state=0

How is this done, what domain I might blocked?
 
No, different place, different router, this is a single WAN setup.
Then I don't know why you're missing that line in your config file. Maybe it's a bug in 386.7_2 because it works fine on my router.

wan0_realip_ip=
wan0_realip_state=1
wan1_realip_ip=
wan1_realip_state=0

How is this done, what domain I might blocked?
Try running this:
Code:
/usr/sbin/getrealip.sh
It uses stun.l.google.com and stun.stunprotocol.org
Code:
ministun -t 1000 -c 1 -i eth0 stun.l.google.com:19302
ministun -t 1000 -c 1 -i eth0 stun.stunprotocol.org
 
It can get and set ip in nvram. But only reliability so after all services especially VPN client is fully up. So maybe auto run this getrealip.sh in custom config and restart miniupnpd. Or idk feels buggy to me. This config doesn't do anything except lift the restriction, why is there in the first place.
 
Are you talking about this thing?


I never tested it again in 386.7_2 because of other issues encountered. 386.5_2 is the better firmware from what I can tell.
 
If that answer means yes, I never asked again because I don't really use my Asus routers. I was just reporting what I see abnormal.
 
 
A new upstream patch is available.
That patch is from 2020. Asuswrt-Merlin's miniupnpd isn't outdated, it was updated to 2.3.0 back this spring.

It's a complicated story. When the miniupnpd author decided a few years ago to disable miniupnpd whenever using a private WAN IP and adding a stun client inside miniupnpd to retrieve the public IP instead, I disagreed with the whole idea (we had a discussion about it on the miniupnpd github repo). Adding a stun client only for that specific purpose was feature bloat IMHO, and adding another moving part that could break at any time if any built-in stun server went offline, or an ISP decided to block access to that particular server. So at the time, my solution was to revert the whole change, and fully allow private WAN IPs once again.

A few years later, these patches became a major PITA for me to maintain, because every time I needed to upgrade to a new miniupnd version, I had to manually reapply these patches. So I eventually gave up, reverted them, and went with the next best thing: rely on Asuswrt's own built in stun lookup that it had then. This is what's normally stored in the wan0_realip nvram.

The actual problem in your case doesn't seem to be miniupnpd, but your router not properly setting that nvram. Switching to miniupnpd's built in stun client won't help you if your router is failing to do the same stun lookup.

Not compiled with IPv6 support too.
I spent a lot of time back in the day working on miniupnpd. IPv6 ended up being left disabled because enabling it required upgrading miniupnpd to a newer IGD protocol version, and that version flooded Windows's event log with tons of error messages due to a bug in Microsoft's implementation. Again, it was discussed on the miniupnpd GIthub back then, and ultimately the problem was deemed to be within Windows, not miniupnpd, so nobody could do anything about it.
 
Ah sounds unnecessarily added complexity, what is this author thinking[Face Holding Back Tears emoji]
I'll just add ext_ip="a random public IP" to postconf, doesn't seem to break anything, iptables rules don't contain this IP anyway.
 

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top