Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Converting from IPCop to pfSense and adding 135+ static IP addresses - help!

    Scheduled Pinned Locked Moved Problems Installing or Upgrading pfSense Software
    4 Posts 3 Posters 643 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MakOwner
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • G
        gjaltemba
        last edited by

        I posted a reply to your post in DNS section.

        1 Reply Last reply Reply Quote 0
        • H
          heper
          last edited by

          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

          1 Reply Last reply Reply Quote 0
          • M
            MakOwner
            last edited by

            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 in cat $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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.