Page 1 of 1

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

Posted: Sun Apr 03, 2011 2:50 am
by gorade
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?

Re: Sysctl has to be run manually?

Posted: Sun Apr 03, 2011 11:52 am
by CiaW
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.

Re: Sysctl has to be run manually?

Posted: Sun Apr 03, 2011 1:06 pm
by gorade
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!