LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-19-2016, 09:48 PM   #1
LQSlacker
Member
 
Registered: Jul 2016
Posts: 94

Rep: Reputation: Disabled
Strange Behaviour with /etc/sysctl.conf


Does sysctl.conf need a startup option like below for rc.local to work properly?

# Configure runtime kernel parameters:
if [ -x /sbin/sysctl -a -r /etc/sysctl.conf ]; then
/sbin/sysctl -e -p /etc/sysctl.conf
fi

If I don't use the startup in rc.local I do see options being loaded when I restart the computer, but two of my options in the sysctl.conf aren't being loaded, which I don't understand why....

These are the two that don't get loaded unless I use the start option in the rc.local

net.ipv4.conf.all.log_martians
net.ipv4.conf.all.rp_filter

Why is this happening?


These are the options I have in /etc/sysctl.conf

# Debug Crashed Linux Application Core Files
kernel.core_uses_pid = 1
kernel.core_pattern = /tmp/core-%e-%s-%u-%g-%p-%t
fs.suid_dumpable = 2

# kptr_restrict
# This toggle indicates whether restrictions
# are placed on exposing kernel addresses via
# /proc and other interfaces.
kernel.kptr_restrict = 2

# Disable ICMP Redirect Acceptance
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0

# Log suspicious martian packets
net.ipv4.conf.all.log_martians = 1

# reverse path filtering
# check whether a receiving packet source address is routable
# = 1 indicates, that the kernel will do source validation by confirming reverse path
net.ipv4.conf.all.rp_filter = 1

# Disables sending of all IPv4 ICMP redirected packets on all interfaces
net.ipv4.conf.all.send_redirects = 0

# Disables IP source routing
net.ipv4.conf.default.accept_source_route = 0

# Turn off the tcp_timestamps
net.ipv4.tcp_timestamps = 0
 
Old 08-20-2016, 03:42 AM   #2
ml4711
Member
 
Registered: Aug 2012
Location: Ryomgård, Danmark
Distribution: Slackware64
Posts: 146

Rep: Reputation: 103Reputation: 103
sysctl is called from rc.S

But those parameters you mentioned
are not available before the network is up and running.

So it has to be done later.

Se rc.ip_forward as an exsample of how sysctl is called again later.

Cheers
Morten
 
Old 08-20-2016, 05:22 PM   #3
LQSlacker
Member
 
Registered: Jul 2016
Posts: 94

Original Poster
Rep: Reputation: Disabled
I noticed with dhcp client and not using the NetworkManager or wicd this is getting loaded...

I assumed between dhcp client, NetworkManager or wicd, it's all being loaded at the same time the network?


Rather then running the start cmd out of rc.local, which seems redundant to run over what's already loaded, is there a
way to just load which isn't?
 
Old 08-21-2016, 01:44 AM   #4
ml4711
Member
 
Registered: Aug 2012
Location: Ryomgård, Danmark
Distribution: Slackware64
Posts: 146

Rep: Reputation: 103Reputation: 103
Quote:
Rather then running the start cmd out of rc.local, which seems redundant
to run over what's already loaded, is there a way to just load which isn't?
Code:
/sbin/sysctl net.ipv4.conf.all.log_martians=1
/sbin/sysctl net.ipv4.conf.all.rp_filter=1
Obs! no space around "="

Cheers
Morten
 
Old 08-21-2016, 04:32 PM   #5
LQSlacker
Member
 
Registered: Jul 2016
Posts: 94

Original Poster
Rep: Reputation: Disabled
Actually after making my last reply I realized I could do this;

/etc/sysctl.d/network.conf

net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.all.rp_filter = 1


Then in rc.local;

# Start additional kernel parameters
sysctl -p /etc/sysctl.d/network.conf
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 issue varun_saa Mandriva 2 12-05-2005 08:28 PM
/etc/Sysctl.conf really I need it? Beised Linux - Software 2 08-25-2004 08:36 AM
/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 - Distributions > Slackware

All times are GMT -5. The time now is 09:59 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