OPNsense Forum

English Forums => General Discussion => Topic started by: Bogotrax on December 29, 2021, 08:55:45 AM

Title: Swap Partition on OPNsense
Post by: Bogotrax on December 29, 2021, 08:55:45 AM
Hello guys,

I want to enable a swap file on my opnsense, since I want to use suricata, which eats all my memory and then deaktivates itself.
The cpu is not an issue as far as I can see but my APU is very low on memory. I know how to use a terminal in ubuntu and how to add a swap file in there, so if there is a decent link with commands that i can follow, i would be able to do it in freeBSD, if there is that option. Altohugh I would prefer the WebGUI, if by any means possible.
If specifying my setup helps, I am glad to do so. Just let me know.

Best,

Bogotrax
Title: Re: Swap Partition on OPNsense
Post by: bartjsmit on December 29, 2021, 09:49:46 AM
Try this: https://www.cyberciti.biz/faq/create-a-freebsd-swap-file/
Title: Re: Swap Partition on OPNsense
Post by: franco on December 29, 2021, 12:11:26 PM
There is a built-in 2G swap file option under System: Settings: Misc. 2G is probably pretty low for what you try to work around, but the real issue is forcing the system (not just Suricata) into swapping mode, which slows it down further.


Cheers,
Franco
Title: Re: Swap Partition on OPNsense
Post by: Bogotrax on December 29, 2021, 12:57:42 PM
Amazing! This is what i was searching for. I don't know what do you mean by forcing, is this also a setting thing? That would be perfect. My problem is not slowing down, but simply suricata deactivates itself. Nothing much i can do i thought, but i think it is a memory issue because the memory level reaching 94 % then suricata is down and memory goes back to 23 percent.
I hope that settles it.
Update: swap is not shown in the dashboard - any idea why?
(https://ibb.co/r4p35Dz)https://ibb.co/r4p35Dz (https://ibb.co/r4p35Dz)
just shortly when I enter dashboard:
(https://ibb.co/vQM2nMr)https://ibb.co/vQM2nMr (https://ibb.co/vQM2nMr)
Also yes, suricata doesn't use the swap - I have the same issue - memory rises - suricata deactivates itself and takes unbound dns with it so i have no internet. Manually activating unbound dns, but after all thats that..
Title: Re: Swap Partition on OPNsense
Post by: franco on December 29, 2021, 01:20:50 PM
Did you reboot?

What I mean by "force" is the system will try to use more swap but more pages in swap means slower system. Suricata (and Unbound) are both resource-hungry in certain configurations, but the actual behaviour in the swap is that ANY service might take up that swap slowing down everything, not just one or two memory-hungry services.


Cheers,
Franco
Title: Re: Swap Partition on OPNsense
Post by: Bogotrax on December 29, 2021, 03:17:23 PM
Oh my god, it works - I am so happy. Thought about buying a "bigger" system the couple last days. You saved my small setup! Thanks a lot franco!