Home
Help
Search
Login
Register
OPNsense Forum
»
Archive
»
18.1 Legacy Series
»
Run custom script on bootup (add static ARP) [resolved]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Run custom script on bootup (add static ARP) [resolved] (Read 6228 times)
namezero111111
Jr. Member
Posts: 94
Karma: 10
Run custom script on bootup (add static ARP) [resolved]
«
on:
March 19, 2018, 01:20:48 pm »
Hi folks,
we are trying to run a custom script on bootup. I found a thread about this from 2015 (
https://forum.opnsense.org/index.php?topic=274.0
), is there a better (more friendly way by now).
We are trying to make a permanent ARP entry that survives a reboot:
Quote
arp -S 172.16.16.9 11:54:33:A8:B2:6B
I found a way via creating /usr/local/etc/rc.syshook.d/95-staticarp.start (chmod 755) and adding the desired command.
However, this does not survive a link cycle...
Maybe there is a nicer way to do this in the first place that we are simply not aware of??
EDIT
It seems like adding a static ARP on DHCP works; is this ok even if DHCP server is disabled?
«
Last Edit: March 20, 2018, 05:31:38 pm by namezero111111
»
Logged
franco
Administrator
Hero Member
Posts: 17660
Karma: 1611
Re: Run custom script on bootup (add static ARP)
«
Reply #1 on:
March 20, 2018, 07:16:46 am »
/usr/local/etc/rc.syshook.d/95-staticarp.start is correct and it *must* survive a reboot or something else is undoing your modification later.
Unsure about static ARP without DHCP. My guess would be no.
Cheers,
Franco
Logged
namezero111111
Jr. Member
Posts: 94
Karma: 10
Re: Run custom script on bootup (add static ARP)
«
Reply #2 on:
March 20, 2018, 07:59:02 am »
Thank you, yes it does survive a reboot (empirically determined), but not a link cycle.
Adding a static arp on DHCP survives both, even with DHCP disabled; but I wasn't sure if that's a feature supposed to be used this way.
Logged
franco
Administrator
Hero Member
Posts: 17660
Karma: 1611
Re: Run custom script on bootup (add static ARP)
«
Reply #3 on:
March 20, 2018, 08:03:09 am »
Ah, you're right about the link cycle.
But regarding DHCP static entries: if it works why not
Cheers,
Franco
Logged
namezero111111
Jr. Member
Posts: 94
Karma: 10
Re: Run custom script on bootup (add static ARP)
«
Reply #4 on:
March 20, 2018, 08:04:36 am »
Using this for now; just wanted to see if this is designed like that so it won't just stop working one day without warning on a minor update :}
Was just curious what other scripts the DHCP option finagles with to make the link cycle work.
Will investigate this!
Thanks!
Logged
franco
Administrator
Hero Member
Posts: 17660
Karma: 1611
Re: Run custom script on bootup (add static ARP)
«
Reply #5 on:
March 20, 2018, 08:07:19 am »
Ok, consider this a feature and defend it in case that would happen to stop working. But I doubt DHCP will receive a rework where this could potentially happen.
Thank you,
Franco
Logged
namezero111111
Jr. Member
Posts: 94
Karma: 10
Re: Run custom script on bootup (add static ARP)
«
Reply #6 on:
March 20, 2018, 05:31:22 pm »
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.
Logged
franco
Administrator
Hero Member
Posts: 17660
Karma: 1611
Re: Run custom script on bootup (add static ARP) [resolved]
«
Reply #7 on:
March 20, 2018, 07:41:16 pm »
Hi there,
Thanks for the analysis. I concur.
Does enabling the DHCP seem to be required though? Looking at interfaces_staticarp_configure() it doesn't seem to even check the service, only the interface enable itself.
Cheers,
Franco
Logged
namezero111111
Jr. Member
Posts: 94
Karma: 10
Re: Run custom script on bootup (add static ARP) [resolved]
«
Reply #8 on:
March 20, 2018, 09:02:52 pm »
Hi,
it seemed as though once the entry is there DHCP can be disabled. If it is not enabled at least once through, the ARP entry never appears.
I never investigated further why, but decided on the above solution since it seemed more resistant to possible changes through updates !
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
Archive
»
18.1 Legacy Series
»
Run custom script on bootup (add static ARP) [resolved]