What's new

dnsmasq.conf.add without custom firmware?

  • 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!

you can mount your .conf on top of the regular one. you just need to make sure everything gets copied first from it to the one you wish to mount, then add your options at the end.... there is two options for initializing scripts, either using the nvram option for on mount usb or using the nvram jffs2_exec option which launches at early boot.

I know this is old thread, but this is for knowledge base.



To be specific, this is what I did, it works great!

I just combine it with entware, resulted in the following


Markdown (GitHub flavored):
```shell

mkdir -p /jffs/scripts

```

Adding script to execute when mounting the usb

Markdown (GitHub flavored):
```shell

cat > /jffs/scripts/mountOpt

#!/bin/sh
# 1. mount the opt dir after every reboot
# 2. change dnsmasq ipv6 dns server

mkdir /tmp/opt
# where /dev/sdX# is your usb opt partition
mount /dev/sda1 /opt

# find and replace line
sed -i "s/dhcp-option=lan,option6:23,.*/dhcp-option=lan,option6:23,[fe80::3]/" /etc/dnsmasq.conf
# restart dnsmasq
killall dnsmasq && dnsmasq --log-async
```



press ctrl+d to exit



Markdown (GitHub flavored):
```shell

chmod 755 /jffs/scripts/mountOpt

nvram set script_usbmount="/jffs/scripts/mountOpt"
nvram commit
```


Restart the router, to verify the result use `sudo radvdump` in linux terminal to see RA message, you should get something like this


Markdown (GitHub flavored):
```shell
sudo radvdump
#
# radvd configuration generated by radvdump 2.18
# based on Router Advertisement from fe80::f22f:74ff:fec4:3415
# received by interface br0
#

interface br0
{
    AdvSendAdvert on;
    # Note: {Min,Max}RtrAdvInterval cannot be obtained with radvdump
    AdvManagedFlag off;
    AdvOtherConfigFlag on;
    AdvReachableTime 0;
    AdvRetransTimer 0;
    AdvCurHopLimit 64;
    AdvDefaultLifetime 600;
    AdvHomeAgentFlag off;
    AdvDefaultPreference medium;
    AdvLinkMTU 1492;
    AdvSourceLLAddress on;

    prefix 2403:6200:xxxx:xxxx::/64
    {
        AdvValidLifetime 600;
        AdvPreferredLifetime 600;
        AdvOnLink on;
        AdvAutonomous on;
        AdvRouterAddr off;
    }; # End of prefix definition


    RDNSS fe80::3
    {
        AdvRDNSSLifetime 600;
    }; # End of RDNSS definition

}; # End of interface definition
```
 
I know this is old thread, but this is for knowledge base.



To be specific, this is what I did, it works great!

I just combine it with entware, resulted in the following


Markdown (GitHub flavored):
```shell

mkdir -p /jffs/scripts

```

Adding script to execute when mounting the usb

Markdown (GitHub flavored):
```shell

cat > /jffs/scripts/mountOpt

#!/bin/sh
# 1. mount the opt dir after every reboot
# 2. change dnsmasq ipv6 dns server

mkdir /tmp/opt
# where /dev/sdX# is your usb opt partition
mount /dev/sda1 /opt

# find and replace line
sed -i "s/dhcp-option=lan,option6:23,.*/dhcp-option=lan,option6:23,[fe80::3]/" /etc/dnsmasq.conf
# restart dnsmasq
killall dnsmasq && dnsmasq --log-async
```



press ctrl+d to exit



Markdown (GitHub flavored):
```shell

chmod 755 /jffs/scripts/mountOpt

nvram set script_usbmount="/jffs/scripts/mountOpt"
nvram commit
```


Restart the router, to verify the result use `sudo radvdump` in linux terminal to see RA message, you should get something like this


Markdown (GitHub flavored):
```shell
sudo radvdump
#
# radvd configuration generated by radvdump 2.18
# based on Router Advertisement from fe80::f22f:74ff:fec4:3415
# received by interface br0
#

interface br0
{
    AdvSendAdvert on;
    # Note: {Min,Max}RtrAdvInterval cannot be obtained with radvdump
    AdvManagedFlag off;
    AdvOtherConfigFlag on;
    AdvReachableTime 0;
    AdvRetransTimer 0;
    AdvCurHopLimit 64;
    AdvDefaultLifetime 600;
    AdvHomeAgentFlag off;
    AdvDefaultPreference medium;
    AdvLinkMTU 1492;
    AdvSourceLLAddress on;

    prefix 2403:6200:xxxx:xxxx::/64
    {
        AdvValidLifetime 600;
        AdvPreferredLifetime 600;
        AdvOnLink on;
        AdvAutonomous on;
        AdvRouterAddr off;
    }; # End of prefix definition


    RDNSS fe80::3
    {
        AdvRDNSSLifetime 600;
    }; # End of RDNSS definition

}; # End of interface definition
```
what version of firmware are you running that still utilizes radvd for ipv6( or is this on the client); also be more specific because the router doesn't utilize sudo. this is a debian based advanced user configuration option a.k.a. superuser on a confined system.
 
what version of firmware are you running that still utilizes radvd for ipv6( or is this on the client); also be more specific because the router doesn't utilize sudo. this is a debian based advanced user configuration option a.k.a. superuser on a confined system.

I use RT-AX89X, sadly it was the only model with 10GbE but has no Merlin support.

The firmware is latest stock.
3.0.0.4.386_47027

I may have confuse you in verifying the result section.

That command is just for viewing RA message and can ran on any Linux client, in my case, I use Ubuntu to verify the result.
 
I know this is old thread, but this is for knowledge base.



To be specific, this is what I did, it works great!

I just combine it with entware, resulted in the following


Markdown (GitHub flavored):
```shell

mkdir -p /jffs/scripts

```

Adding script to execute when mounting the usb

Markdown (GitHub flavored):
```shell

cat > /jffs/scripts/mountOpt

#!/bin/sh
# 1. mount the opt dir after every reboot
# 2. change dnsmasq ipv6 dns server

mkdir /tmp/opt
# where /dev/sdX# is your usb opt partition
mount /dev/sda1 /opt

# find and replace line
sed -i "s/dhcp-option=lan,option6:23,.*/dhcp-option=lan,option6:23,[fe80::3]/" /etc/dnsmasq.conf
# restart dnsmasq
killall dnsmasq && dnsmasq --log-async
```



press ctrl+d to exit



Markdown (GitHub flavored):
```shell

chmod 755 /jffs/scripts/mountOpt

nvram set script_usbmount="/jffs/scripts/mountOpt"
nvram commit
```


Restart the router, to verify the result use `sudo radvdump` in linux terminal to see RA message, you should get something like this


Markdown (GitHub flavored):
```shell
sudo radvdump
#
# radvd configuration generated by radvdump 2.18
# based on Router Advertisement from fe80::f22f:74ff:fec4:3415
# received by interface br0
#

interface br0
{
    AdvSendAdvert on;
    # Note: {Min,Max}RtrAdvInterval cannot be obtained with radvdump
    AdvManagedFlag off;
    AdvOtherConfigFlag on;
    AdvReachableTime 0;
    AdvRetransTimer 0;
    AdvCurHopLimit 64;
    AdvDefaultLifetime 600;
    AdvHomeAgentFlag off;
    AdvDefaultPreference medium;
    AdvLinkMTU 1492;
    AdvSourceLLAddress on;

    prefix 2403:6200:xxxx:xxxx::/64
    {
        AdvValidLifetime 600;
        AdvPreferredLifetime 600;
        AdvOnLink on;
        AdvAutonomous on;
        AdvRouterAddr off;
    }; # End of prefix definition


    RDNSS fe80::3
    {
        AdvRDNSSLifetime 600;
    }; # End of RDNSS definition

}; # End of interface definition
```
Ok, I'm a newbie here. Trying to do this on an RT-ACRH13 to enable DHCP option #66. This is the line I'm trying to add: dhcp-option=66,"99.99.99.99"

Of course 99.99.99.99 is the placeholder for the the IP of my TFTP server

I got as far as:
mkdir -p /jffs/scripts (DONE)

But then when I try to run the following, it just hangs:
cat > /jffs/scripts/mountOp

Is there any way you can walk me through this step-by step as a newbie?

I'm only trying to add 1 line to enable dhcp-option=66

Thanks!
 
It's waiting for your terminal input. Paste the other lines and then hit Ctrl-D to write the file (ignore the ``` line at the end).
Thanks, but I don't want to replace the "dhcp-option=lan" line of dnsmasq.conf

I want to ADD a line to dnsmasq.conf, that says:
dhcp-option=66,"99.99.99.99"

Correct?

Is a "sed" command appropriate for that? What would be the syntax to add a new code line to dnsmasq.conf, rather than replace?

_____________________________________________________________

Also...............

I did try running your sed script, to replace a static dhcp assignment in my settings (that I don't need), with my dhcp-option 66 setting:

sed -i 's/dhcp-host=70:70:70:70:70:70,192.168.2.180/dhcp-option=66,"99.99.99.99"/" /etc/dnsmasq.conf

However, upon rebooting, it did absolutely nothing! The static dhcp line for 192.168.2.180 still appears, and my dhcp-option 66 setting is nowhere to be found!


Thanks!
 
I want to ADD a line to dnsmasq.conf, that says:
dhcp-option=66,"99.99.99.99"
Use this instead of sed:
Code:
echo "dhcp-option=66,99.99.99.99" >> /etc/dnsmasq.conf

However, upon rebooting, it did absolutely nothing! The static dhcp line for 192.168.2.180 still appears, and my dhcp-option 66 setting is nowhere to be found!
All your changes will be lost after a reboot if you don't have the nvram set script_usbmount command set. That's assuming your router even supports that option.
 
Few years later ... at least in current version of plain asuswrt, there is a way to add your lines in dnsmasq.conf .
The one that is actually used after every save or restart is in /jffs/nvram/dhcp_staticlist
The format is quite odd : One line, MAC in < > and IP ending with >> .
That format can be easily produced by a nice and clean list, either with some for-loop in bash (even with sed), or with =CONCAT in any spreasheet.

SImilarly for the names of the devices, in /jffs/nvram/custom_clientlist - with some unknown additions, though.

However, I am not sure you can pass the limit that is imposed by nvram variables' size .
 
Few years later ... at least in current version of plain asuswrt, there is a way to add your lines in dnsmasq.conf .
The one that is actually used after every save or restart is in /jffs/nvram/dhcp_staticlist
The format is quite odd : One line, MAC in < > and IP ending with >> .
That format can be easily produced by a nice and clean list, either with some for-loop in bash (even with sed), or with =CONCAT in any spreasheet.

SImilarly for the names of the devices, in /jffs/nvram/custom_clientlist - with some unknown additions, though.

However, I am not sure you can pass the limit that is imposed by nvram variables' size .

But, can you put a "dhcp-option=66" entry there, and have it stick upon reboot?
 
Thanks, but I don't want to replace the "dhcp-option=lan" line of dnsmasq.conf

I want to ADD a line to dnsmasq.conf, that says:
dhcp-option=66,"99.99.99.99"

Correct?

Is a "sed" command appropriate for that? What would be the syntax to add a new code line to dnsmasq.conf, rather than replace?

_____________________________________________________________

Also...............

I did try running your sed script, to replace a static dhcp assignment in my settings (that I don't need), with my dhcp-option 66 setting:

sed -i 's/dhcp-host=70:70:70:70:70:70,192.168.2.180/dhcp-option=66,"99.99.99.99"/" /etc/dnsmasq.conf

However, upon rebooting, it did absolutely nothing! The static dhcp line for 192.168.2.180 still appears, and my dhcp-option 66 setting is nowhere to be found!


Thanks!
I have experienced this problem for two years. Adding dhcp-option=66,”IPADDRESS” to the dnsmasq.conf.add file does not work for me. NOTE that I am using ASUSWRT-Merlin firmware in my routers.

Finally found the correct entry that works. Skip the dhcp-option=66 entry and use this in the dnsmasq.conf.add file. dhcp-boot=,99.99.99.99,99.99.99.99
Use the IP address of whatever tftp server you need. This works for VoIP phones to find their configuration server or freepbx on your network. The commas are necessary.
 
Few years later ... at least in current version of plain asuswrt, there is a way to add your lines in dnsmasq.conf
If you have USB drive and use the script_usbmount (or asusware trick if it doesn't work) then you can basically run any script or command, so it's possible.
 
Sorry for bumping this thread, but I was in exactly the same situation. I bought a new RT-AX58U v2 (which is not supported by RMerlin), and I had the need to inject some custom routes for a VPN in DHCP. This was previously done on RMelin firmware with a /jffs/scritps/dnsmasq.postconf script.

So, with stock firmware + ssh I found one can use these scripts: https://github.com/jacklul/asuswrt-scripts/tree/master?tab=readme-ov-file#available-scripts to basically get some of RMerlin custom functionality back.

Hope this helps other users.
 
Similar threads
Thread starter Title Forum Replies Date
T I can't add profiles in Guest Network pro ROG-GTAX6000 ASUSWRT - Official 5

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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