You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

*Persistent* IP Forwarding w/o NAT - how?

Running on High Sierra on a mac mini. Need to enable IP forwarding without NAT. Lost a disk, had to reinstall and reconfigure. All is working well. Have been using the following command with success -- until a reboot:


sysctl -w net.inet.ip.forwarding = 1


NOTE: once this is issued all other networking is correct and functioning as we intend.


QUESTION -- how can I make that command persistent, e.g. able to reissue after every reboot?

Previously we had an entry in /etc/sysctl.conf -- which no longer exists.


If anyone is able to tell me, and can point to any files that need to be edited, I would greatly appreciate the help. Understand that editing /etc/pf.conf may help but also understand that any software upgrade may overwrite. Please advise.


Thanks in advance for the help! Gary

Mac mini 2018 or later

Posted on Jan 6, 2021 10:47 AM

Reply

Similar questions

7 replies

Jan 14, 2021 9:44 AM in response to pacific123

May not be bash for you, but zsh...


Officially none of these. The Apple suggested way is to use launchd. Guis to set this up include lingon and Launch Control

As for the files you mention the ones in the home directory ~/.bashrc, ~/profile, ~/.bash_profile are only started when you login via a terminal. The ones in /etc are run by the shell starting for all users before the ones in home directory but only when a user login is made.. bash manual

The Unix startup script involved /etc/rc* but for OSX just use the launchd stuff


http://superuser.com/questions/229773/run-command-on-startup-login-mac-os-x#:~:text=To%20run%20a%20command%20on,you%20need%20to%20use%20launchd%20.&text=This%20will%20cause%20launchd%20to,it%20will%20be%20re-started.



Jan 14, 2021 8:19 AM in response to BobHarris

Thanks but that file *does not* exist any longer. Have also checked 4 other mac minis running various mac OS versions and none show that file in /etc.


Are you suggesting that we just create it with a single command?


FWIW - the man page suggests that file gets executed when the system goes into multi-user mode -- but it does that now - and without that file.


Any other suggestions? Can that command be added to pf.conf (the packet filtering configuration file)?


Again, any input or assistance is really appreciated. Gary


Jan 14, 2021 4:06 PM in response to BobHarris

Thank you! That solved the issue.


For others that need assistance, this is what I did:


-- created a sysctl.conf file in /etc

-- added a single line (with comments to myself) that reads:


net.inet.ip.forwarding=1


-- rebooted my system

-- confirmed that I can reach all the destinations I need to reach


Thank you again -- this has been *extremely* helpful!


*Persistent* IP Forwarding w/o NAT - how?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.