Converting from IPCop to pfSense and adding 135+ static IP addresses - help!
-
I have been using various search terms in forum search tool and I'm not finding any appropriate answers, and I am really not in the mood to manually enter 135+ static hostname./IP addresses via the web GUI.
I tried adding some to the /etc/hosts file where they end up, but a restart of the DSN services wipes the file.
The MUST be a way to batch add hosts entries into this thing – Could someone please, pretty please hit me with a clue as to where to look for the magic that allows this?
-
I posted a reply to your post in DNS section.
-
you could possibly enter them into the config.xml manually. enter 2 and find them in the config.
then do the same for the others in your favorite text editor
-
Turned out to be pretty simple.
IPCop hosts table extracts easily into a comma delimited format and that can be converted into the XML of the XML layout of the backup file, that can then be restored.(I don't know how to format code on this board, so forgive me..)
Simple batch job to do the conversion, then paste the output in between the appropriate sections of the backup file, then restore.I think the biggest issue here is that I couldn't find anything on this because I couldn't figure out appropriate keywords for searches.
I know someone else has had this issue before and already solved it…#!/bin/ksh -x
INFILE=$1
OUTFILE=$2
for LINE incat $INFILE
do
IP=echo $LINE | cut -f1 -d,
HOST=echo $LINE | cut -f2 -d,
DOMAIN=echo $LINE | cut -f3 -d,
print "\t<hosts>" >> $OUTFILE
print "\t\t<host>$HOST</host>" >> $OUTFILE
print "\t\t<domain>$DOMAIN</domain>" >> $OUTFILE
print "\t\t<ip>$IP</ip>" >>$OUTFILE
print "\t\t<descr>" >> $OUTFILE
print "\t\t<aliases>" >> $OUTFILE
print "\t</aliases></descr></hosts>" >> $OUTFILE
done