LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-08-2008, 08:57 AM   #1
mokku
Member
 
Registered: Feb 2007
Posts: 197

Rep: Reputation: 30
sysctl.conf question


Hi,

if I modify sysctl.conf file, do I need to restart the box? How does it geet affected? Thanks in advance
 
Old 05-08-2008, 09:34 AM   #2
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
You must restart your network with something like
Code:
 /etc/rc.d/init.d/network restart
or just reboot.
It will be affected so that whatever you have changed will be loaded on boot.
Please,edit your profile so that we can know what distro you are using,I belive it's Red hat or Fedora,so I based my answer on that.
 
Old 05-08-2008, 10:31 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by alan_ri View Post
You must restart your network (..) or just reboot.
No you don't. Sysctls are dynamic so running 'sysctl -p' (takes /etc/sysctl.conf as default or supply filename) will do fine. And you can check that by running 'sysctl some.value' or catting it. Sysctls are strictly kernel so the GNU/Linux distro used doesn't matter for answering this particular question.
 
Old 05-08-2008, 02:20 PM   #4
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
Quote:
Originally Posted by unSpawn View Post
No you don't.
Yes you do,try to change packet forwarding from disabled to enabled,it want work if you don't restart network or system(at least not on distros that I have tried to do it).Besides some sysctl variables can not be changed after reboot.
Quote:
Originally Posted by unSpawn View Post
Sysctls are dynamic so running 'sysctl -p' (takes /etc/sysctl.conf as default or supply filename) will do fine.
Maybe it will,but will not always take affect instantly.
Quote:
Originally Posted by unSpawn View Post
Sysctls are strictly kernel so the GNU/Linux distro used doesn't matter for answering this particular question.
Yes it does,in a matter of how one want to change something,for example the command I have provided in my first post works for some distros(if one wants to change network parameters without rebooting),and some distros don't even change some parameters with sysctl.conf,for example in an old Red hat that I have,packet forwarding one must change in /etc/sysconfig/network,and if OP is using BSD then read this from Wikipedia;
Quote:
In most systems, the command sysctl -w parameter=1 will enable the desired behavior. This will persist until the next reboot. If the behavior should be enabled whenever the system boots, the line parameter=1 can be added to the file /etc/sysctl.conf. Additionally, some sysctl variables cannot be modified after the system is booted, these variables (depending on the variable and the version and flavor of BSD) need to either be set statically in the kernel at compile time or set in /boot/loader.conf.
 
Old 05-08-2008, 07:23 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by alan_ri View Post
Yes you do, try to change packet forwarding from disabled to enabled, it wont work if you don't restart network or system
Could that perhaps be due to Something Completely Different? Like say routing and firewalling?


Quote:
Originally Posted by alan_ri View Post
Besides some sysctl variables can not be changed after reboot.
AFAIK there are only three types of sysctls that can't be changed: those set by the kernel directly (like random.boot_id, random.uuid), those that only display device info (like cdrom.info) and those that are related to LSM users (like GRSecurity). AFAIK they can't be set or changed, and regardless when (the exception being sealing GRSecurity at boot), so the argument of using 'sysctl' on unchangable sysctls doesn't compute anyway, does it?


Quote:
Originally Posted by alan_ri View Post
Maybe it will, but will not always take affect instantly.
Only example I can think of is the routing cache for which you need to write to the "flush" sysctl, but maybe you have a better example?


Quote:
Originally Posted by alan_ri View Post
Yes it does, in a matter of how one want to change something. For example the command I have provided in my first post works for some distros (if one wants to change network parameters without rebooting), and
If you look under the hood you see /etc/rc.d/init.d/network uses 'sysctl' to set those variables. So wouldn't you say it's simpler to call 'sysctl -p' directly and achieve setting sysctls?


Quote:
Originally Posted by alan_ri View Post
some distros don't even change some parameters with sysctl.conf. For example in an old Red hat that I have, packet forwarding one must change in /etc/sysconfig/network.
/etc/sysconfig/network is just a configuration file. What distro-agnostic utility do you think picks up those variables to set them?


Quote:
Originally Posted by alan_ri View Post
and if OP is using BSD then
No, this is Linux Newbie. BSD questions go in the Other *NIX forum :-]
 
Old 05-09-2008, 12:49 PM   #6
alan_ri
Senior Member
 
Registered: Dec 2007
Location: Croatia
Distribution: Debian GNU/Linux
Posts: 1,733
Blog Entries: 5

Rep: Reputation: 127Reputation: 127
Quote:
Originally Posted by unSpawn View Post
Could that perhaps be due to Something Completely Different? Like say routing and firewalling?
No.

Quote:
Originally Posted by unSpawn View Post
No, this is Linux Newbie. BSD questions go in the Other *NIX forum :-]
Well,you just can't be sure,right?

For the rest of this little discussion,I will just say,you're right and I'm right and since OP is not posting anything anymore I will leave it on that.

Last edited by alan_ri; 05-09-2008 at 01:06 PM. Reason: grammar
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/etc/Sysctl.conf really I need it? Beised Linux - Software 2 08-25-2004 08:36 AM
sysctl.conf resets itself? JohnLocke Linux - Newbie 1 07-14-2004 10:24 PM
/etc/sysctl.conf ??? biscristi Linux - Software 0 06-03-2004 09:50 AM
sysctl.conf nocturnal *BSD 4 12-11-2003 06:43 PM
help! the /etc/sysctl.conf darkstarreddiam Linux - Networking 2 05-08-2003 09:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration