Page 1 of 1

Transferring Static IPs

Posted: Thu Jun 29, 2023 5:40 pm
by guyso
Hello

My main router is a WRT1900ACS running version 1.13.0. My backup router is also a WRT1900ACS but was running version 1.12.0. I have upgraded my backup router to 1.13.0 and would like to transfer a large amount of static IPs from the main router to the backup router. In version 1.12.0 I could do this by copying;
/etc/hosts
/etc/ethers
from one router to the other.

Using Winscp I have found that in 1.13.0 these files do not have the required information. Is there another file or files in 1.13.0 I can copy from main router to backup router to avoid manually entering all my Static IP information.

Thank you

Re: Transferring Static IPs

Posted: Sat Jul 01, 2023 2:24 pm
by ektus
It is possible. Been there, done that :-)

From viewtopic.php?p=65238#p65238

"I was able to copy over the DHCP and hostname settings by combining them into the new /etc/dhcp file using a spreadsheet. "

Re: Transferring Static IPs

Posted: Sun Jul 02, 2023 5:43 am
by Lantis

Code: Select all

#!/bin/sh

idx=1

grep -v '^#' /etc/hosts | while read line
do
        [ -z "$line" ] && continue
        ip=$(echo "$line" | cut -f 1)
        hostname=$(echo "$line" | cut -f 2)

        etherline=$(cat /etc/ethers | grep "$ip")
        mac=$(echo "$etherline" | cut -f 1)

        uci set dhcp.static_host_$idx=host
        uci set dhcp.static_host_$idx.name=$hostname
        uci set dhcp.static_host_$idx.mac=$mac
        uci set dhcp.static_host_$idx.ip=$ip
        uci commit

        idx=$((idx + 1))
done
Use at your own risk. This may or may not work.

Re: Transferring Static IPs

Posted: Sun Jul 02, 2023 6:00 pm
by guyso
Thank you ektus and Lantis for your replys.

Using some of the info ektus supplied I found all the static addresses in my main router in the file '/etc/config/dhcp'. I copied the static addresses from this file to the backup router, rebooted backup router and now all the static addresses are showing in the backup router Gargoyle screen. I assume now that this problem is solved. Any comments on this approach?

Thank you

Re: Transferring Static IPs

Posted: Mon Jul 03, 2023 1:54 pm
by ektus
I didn't fully grasp your problem then. Both our solutions were for transferring the DHCP assignments from the old to the new format. In your case, with both routers identical in hardware and software, the easiest way should be to simply backup the main router and restore that on the spare.