Configuration export and import selected values?

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
adasch
DD-WRT User


Joined: 02 Jan 2015
Posts: 86
Location: Gdansk, Poland

PostPosted: Fri Aug 30, 2024 6:55    Post subject: Configuration export and import selected values? Reply with quote
Hello,

Is it possible to export config file, clear all other entries but leave strings for static leases, access restrictions, VPN etc. and import it on fresh, cleared configuration?

there is some documentation or editor for configuration file?

I see entries
static_leases and all configuration in one line
but access restrictions and VPN config is not clear for me.

Or maybe there is another metod for partial export important settings

Cheers!

_________________
EA6900 r57956
WRT600N r57956
Sponsor
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 13560
Location: Netherlands

PostPosted: Fri Aug 30, 2024 7:07    Post subject: Reply with quote
Have a look at : https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=322503

Static leases can be easily add to the DNSMasq Additional options in plain text so that it is easy to backup and add again e.g.
Code:
dhcp-host=D0:AB:F5:51:A1:33,nitro,192.168.1.23,1440m

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Per Yngve Berg
DD-WRT Guru


Joined: 13 Aug 2013
Posts: 7012
Location: Romerike, Norway

PostPosted: Fri Aug 30, 2024 7:50    Post subject: Reply with quote
Redirect to a file

Nvram show >/temp/nvram.txt
adasch
DD-WRT User


Joined: 02 Jan 2015
Posts: 86
Location: Gdansk, Poland

PostPosted: Fri Aug 30, 2024 10:34    Post subject: Reply with quote
it's clear, but how import required data?

a have about 50 static leases, rewriting it manually is horrible.
similar situation with access restrictions,

current nvram 61 KiB / 64 KiB

is it possible create file with 2 lines like:

first header Very HappyD-WRTÁ wl_mac_deny wl_txstreams 0
second: static_leasesĂ

is it modify only static_leases and leave others unchanged?

_________________
EA6900 r57956
WRT600N r57956
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 13560
Location: Netherlands

PostPosted: Fri Aug 30, 2024 10:48    Post subject: Reply with quote
adasch wrote:
it's clear, but how import required data?

a have about 50 static leases, rewriting it manually is horrible.
similar situation with access restrictions,

current nvram 61 KiB / 64 KiB

is it possible create file with 2 lines like:

first header Very HappyD-WRTÁ wl_mac_deny wl_txstreams 0
second: static_leasesĂ

is it modify only static_leases and leave others unchanged?



Copy your static leases from /tmp/dnsmasq.conf to a text file on your desktop.
From there copy it back to the new or resetted route in DNSMasq Additional config.

I do not use access restrictions so cannot help with that

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6785
Location: UK, London, just across the river..

PostPosted: Fri Aug 30, 2024 11:52    Post subject: Reply with quote
Static leases are easy, as the other said above, follow this format and than copy paste from txt file to advanced dnsmasq config box, than save & apply

dhcp-host=D0:AB:F5:51:A1:33,nitro,192.168.1.23,1440m

For access restrictions you can use ether DNSmasq advance box commands(again) and play around..

to filter any non static IP addresses connecting to router

Use dnsmasq and additional options:
Code:

dhcp-host=11:22:33:44:55:66,set:known
dhcp-ignore=tag:!known


First directive will send extra options tagged as "known" to machine with Ethernet address 11:22:33:44:55:66.
The other directive will ignore any clients which are not specified in dhcp-host lines. Equivalent to ISC "deny unknown-clients".
This relies on the special "known" tag which is set when a host is matched.
On linux (!) means NOT.

or depends on the router you have as it may not work on every router only the high grade routers may have kerneltzz time (you didn't mention it and you should) you can use IPtables commands via commands save firewall option

in this format

iptables -I FORWARD -s 192.168.1.107 -m time --timestart 8:00 --timestop 18:00 --weekdays Mon,Tue,Wed,Thu,Fri,Sat,Sun --kerneltz -j REJECT

192.168.1.107 is the IP from router side you need to block choose any accordingly...

you can even block destination and ect..

iptables -I FORWARD -s 192.168.1.107 -d 8.8.8.8 -m time --timestart 8:00 --timestop 18:00 --weekdays Mon,Tue,Wed,Thu,Fri,Sat,Sun --kerneltz -j REJECT

Lots of users always complain on easy set up and ect... but none of them did its own research, bear in mind i've found those on the forum...so, i did mine research and you have a free lunch... Laughing
My goal is to help others that will spend more time to research...and may find this info helpful.. Cool

I also dont use access restrictions, as those are not favourable to use around and not always produce the expected results.. Razz

P.S. you can also export router pages to, print to pdf than copy/paste values...i know lots of us are doing it...too... Rolling Eyes

_________________
Atheros
TP-Link WR740Nv1 ---DD-WRT 58184 WAP
TP-Link WR1043NDv2 -DD-WRT 59369 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 59369 Gateway/DoT,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 59582 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 59582 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Dynalink DL-WRX36-DDWRT 59582
Broadcom
Netgear R7000 --DD-WRT 59582 Gateway/DNScrypt-proxy2/AD-Block,IPset Firewall,Forced DNS,x4VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 386

PostPosted: Mon Sep 02, 2024 3:46    Post subject: Re: Configuration export and import selected values? Reply with quote
adasch wrote:
Is it possible to export config file, clear all other entries but leave strings for static leases, access restrictions, VPN etc. and import it on fresh, cleared configuration?

Or maybe there is another method for partial export important settings
The easyddup package (link in post #2) comes with two scripts to save and restore selected settings.

The save_mynvram.sh script is basic.
The nvram-save.sh script is more powerful.

Take a look at the easyddup-vars.ini.sample and nvram-dd-wrt.ini.sample for (possibly obsolete) examples of nvram variables to save/restore.

With some tweaking of the nvram variable names you could automatically save&restore the settings you care about.
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 386

PostPosted: Sat Sep 07, 2024 15:01    Post subject: Reply with quote
Here's an example I just tried to transfer my static leases from my main router to my backup router.
Code:
root@DD-WRT:/opt/easyddup# ./save-mynvram.sh static_leasenum static_leases

Saving static_leasenum
Saving static_leases
Backing up previous restore script to /opt/easyddup/restore-mynvram.sh.bak

Saved 2 NVRAM variable(s)
Run /opt/easyddup/restore-mynvram.sh to restore your saved settings

Then copied restore-mynvram.sh to the backup router.

Code:
root@DD-WRT_2:/opt/easyddup# ./restore-mynvram.sh
Restoring static_leasenum
Restoring static_leases

Restore complete - 2 NVRAM variable(s)
Enter 'nvram commit' then reboot to activate your restored settings

Refreshed the browser on the backup router's services page and all the static leases appeared. This is so convenient for saving/restoring selected settings.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum