Skip to content

Add DNSMasq integration rule for NextDNS coexistence - #14

Merged
tuanductran merged 2 commits into
mainfrom
copilot/add-dnsmasq-integration-rule
Jan 29, 2026
Merged

Add DNSMasq integration rule for NextDNS coexistence#14
tuanductran merged 2 commits into
mainfrom
copilot/add-dnsmasq-integration-rule

Conversation

Copilot AI commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

Adds integration guidance for running DNSMasq alongside NextDNS while preserving client reporting and conditional configuration capabilities.

Changes

  • New rule: skills/integrations/rules/dnsmasq-integration.md

    • Port configuration to avoid conflicts (NextDNS on 127.0.0.1:5555)
    • DNSMasq parameters for client identification (--add-mac, --add-subnet=32,128)
    • Automatic setup via -setup-router flag for router firmwares
    • Troubleshooting for port conflicts and client reporting issues
  • Skill manifest: Updated skills/integrations/SKILL.md

    • Registered rule in Capability Rules table with triggers: dnsmasq, dns, router, client reporting, conditional configuration, port configuration, setup-router

Configuration Pattern

# NextDNS on alternative port
nextdns install -listen 127.0.0.1:5555

# DNSMasq forwarding with client context
--server=127.0.0.1#5555
--add-mac
--add-subnet=32,128

Router firmwares with pre-installed DNSMasq can use nextdns install -setup-router for automatic configuration.

Original prompt

Act as a software engineer contributing to the nextdns-skills repository. I will provide you with technical details for a new integration rule involving DNSMasq. Your task is to:

Create a new rule file named dnsmasq-integration.md located in skills/integrations/rules/.

Strictly adhere to the project standards in CLAUDE.md and templates/rule-template.md:

The content must be in English.

Include a YAML Frontmatter at the top with fields: title, impact, impactDescription, type, and tags.

Immediately after the H1 title, include an Impact Line in bold: Impact: [LEVEL] - [Brief description].

Use 4-space indentation for all lists.

Follow case-police rules (e.g., use NextDNS, DNSMasq, IP, LAN).

Technical content to include in the rule:

Objective: Explain that it is possible to run DNSMasq and NextDNS together while maintaining client reporting and conditional configuration.

Configuration Step 1: Ensure NextDNS is installed to listen on a different port (e.g., -listen 127.0.0.1:5555).

Configuration Step 2: Add the following parameters to DNSMasq: --server '127.0.0.1#5555' --add-mac --add-subnet=32,128.

Important Note: Mention that on some router firmwares shipped with DNSMasq, this configuration is automatically handled by using the -setup-router parameter in NextDNS.

Update the Skill Manifest: Provide the exact line that needs to be added to the 'Capability Rules' table in skills/integrations/SKILL.md to register this new rule, including appropriate keywords and a concise description."


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: tuanductran <69758022+tuanductran@users.noreply.github.com>
Copilot AI changed the title [WIP] Add DNSMasq integration rule for NextDNS Add DNSMasq integration rule for NextDNS coexistence Jan 29, 2026
Copilot AI requested a review from tuanductran January 29, 2026 05:45
@tuanductran
tuanductran marked this pull request as ready for review January 29, 2026 05:58
Copilot AI review requested due to automatic review settings January 29, 2026 05:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new integration rule to guide users on running dnsmasq alongside NextDNS while preserving client reporting and conditional configuration features. The integration addresses a common scenario where routers come with dnsmasq pre-installed and need to coexist with NextDNS.

Changes:

  • New integration rule documenting dnsmasq and NextDNS coexistence setup
  • Updated skill manifest to register the new rule with appropriate keywords
  • Configuration guidance for port settings, client identification parameters, and automatic router setup

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.

File Description
skills/integrations/rules/dnsmasq-integration.md Comprehensive guide for configuring dnsmasq to forward DNS queries to NextDNS on an alternative port while preserving client information via MAC addresses and subnet data
skills/integrations/SKILL.md Registered new dnsmasq integration rule in the capability rules table with appropriate keywords and description

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +80 to +106
- DNSMasq is running on port 53
- NextDNS is configured to use an alternative port (e.g., 5555)
- No other services are using the chosen alternative port

```bash
# Check which service is using port 53
netstat -tulpn | grep :53

# Verify NextDNS is listening on the configured port
netstat -tulpn | grep :5555
```

### Client Reporting Not Working

If client devices are not appearing correctly in NextDNS analytics:

- Verify `--add-mac` parameter is enabled in DNSMasq configuration
- Check that `--add-subnet` parameter is properly configured
- Ensure DNS queries are being forwarded to NextDNS (check DNSMasq logs)

### Router Firmware Issues

If `-setup-router` fails or doesn't configure properly:

- Fall back to manual configuration using Steps 1 and 2
- Check router firmware documentation for DNSMasq configuration location
- Ensure you have appropriate permissions to modify DNSMasq configuration

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project name should be "dnsmasq" in lowercase, not "DNSMasq".

Copilot uses AI. Check for mistakes.
## Reference

- [NextDNS CLI Wiki](https://github.com/nextdns/nextdns/wiki)
- [DNSMasq Documentation](https://thekelleys.org.uk/dnsmasq/doc.html)

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link text should use "dnsmasq" in lowercase, not "DNSMasq", to match the official project name.

Suggested change
- [DNSMasq Documentation](https://thekelleys.org.uk/dnsmasq/doc.html)
- [dnsmasq documentation](https://thekelleys.org.uk/dnsmasq/doc.html)

Copilot uses AI. Check for mistakes.

| Rule | Keywords | Description |
|------|----------|-------------|
| [DNSMasq Integration](rules/dnsmasq-integration.md) | dnsmasq, dns, router, client reporting, conditional configuration, port configuration, setup-router | Configure DNSMasq and NextDNS to run together while maintaining client reporting and conditional configuration features |

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The table entry uses "DNSMasq" in mixed case, but based on codebase conventions and the official project name, it should be "dnsmasq" in lowercase. This applies to both the link text and the description.

Suggested change
| [DNSMasq Integration](rules/dnsmasq-integration.md) | dnsmasq, dns, router, client reporting, conditional configuration, port configuration, setup-router | Configure DNSMasq and NextDNS to run together while maintaining client reporting and conditional configuration features |
| [dnsmasq Integration](rules/dnsmasq-integration.md) | dnsmasq, dns, router, client reporting, conditional configuration, port configuration, setup-router | Configure dnsmasq and NextDNS to run together while maintaining client reporting and conditional configuration features |

Copilot uses AI. Check for mistakes.

# DNSMasq Integration

**Impact: MEDIUM** - Enables DNSMasq and NextDNS to run together while preserving client reporting and conditional configuration capabilities

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project name should be "dnsmasq" in lowercase, not "DNSMasq".

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +17
DNSMasq is a lightweight DNS forwarder commonly bundled with router firmwares. It is possible to run DNSMasq and NextDNS together on the same system while maintaining full NextDNS functionality, including client reporting and conditional configuration features.

This integration allows DNSMasq to continue handling local DNS resolution and DHCP services while forwarding external DNS queries to NextDNS for filtering and protection.

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project name should be "dnsmasq" in lowercase, not "DNSMasq".

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +34
NextDNS must be configured to listen on a different port to avoid conflicts with DNSMasq, which typically uses port 53.

```bash
# Configure NextDNS to listen on port 5555 on localhost
nextdns install -listen 127.0.0.1:5555
```

This configuration ensures NextDNS binds to port 5555 instead of the default port 53, allowing DNSMasq to continue operating on port 53.

### Step 2: Configure DNSMasq to Forward to NextDNS

Add the following parameters to your DNSMasq configuration to forward DNS queries to NextDNS while preserving client information:

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project name should be "dnsmasq" in lowercase, not "DNSMasq".

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,112 @@
---
title: DNSMasq Integration

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project name "dnsmasq" should be in lowercase, not "DNSMasq". Throughout the codebase (e.g., skills/integrations/rules/openwrt.md:68, skills/nextdns-cli/rules/installation.md:49, skills/nextdns-cli/rules/platform-specific.md:13, skills/nextdns-cli/rules/troubleshooting.md:54), "dnsmasq" is consistently written in lowercase. The official project also uses lowercase as evidenced by the documentation URL (thekelleys.org.uk/dnsmasq/doc.html). This violates the case-police rules specified in CLAUDE.md.

Copilot uses AI. Check for mistakes.
---
title: DNSMasq Integration
impact: MEDIUM
impactDescription: Running DNSMasq alongside NextDNS without proper configuration can result in loss of client reporting and conditional configuration features. This guidance ensures both services work together seamlessly while maintaining full NextDNS functionality.

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project name should be "dnsmasq" in lowercase throughout the file, not "DNSMasq". This is inconsistent with the rest of the codebase and the official project naming. All occurrences in this file should use lowercase "dnsmasq".

Copilot uses AI. Check for mistakes.
tags: dnsmasq, dns, router, client reporting, conditional configuration, port configuration, setup-router
---

# DNSMasq Integration

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project name should be "dnsmasq" in lowercase, not "DNSMasq".

Copilot uses AI. Check for mistakes.
Comment on lines +55 to +72
On router firmwares that ship with DNSMasq pre-installed, the above configuration can often be handled automatically.

When running NextDNS installation on such routers, use the `-setup-router` parameter:

```bash
# Automatic router setup (handles DNSMasq configuration)
nextdns install -setup-router
```

The `-setup-router` flag automatically detects DNSMasq and configures both services to work together without manual intervention. This is the recommended approach for router environments.

## Best Practices

- **Use alternative port**: Always configure NextDNS to use a non-standard port (e.g., 5555) when running alongside DNSMasq
- **Preserve client information**: Ensure `--add-mac` and `--add-subnet` parameters are set to maintain client reporting features
- **Prefer automatic setup**: On router firmwares, use `-setup-router` parameter for automatic configuration
- **Verify forwarding**: Test DNS resolution after configuration to ensure queries are properly forwarded to NextDNS
- **Check logs**: Monitor both DNSMasq and NextDNS logs to verify proper operation and client identification

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The project name should be "dnsmasq" in lowercase, not "DNSMasq".

Copilot uses AI. Check for mistakes.
@tuanductran
tuanductran merged commit 21c23e7 into main Jan 29, 2026
10 checks passed
@tuanductran
tuanductran deleted the copilot/add-dnsmasq-integration-rule branch January 29, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants