PuppyIP Resource Center
Network & Connection Troubleshooting 9 min Published 2026-11-17

OpenWrt 24.10.3 OpenClash Inactive with dnsmasq Forwarding to 7874: DNS and Startup Log Troubleshooting

When OpenClash is inactive, dnsmasq still targets an unbound 7874 port and logs show sh: out of range, separate a temporary DNS bypass from the plug-in root cause.

OpenWrt 24.10.3 OpenClash inactive dnsmasq sh: out of range DNS port 7874 Startup logs

Service eligibility and regional restrictions

PuppyIP serves only compliant overseas businesses and their authorized personnel. Proxy services are not available in mainland China. The service may only be used for lawful business activities outside mainland China. Use of this service within mainland China is prohibited.

Hosting a proxy IP or server overseas does not change these restrictions. The service must not be provided to end users in mainland China through relaying, forwarding, sharing or resale. Before use, read the Terms of Service.

Key Takeaways

  • One diagnostic state on OpenWrt 24.10.3 is an inactive OpenClash service, no core listener and dnsmasq still forwarding to port 7874.
  • The message sh: out of range is a startup clue; by itself it does not identify which setting or code path caused startup to fail.
  • If direct system DNS is acceptable, remove only the confirmed broken 7874 value with a backup. This does not repair OpenClash startup.
  • Router-side name resolution does not prove LAN clients or web access are restored. Do not claim full recovery before client verification.

Separate two problems: a broken DNS forward and a failed OpenClash startup

On an OpenWrt 24.10.3 device, OpenClash can report inactive while the expected core is absent and dnsmasq remains configured to forward queries to port 7874. That leaves at least two issues: the proxy-DNS service is not ready, and the local resolver still points to it. dnsmasq continuing to listen on port 53 cannot replace the missing downstream listener, so clients may see DNS timeouts.

Treat sh: out of range in the startup log as a clue to preserve, not a complete root cause. It does not identify whether an input range, configuration, script branch, plug-in package or runtime environment caused the failure. First give the router a usable DNS path, then investigate startup output separately. Bypassing the DNS port is not proof that OpenClash is fixed.

Read-only checks: confirm inactive status, no 7874 listener and the forward

Check OpenClash status, core processes, ports and saved dnsmasq UCI first. Then use the PID listening on 53 to identify its active generated config and inspect the actual server=forward. UCI shows saved values; netstat/ps show current listeners and processes. Correlate all three with the target dnsmasq instance's active config. Do not make the direct-DNS change if the expected core owns 7874 or runtime config differs from UCI.

This procedure is scoped to OpenWrt 24.10.3. On other OpenWrt or OpenClash versions, check the active dnsmasq instance, generated configuration, service state, and version-specific documentation; do not infer compatibility from this branch. Full logs can contain device names, subscription paths, hostnames or other sensitive fields. Before sharing anything, keep only software versions, times, a redacted error and status instead of uploading the whole log.

Inspect service, processes, ports and startup log

sh
/etc/init.d/openclash status
ps w | grep -E '[c]lash|[o]penclash_watch|[m]ihomo'
netstat -lnp 2>/dev/null | grep -E ':(53|7874|7890|7891|7892|7893|9090)([[:space:]]|$)'
uci -q show dhcp.@dnsmasq[0]
logread | grep -iE 'openclash|clash|mihomo|out of range' | tail -n 80
DNSMASQ_PID='REPLACE_WITH_PID_LISTENING_ON_53'
ps w | awk -v p="$DNSMASQ_PID" '$1 == p { print; found=1 } END { if (!found) exit 1 }'
RUNTIME_CONFIG='REPLACE_WITH_ACTIVE_CONFIG_PATH_FROM_THIS_DNSMASQ_PROCESS'
EXPECTED_FORWARD='REPLACE_WITH_EXACT_SERVER_TARGET#7874'
grep -nF "$EXPECTED_FORWARD" "$RUNTIME_CONFIG"
Read-only checks in an OpenWrt router shell. Set the PID to the listener on port 53 and confirm the active generated config path from that process's command line; enter the exact server target shown there. Do not publish full startup logs or config output.

Temporarily restore resolution by removing only a confirmed 7874 entry

Consider temporarily using system upstream DNS only after confirming that saved dnsmasq UCI contains the exact local forward to 7874, no expected listener owns that port and the active generated config contains the same entry. Verify the upstream and back up /etc/config/dhcp first. If runtime config differs from UCI or the active file is unknown, determine the service's load path instead of guessing runtime behavior from the saved value.

Committing the change and restarting dnsmasq alters router DNS behavior and may briefly interrupt resolution. The command prints the backup name before restarting; if restart returns nonzero, it reports and exits with that status. A successful restart command still does not prove that the runtime config loaded. Check the active generated config and verify DNS and HTTPS from a LAN client.

Back up and selectively remove the forward

sh
BROKEN='<BROKEN_DNS_TARGET>#7874'
BACKUP="/root/dhcp.before-openclash-dns-$(date +%Y%m%d-%H%M%S)"
test ! -e "$BACKUP" || exit 1
cp -p /etc/config/dhcp "$BACKUP" || exit 1
printf 'Backup: %s\n' "$BACKUP"
uci set dhcp.@dnsmasq[0].noresolv='0' || exit 1
uci -q del_list dhcp.@dnsmasq[0].server="$BROKEN" || exit 1
uci commit dhcp || exit 1
if /etc/init.d/dnsmasq restart; then
  printf 'dnsmasq restart command returned success; verify the active config and LAN DNS separately\n'
else
  RESTART_STATUS=$?
  printf 'dnsmasq restart failed (exit %s); do not assume the new config is active\n' "$RESTART_STATUS" >&2
  exit "$RESTART_STATUS"
fi
Run only when saved UCI and the active generated config contain the same broken forward and no expected listener is on 7874. Replace the target address first. The command prints the backup name, commits the single-entry change and preserves a nonzero dnsmasq restart status. Verify runtime config and LAN DNS separately afterward.

Restore the original DHCP/DNS file

sh
BACKUP='/root/dhcp.before-openclash-dns-REPLACE_WITH_PRINTED_TIMESTAMP'
test -f "$BACKUP" || exit 1
cp -p "$BACKUP" /etc/config/dhcp && /etc/init.d/dnsmasq restart
To roll back, replace the timestamp with the exact backup name printed during the change, then restore the file and restart dnsmasq.

Investigate startup separately; do not turn an unknown cause into a fix

To restore OpenClash DNS handling, first resolve the plug-in startup problem. Preserve the actual versions of OpenWrt, OpenClash, core files and configuration. Check whether the selected YAML/config can be read, then review startup messages in time order. Check whether another instance owns the target port, whether the required core exists and whether the UI selection matches the actual startup path. These are diagnostic branches, not confirmed causes.

Unless the startup script and surrounding logs identify the exact file and line, do not infer a plug-in root cause. If the startup branch remains unexplained, stop other changes and keep the relevant logs redacted.

Verify router DNS and the LAN client path separately

After a temporary DNS change, first check whether the router can resolve an ordinary name through its system upstream. Then use a LAN client to check DHCP-provided DNS, client resolution and web access. A successful lookup proves only that query path works. If a web page still fails, distinguish the default route, proxy rules, WAN reachability and destination response.

If OpenClash is meant to handle DNS, acceptance also requires the plug-in to be in its intended running state, the correct core to own the target port, dnsmasq forwarding to match that port and a real client request to succeed. Router-side lookup alone, or a changed UI status, is not enough to prove LAN service is back.

Limits, stop conditions and rollback

If the upstream resolver is unclear, management access is unstable, the server list contains values for different purposes or port ownership cannot be established, remain in read-only mode. OpenWrt branches, dnsmasq instances and OpenClash settings differ; use the device's current output for the address and port instead of copying another router's full configuration.

If resolution gets worse or policy behavior is wrong, restore the DHCP/DNS file from the saved backup and restart dnsmasq. Keep a local access method in case remote management is interrupted. Mark OpenClash as recovered only after separately resolving the startup failure and verifying a LAN client. Until those checks finish, the startup cause and final LAN result remain unknown.

Sources

Frequently Asked Questions

Does sh: out of range prove an OpenClash defect on OpenWrt?

No. It is a startup clue but does not identify the specific script, input or configuration cause. Preserve the version and surrounding context, then inspect startup messages in order.

Will removing the 7874 forward automatically fix OpenClash?

No. Selective removal changes the dnsmasq resolution path and may make system upstream DNS available temporarily. It does not repair OpenClash startup or core state.

How do I roll back the selective DNS change?

Restore the pre-change /etc/config/dhcp backup and restart dnsmasq. Check the exact backup path first; if other changes were made, decide separately whether they also need to be reverted.

If the router resolves names, can I say the LAN is restored?

No. Check DNS settings and resolution on a LAN client, then verify required web access. Plug-in startup, router resolution and client connectivity are separate checks.