Sysctl has to be run manually? (Solved) thanks to ClaW

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

Sysctl has to be run manually? (Solved) thanks to ClaW

Postby gorade on Sun Apr 03, 2011 2:50 am

Wanted to turn of answering PING permanently so I added the line
Code: Select all
net.ipv4.icmp_echo_ignore_all = 1
to /etc/sysctl.conf.
However that didn't help. After reboot PING were still answered until I manually ran sysctl -p

Code: Select all
gorade@hippocampus:~$ sudo sysctl -p
[sudo] password for gorade:
vm.swappiness = 10
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv6.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv6.conf.all.accept_source_route = 0
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_echo_ignore_all = 1
gorade@hippocampus:~$


Thus it seems like sysctl isn't run automatically. What should I do?
Last edited by gorade on Sun Apr 03, 2011 1:16 pm, edited 1 time in total.
User avatar
gorade
Level 1
Level 1
 
Posts: 42
Joined: Sat Feb 07, 2009 3:53 pm

Linux Mint is funded by ads and donations.
 

Re: Sysctl has to be run manually?

Postby CiaW on Sun Apr 03, 2011 11:52 am

Edit: My original reply is below, but reading further in the 2nd link I provided, it appears there's an exception because Debian doesn't use /etc/rc.local ? (But the file is there, not sure why?) So section 11.6 on this link discusses startup scripts in Debian: http://www.debian.org/doc/FAQ/ch-customizing.en.html

You could add the command to /etc/rc.local ? I had to do that with a modprobe command at one time. The instructions say to add it before the exit 0 line. Here's a short thread I found: http://ubuntuforums.org/showthread.php?t=563519 or a little more detailed info here: http://www.linux.com/news/enterprise/sy ... cd-scripts

HTH.
CiaW
Level 3
Level 3
 
Posts: 170
Joined: Fri Sep 10, 2010 11:39 am
Location: Spokane Wash, USA

Re: Sysctl has to be run manually?

Postby gorade on Sun Apr 03, 2011 1:06 pm

Ha! That worked. I edited /etc/rc.local and added the command:
Code: Select all
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

mkdir -p /dev/cgroup/cpu
mount -t cgroup cgroup /dev/cgroup/cpu -o cpu
mkdir -m 0777 /dev/cgroup/cpu/user
echo "/usr/local/sbin/cgroup_clean" > /dev/cgroup/cpu/release_agent
sysctl -p # run sysctl at start up

exit 0


Now no PING is answered. Thank you ClaW!
User avatar
gorade
Level 1
Level 1
 
Posts: 42
Joined: Sat Feb 07, 2009 3:53 pm


Return to Newbie Questions

Who is online

Users browsing this forum: No registered users and 2 guests