Home
Help
Search
Login
Register
OPNsense Forum
»
Archive
»
21.1 Legacy Series
»
How to create a new service that starts automatically in OpnSense?
« previous
next »
Print
Pages: [
1
]
Author
Topic: How to create a new service that starts automatically in OpnSense? (Read 4615 times)
allebone
Sr. Member
Posts: 402
Karma: 34
How to create a new service that starts automatically in OpnSense?
«
on:
March 03, 2021, 08:56:38 pm »
Hi All,
I have a couple static arp entries set in /etc/rc.conf.
I can once the server is up start the service by typing 'service static_arp start' and the entries get added to OpnSense.
How can I make this service start on boot, and/or appear in the services in the GUI? I tried service static_arp enable but it didnt help.
Is there a way to make this automatic?
Kind regards
Peter
Logged
Greelan
Hero Member
Posts: 1028
Karma: 72
Re: How to create a new service that starts automatically in OpnSense?
«
Reply #1 on:
March 03, 2021, 09:25:28 pm »
https://docs.opnsense.org/development/backend/autorun.html
Logged
allebone
Sr. Member
Posts: 402
Karma: 34
Re: How to create a new service that starts automatically in OpnSense?
«
Reply #2 on:
March 03, 2021, 09:44:18 pm »
Thank you for posting this but I could not get it to work.
I created a file:
nano /usr/local/etc/rc.syshook.d/start/96-arpstartpete
I then chmod +x this file.
Inside file contains:
#!/bin/sh
service static_arp start
However when rebooting service does not start.
What have I done wrong?
Pete
Logged
Greelan
Hero Member
Posts: 1028
Karma: 72
Re: How to create a new service that starts automatically in OpnSense?
«
Reply #3 on:
March 03, 2021, 10:39:16 pm »
What if you call static_arp directly like the example in the docs?
Logged
allebone
Sr. Member
Posts: 402
Karma: 34
Re: How to create a new service that starts automatically in OpnSense?
«
Reply #4 on:
March 04, 2021, 01:24:52 am »
I cannot work out how to do this. I have tried but cant find where to run it from or how/what to do.
Pete
Logged
Greelan
Hero Member
Posts: 1028
Karma: 72
Re: How to create a new service that starts automatically in OpnSense?
«
Reply #5 on:
March 04, 2021, 01:53:35 am »
Maybe you need to put in your script:
Code:
[Select]
/etc/rc.d/static_arp start
Logged
allebone
Sr. Member
Posts: 402
Karma: 34
Re: How to create a new service that starts automatically in OpnSense?
«
Reply #6 on:
March 04, 2021, 05:00:12 am »
I tried but it would not work no matter what I did. I have followed instructions perfectly so cannot find a reason.
However I did find this instead which resolves the issue from:
https://forum.opnsense.org/index.php?topic=7641.0
"Well, the best way is through the DHCP after some further testing, because in rc.linkup there is a call to interfaces_staticarp_configure().
The DHCP can be "dummy-disabled" in this case with the following config:
Enable DHCP server on the LAN interface = true
Deny unknown clients = true
Range = Single IP in interface subnet (will not be used)
Note that Static ARP must not be true (checked)
Then, under DHCP Static Mappings for this interface. configure the static ARP entries.
The dummy range IP will never be used because the multicast MACs won't send DHCP requests and everyone else will be denied.
A bit hackish but should also survive upgrades."
Indeed this does work and reboot preserves the arp entry I am trying to make so it fixes it for me.
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
Archive
»
21.1 Legacy Series
»
How to create a new service that starts automatically in OpnSense?