Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Scientific Linux 6.1 and would like to set net.ipv4.tcp_syncookies=1. I've set that in /etc/sysctl.conf and, if I do a sysctl -p then sysctl -q net.ipv4.tcp_syncookies it shows it's properly set. Sadly, if I reboot the machine, and sysctl -q again, it goes back to 0.

I've tried to grep around and see if something else is resetting it to 0 during the boot process but haven't turned up anything.

I've googled and everything points to sysctl.conf.

The only thing I can think of is maybe networking isn't up by the time that file gets read but, honestly, I'm a developer and well beyond my natural skills here:) I'm tempted to just set it directly in /etc/init.d/network but then that feels hackish and so, I thought better of it and I'm here in search of the "right" way to do it. Any pointers?

share|improve this question
sysctl.conf is the right place to set this, and this works as expected on my CentOS 6 system. Are the other values specified in sysctl.conf being set? It seems that this is done by apply_sysctl() in /etc/init.d/network, so the only other thing I can think of is that this isn't being run for some reason. – mgorven Jun 20 '12 at 6:11

You could just put this code in your /etc/rc.local file:

check_syn_cookie=`grep -r net.ipv4.tcp_syncookies /etc/sysctl.conf | grep -v ^#`
[ "$check_syn_cookie" = "" ] && echo "net.ipv4.tcp_syncookies = 1" >> /etc/sysctl.conf
sysctl -p

But please make sure that it goes before any exit statements. It should force your net.ipv4.tcp_syncookies to be 1 at startup.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.