What's new

How to create Merlin configuration files?

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

ixnay

New Around Here
I'm transitioning from several years with DD-WRT to AsusWRT-Merlin on a TM-AC1900. I'm a pretty low-level user but I managed to find step-by-step "recipes" for fleshing out the configurations in DD-WRT, and I'm wanting to figure out how to transfer my fairly extensive firewalll rules (~270 lines) and DNSMasq rules (~130 lines) to Merlin.

I gather I need to create a file called <something>.conf.add and copy it to /jffs/configs. But there are a number of things I can't figure out that I need to know to make that happen.

The first thing is the format of the *.conf.add file. I telnetted in and tried to find an existing configuration file but can't locate any. The directories /jffs/configs and /jffs/scripts are empty.

I've read the github page on custom config files and it seems to be saying that the *.conf.add file is actually a script that uses a syntax something like:

pc_replace "original string" "new string" "config filename"

Except besides the pc_replace function, there's also pc_insert, pc_append and pc_delete. I can't find clarification on the use of each, and it seems to me I need to know what the current configuration is before I can know whether it's a replace, an insert, an append or a delete.

Or since /jffs/configs and /jffs/scripts are empty, do I proceed under the assumption that nothing is configured and everything is a pc_insert?

Also, my DNSMasq rules obviously go in dnsmasq.postconf.add, but I can't find any reference to the name of the file to contain my firewall rules/iptables.

Lastly, with such extensive configuration files, I obviously don't want to have to keypunch these in using VI, so I gather I can create them elsewhere (in UNIX format) but I have to set up a USB drive on the router and transfer the configuration files to it either by FTP or HTTP, then telnet in and move them to /jffs/configs. Yes? / No? / Maybe?

Answers, hints, and taunts are welcome.
[flamesuit on]

If there is a master "user's manual" for Merlin, I'd be especially grateful if someone would point me to it. The closest I've found to it is the Wiki at github. I have the (non-Merlin) AsusWRT manual and it's of no help.
 
Hi @ixnay

There is no "user manual" as such, just the wiki and of course this forum;). The main things you are interested in are User Scripts and Custom Config Files.

When replacing or adding to an existing configuration file the format is the same as the file in question. So if you were adding entries to the hosts file, the contents of hosts.add would be the usual IP address followed by hostname.

When you need to make more complex changes to a configuration file you can use a standard unix script, identified by its .postconf suffix. As you have noticed there are some built in functions like pc_insert to help you change the file (in addition to all the usual shell script commands).

If you don't have (or want) a USB drive plugged into the router to transfer files you can use WinSCP (for Windows) to directly edit files under /jffs in a Windows-like way.
 
The firmware comes with nano included, a user-friendly text editor.

Basically:

jffs/configs/file.conf: file that completely replace the config file generated by the router
jffs/configs/file.add: file that gets appended to the end of the config file generated by the router
jffs/scripts/file.postconf: shell script executed right after the firmware has created the config file, so it can be used to manipulate the generated config file.

The Wiki is the primary documentation, and should cover everything that's not part of the Asus stock firmware.
 
Thank you for your help. I managed to get it to accept both my DNSMasq configurations and my IP tables.
 
Isn't there any built-in script (like entware-setup.sh) which creates stub conf-files for user scripts? It would be very helpful.
 
No, because those files should not exist if they aren't used.
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

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