Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
General Discussion
»
"Automatically configure interfaces on boot"
« previous
next »
Print
Pages: [
1
]
Author
Topic: "Automatically configure interfaces on boot" (Read 2213 times)
withawat3555@gmail.com
Newbie
Posts: 1
Karma: 0
"Automatically configure interfaces on boot"
«
on:
September 07, 2020, 07:49:16 am »
Hi bro!!
I'm currently working on a cloud platform to automate the setup process for a network infrastructure.
Openstack is used to allocate network interface to my opnsense firewall, and it works great! But each time a new opnsense instance is create the interfaces has to be configured manually.
Would it be possible for me to create a script that automatically recognizes all the connected interfaces and configures them to be either LAN or WAN?
800hd4k
For example, if one of the connected interfaces has a 192.0.0.0/8 network, then the interfaces would automatically be configured to a LAN port.
I'm not asking anyone to create a script, just a pointer in the right direction!
Any help on this would be greatly appreciated!
Thank you
«
Last Edit: September 07, 2020, 08:02:06 am by withawat3555@gmail.com
»
Logged
franco
Administrator
Hero Member
Posts: 17668
Karma: 1611
Re: "Automatically configure interfaces on boot"
«
Reply #1 on:
September 07, 2020, 08:50:36 am »
The easiest way to automate this is to switch the /conf/config.xml prior to boot although that is no deployment process.... more like predeployment if you need to change the image file. We were discussing cloud-init integration to automate this deployment, but we re not at a point where this can be used.
It's something I want to look at next year in more detail.
Cheers,
Franco
Logged
jinxray
Newbie
Posts: 10
Karma: 0
Re: "Automatically configure interfaces on boot"
«
Reply #2 on:
July 31, 2024, 10:16:04 am »
Hey franco
Is anything changed? Currently facing problem when interfaces getting default addresses in cloud environment and I lose connectivity to virtual machine even through COM console. Downloaded freebsd with cloud-init image and installed with opnsense, but looks like cloud-init cant fetch data from cloud platform. Before opnsense installation, on clear freebsd, metadata fetches. Is there a functionality to autoconfigure interface ips with cloud-init?
Logged
franco
Administrator
Hero Member
Posts: 17668
Karma: 1611
Re: "Automatically configure interfaces on boot"
«
Reply #3 on:
July 31, 2024, 10:20:48 am »
You seem to be missing a lock on your interfaces. If the cloud instance changes interface names or removes an existing one the system will reset because it thinks the hardware was changed. That's also how the factory reset / default install and recovery works.
There is FreeBSD support now for cloud-init, but not for OPNsense.
Cheers,
Franco
Logged
Patrick M. Hausen
Hero Member
Posts: 6841
Karma: 574
Re: "Automatically configure interfaces on boot"
«
Reply #4 on:
July 31, 2024, 10:31:40 am »
I have run FreeBSD VMs in clouds that recommended cloud-init without using that. You need a configuration that sets the right external interface to DHCP and has some static user to log in. Works with Digitalocean and Vultr at least. cloud-init is just a way of automatically configuring these things.
For that you need to know the device name of the interface beforehand and configure OPNsense accordingly. It's probably vtnet0.
You can do this by removing the "reboot" command at the end from opnsense-bootstrap.sh before starting it in your local VM. Then change /usr/local/etc/config.xml to match the virtual hardware of your cloud provider.
You might want to look here for ideas about what can be done and how:
https://github.com/punktDe/vagrant-opnsense
Read the "Vagrantfile" - all manipulations of config.xml are done in simple shell commands in the provisioner. You do not need to use Vagrant. Although you might want to once you got a first successful deployment to automate the process for the future.
HTH,
Patrick
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do.
(Isaac Asimov)
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
General Discussion
»
"Automatically configure interfaces on boot"