Transferring Static IPs

Suggest improvements and new features for Gargoyle.

Moderator: Moderators

Post Reply
guyso
Posts: 47
Joined: Fri Jan 06, 2012 6:52 pm

Transferring Static IPs

Post 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
Netgear WNDR3700 v1 and v2 and v4
Linksys WRT1900ACS

ektus
Posts: 243
Joined: Sun Aug 11, 2013 2:26 am
Location: Germany

Re: Transferring Static IPs

Post 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. "

Lantis
Moderator
Posts: 6753
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Transferring Static IPs

Post 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.
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

guyso
Posts: 47
Joined: Fri Jan 06, 2012 6:52 pm

Re: Transferring Static IPs

Post 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
Netgear WNDR3700 v1 and v2 and v4
Linksys WRT1900ACS

ektus
Posts: 243
Joined: Sun Aug 11, 2013 2:26 am
Location: Germany

Re: Transferring Static IPs

Post 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.

Post Reply