OPNsense Forum

Archive => 21.1 Legacy Series => Topic started by: IsaacFL on March 26, 2021, 09:29:46 pm

Title: How do I import a config.xml during install?
Post by: IsaacFL on March 26, 2021, 09:29:46 pm
I recently did a reinstall (VM to physical hardware) and I wanted to just import my existing config.xml into the new hardware install. I had to move my 4 port network card from the VM Host, so everything had to go down.

I saved my configuration to a USB, \conf\config.xml

During the boot, I used the opnsense-importer utility to pick my config.xml which worked but only into the "Live Environment".

I could not figure out a way to import during the install process?  I ended up having to do the vanilla install, getting an old laptop and configuring it with a static 192.168.1.1/24 (I don't use this private network) and using the web interface to restore the configuration.

I routinely did this with pfsense, if I messed up something it was quicker to just reinstall and import the backup in one step.  Two minutes vs this stretched into 15 minutes.

It is not obvious from the documentation how to do this?

Title: Re: How do I import a config.xml during install?
Post by: packet loss on March 26, 2021, 11:09:39 pm
I recall being able to import mine. I think I did a complete install but didn't really configure anything beyond getting past the point of the initial install. Then from the shell I ran the opnsense-importer to import my config.xml from a USB drive and then rebooted.
Title: Re: How do I import a config.xml during install?
Post by: IsaacFL on March 27, 2021, 01:33:22 am
Looks like the step would be at the console, immediately after install:

8) Shell

# opnsense-importer
picked my USB from the list.

# Reboot 

Wondering if I should have rebooted by exit, then option 6) Reboot System.

This did seem to work. I did not de a full reinstall for this test.  I backed up my config to a FAT USB to file \conf\config.xml.

I deleted one of my NTP timer servers.

Went to the console and did the above. After reboot, my NTP server was back, so must have worked.

Option 13) Restore from a backup is not the route to go to get from USB.  Shell is.


Title: Re: How do I import a config.xml during install?
Post by: packet loss on March 27, 2021, 02:23:31 pm
I haven't had the time to test alternative methods. It's also probably been over a year that I've installed OPNsense, and believe there's been quite a few changes to the install process. I'm thinking below should also work:

From console menu
1. install
2. reboot
3. restore

I'm glad you got it to work. Saved me alot of time last time I did it. There's also a recent bug reported regarding importing an encrypted backup #4861 (https://github.com/opnsense/core/issues/4861). Mabye some potential issues maybe resolved during the code audit.
Title: Re: How do I import a config.xml during install?
Post by: dcol on September 19, 2021, 08:59:22 pm
I know this is an older topic but for those who are looking for the easiest method to install OPNsense with the same configuation, I did this. Chime in if I am wrong.

1. Backup configuration and place on FAT32 formatted USB drive under folder \conf and rename backup to config.xml.
2. Install OPNsense and when asked for configuration restore, choose the USB with \conf\config.xml

That's it.
Title: Re: How do I import a config.xml during install?
Post by: franco on September 20, 2021, 01:53:58 pm
Right. The \conf directory is actually meant to be used as a copy of an existing installation to restore as much as possible contained within that directory, e.g. SSH keys, DHCP leases and old configuration backups.


Cheers,
Franco