# Which file stores the configuration of sysctl -w net.inet.ip.forwarding=1



## TomHsiung (Aug 20, 2018)

Hi, guys

I searched the Internet and found this command to enable the router function of a BSD. But it is an old method. Some threads said the configuration was stored in /etc/sysctl.conf, but I did not find this conf file on my BSD.

Tom


----------



## SirDice (Aug 20, 2018)

Don't set this. Use `gateway_enable="YES"` in rc.conf (it does the exact same thing).


----------



## TomHsiung (Aug 20, 2018)

SirDice said:


> Don't set this


So the reason for this: the function only persists until next reboot?

So we assume that I use sysctl -w net.inet.ip.forwarding=1 method, I have to create /etc/systcl.conf

What is tricky is that the new created systcl.conf file should not only contain configuration for IP forwarding, but also all other system settings? If not so, issue and error occurs?


----------



## SirDice (Aug 20, 2018)

Yes, unless you put it in /etc/sysctl.conf. But like I said, use `gateway_enable` instead.


----------



## ShelLuser (Aug 20, 2018)

TomHsiung said:


> Some threads said the configuration was stored in /etc/sysctl.conf, but I did not find this conf file on my BSD.


Do you even use FreeBSD? I can't help but wonder if you're not using a derivative. Because FreeBSD itself includes a default file in the base system with one option which allows you to hide other uid's.


----------



## Nicola Mingotti (Aug 20, 2018)

You need to read a bit of the wonderful resource we call "FreeBSD Handbook". 

Don't start browsing the internet, start by the Handbook !


----------

