Solved Values added sysctl.conf but not being set?

I've added the following, to /boot/loader.conf and /etc/sysctl.conf and still these settings are not being set. When I do it from console I can just set them without any errors?

Code:
net.link.bridge.pfil_local_phys=0
net.link.bridge.pfil_member=0
net.link.bridge.pfil_bridge=0
net.link.bridge.pfil_onlyip=0
 
Well even setting them at loader and sysctl and system still manages to set them to 1 instead. That's the reason why I've tried adding them to loader.conf

Also I would suspect only having to set it in sysctl.conf as well, that's why I'm making this topic. Because I'm not sure what it is I'm doing wrong. Since I too would think /etc/sysctl.conf would be enough, asside from there only place I could think of putting the configuration was in /boot/loader.conf. But even there it doesn't matter.

I suspect the bridges being created after sysctl.conf is ran. And so that's probably why the settings aren't applied. But I can't think of a way on how to do it in vm-bhyve to run those sysctls after starting the vm service.

normaly I would use cloned_interfaces but that's not an option with vm-bhyve.
 
I thought it is either or.
Either put setting in Loader.conf or sysctl.conf.
Maybe double loading cancels them out or error out.
I know some sysctls can only be set via loader but we are talking CPU frequency stuff. (dev.cpu.0.freq=600)
 
I previously set it manually so it's now going from 0 to 0

sysctl -f /etc/sysctl.conf | grep pfil
net.link.bridge.pfil_local_phys: 0 -> 0
net.link.bridge.pfil_member: 0 -> 0
net.link.bridge.pfil_bridge: 0 -> 0
net.link.bridge.pfil_onlyip: 0 -> 0
 
[…] still manages to set them to 1 instead. […]
No, that’s the default (with the exception of pfil_local_phys).​
[…] When I do it from console I can just set them without any errors?
sysctl.conf(5) documents a bug (in § BUGS):​
If loadable kernel modules are used to introduce additional kernel functionality and sysctls to manage that functionality, sysctl.conf may be processed too early in the boot process to set those sysctls.
Since you (unwittingly) load bridge(4) ( kldload if_bridge) your system is unable to set the related sysctls at boottime, but shortly thereafter it works just fine. I bet dmesg(8) ‑a will show some “unknown OID” errors.​
 
Last edited:
Sound like another job for rc.d's netwait if that turns out to be the problem.
Add delay to allow bridge to come up since sysctl.conf is not processed early but late in boot process.
 
a bridge interface needs to exist of existed before the sysctls for bridges become available.

Code:
# sysctl net.link.bridge
sysctl: unknown oid 'net.link.bridge'
# ifconfig bridge create
bridge0
# ifconfig bridge0 destroy
# sysctl net.link.bridge
net.link.bridge.ipfw: 0
net.link.bridge.allow_llz_overlap: 0
net.link.bridge.inherit_mac: 0
net.link.bridge.log_stp: 0
net.link.bridge.pfil_local_phys: 0
net.link.bridge.pfil_member: 1
net.link.bridge.ipfw_arp: 0
net.link.bridge.pfil_bridge: 1
net.link.bridge.pfil_onlyip: 1

this can probably be fixed by adding


Code:
if_bridge_load="yes"
bridgestp_load="yes"

after adding the above to bootloader result rebooting

Code:
# sysctl net.link.bridge
net.link.bridge.ipfw: 0
net.link.bridge.allow_llz_overlap: 0
net.link.bridge.inherit_mac: 0
net.link.bridge.log_stp: 0
net.link.bridge.pfil_local_phys: 0
net.link.bridge.pfil_member: 0
net.link.bridge.ipfw_arp: 0
net.link.bridge.pfil_bridge: 0
net.link.bridge.pfil_onlyip: 0
 
after adding this to /boot/loader.conf it was fixed, now it's obvious if the interfaces don't exist on the sysctl is being set it's obvious that it can't set these settings.

Code:
if_bridge_load="yes"
bridgestp_load="yes"
 
Back
Top