What's new

Is there a way to migrate static IPs from the older Merlin firmware to NG?

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

monakh

Regular Contributor
Howdy, long time Merlin user.

I want to migrate to the NG firmware (still stuck on 380.70) but I have about a 100 or so IPs defined in the static pool via DHCP reservations. Is there a way to migrate them since you can't do a dirty upgrade?
 
My bad, I did search before I posted. Thanks for the search tip.
 
My bad, I did search before I posted. Thanks for the search tip.

The methods posted in the forum may not work with v384.xx.

I suggest you confirm the current size of your 'dhcp_staticlist'.....to comply with the v384.xx NVRAM variable size limits.

I used a script containing the following code snippet to manually migrate the DHCP reserved list and Port Forward (vserver) entries etc.
Code:
#!/bin/sh
Say(){
   echo -e $$ $@ | logger -st "($(basename $0))"
}
Get_MAX_NVRAM_size () {
    local NVRAM_VAR=$1
 
    if [ -z "$2"  ];then
        Say "Retrieving NVRAM variable '"$NVRAM_VAR"' Maximum size value limit from RMerlin Github...."
    fi
 
    local CKN_STRsize=$(curl -s https://github.com/RMerl/asuswrt-merlin.ng/blob/40ba6c41a6a40d71427d871948232556d40935e1/release/src/router/shared/defaults.c | grep $NVRAM_VAR | grep -oE "(CKN_STR)([0-9]{1,4})" | grep -oE "([0-9]{1,4})")
    local RC=$?
 
    if [ $RC -eq 0 ] && [ ! -z "$CKN_STRsize" ];then
        if [ -z "$2" ];then
            Say "Retrieved NVRAM variable '"$NVRAM_VAR"' Maximum size limit value="$CKN_STRsize
        fi
    else
        Say "***ERROR Unable to retrieve NVRAM variable '"$NVRAM_VAR"' Maximum size value limit from RMerlin Githib - RC="$RC "(Default 255 assumed)"
        local CKN_STRsize=255                   # default
    fi
 
    echo $CKN_STRsize
 
 
}

NVRAM_VAR="dhcp_staticlist"

echo -e

NVRAM_VAR_MAX_SIZE=$(Get_MAX_NVRAM_size "$NVRAM_VAR")

echo -e "\tNVRAM variable '"$NVRAM_VAR"' MAXIMUM size allowed is" $NVRAM_VAR_MAX_SIZE "bytes"

OLD_NVRAM=$(nvram get dhcp_staticlist)
OLD_NVRAM_SIZE=$(echo $OLD_NVRAM | awk '{print length()}' )

OLD_NVRAM_CNT=$(echo $OLD_NVRAM | awk -F\< '{print NF-1}')

OLD_NVRAM_DATA=$(nvram get dhcp_staticlist | tr -d "<>")
OLD_NVRAM_DATA_SIZE=$(echo $OLD_NVRAM_DATA | awk '{print length()}' )

echo -e $cBWHT"\n\tCurrent NVRAM '"$NVRAM_VAR"' variable is" $OLD_NVRAM_SIZE "bytes in length (Data="$OLD_NVRAM_DATA_SIZE") CNT="$OLD_NVRAM_CNT"\n"


exit

e.g.
Code:
(ChkNVRAM.sh): 718 Retrieving NVRAM variable 'dhcp_staticlist' Maximum size value limit from RMerlin Github....

(ChkNVRAM.sh): 718 Retrieved NVRAM variable 'dhcp_staticlist' Maximum size limit value=2999

 NVRAM variable 'dhcp_staticlist' MAXIMUM size allowed is 2999 bytes

 Current NVRAM 'dhcp_staticlist' variable is 2994 bytes in length (Data=2768) CNT=75

If your 100 entries exceed the max character limit then you will need to manually add the entries that exceed the maximum NVRAM variable size to '/jffs/configs/dnsmasq.conf.add'
 
Last edited:

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