how to modify /etc/sysctl.conf on boot


wgstarks

Recommended Posts

No need, the command just tells sysctl to modify the settings from your new config file, while the normal bootup scripts would have already used the standard config file to set up much earlier on in the boot up process.

 

you could actually just invoke

sysctl -w setting=value

multiple times in the go file, but this way there will be just one other file to maintain for tweaks later on

Edited by ken-ji
Link to comment
6 minutes ago, ken-ji said:

No need, the command just tells sysctl to modify the settings from your new config file, while the normal bootup scripts would have already used the standard config file to set up much earlier on in the boot up process.

 

you could actually just invoke sysctl -a setting=value multiple times in the go file, but this way there will be just one other file to maintain for tweaks later on

I’ll give that a try. Thanks

Link to comment
6 minutes ago, wgstarks said:

To be clear, the changes are being written to etc/sysctl.conf but aren’t being implemented.


net.core.somaxconn = 128

This should be 2048.

Well /etc/systcl.conf is just a config file. Changing the contents won't do anything unless sysctl is called again referencing the the conf file

But, the sysctl call that does that happens so much earlier in the boot process, so modifying sysctl.conf doesn't help at all.

 

Link to comment

I'm afraid it didn't work.

 

go file-

#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &
/boot/cache_dirs -w
beep -l 300 -f 220.00 -n -l 300 -f 293.66 -D 100 -n -l 150 -f 220.00 -n -l 150 -f 293.66 -D 100 -n -l 500 -f 349.23 -D 100 -n -l 500 -f 293.66 -D 100 -n -l 300 -f 349.23 -D 100 -n -l 150 -f 293.66 -D 100 -n -l 150 -f 349.23 -D 100 -n -l 500 -f 440.00 -D 100 -n -l 500 -f 349.23 -D 100 -n -l 300 -f 440.00 -D 100 -n -l 150 -f 349.23 -D 100 -n -l 150 -f 440.00 -D 100 -n -l 500 -f 523.25 -D 100 -n -l 500 -f 261.63 -D 100 -n -l 300 -f 349.23 -D 100 -n -l 150 -f 261.63 -D 100 -n -l 150 -f 349.23 -D 100 -n -l 500 -f 440.00 -D 300 -n -l 300 -f 261.63 -n -l 300 -f 349.23 -D 100 -n -l 150 -f 261.63 -n -l 150 -f 349.23 -D 100 -n -l 500 -f 440.00 -D 100 -n -l 500 -f 349.23 -D 100 -n -l 300 -f 440.00 -D 100 -n -l 150 -f 349.23 -D 100 -n -l 150 -f 440.00 -D 100 -n -l 500 -f 523.25 -D 100 -n -l 500 -f 440.00 -D 100 -n -l 300 -f 523.25 -D 100 -n -l 150 -f 440.00 -D 100 -n -l 150 -f 523.25 -D 100 -n -l 500 -f 659.26 -D 100 -n -l 500 -f 329.63 -D 100 -n -l 300 -f 440.00 -D 100 -n -l 150 -f 329.63 -D 100 -n -l 150 -f 440.00 -D 100 -n -l 500 -f 554.00 -D 300 -n -l 300 -f 220.00 -D 100 -n -l 300 -f 233.00 -D 100 -n -l 150 -f 196.00 -D 100 -n -l 300 -f 223.00 -D 100 -n -l 750 -f 293.66 -D 300 -n -l 300 -f 220.00 -D 100 -n -l 300 -f 233.00 -D 100 -n -l 150 -f 196.00 -D 100 -n -l 300 -f 223.00 -D 100 -n -l 750 -f 311.00 -D 100 -n -l 300 -f 293.66 -D 100 -n -l 150 -f 220.00 -D 100 -n -l 150 -f 293.66 -D 100 -n -l 500 -f 349.23 -D 100 -n -l 300 -f 220.00 -D 100 -n -l 300 -f 233.00 -D 100 -n -l 150 -f 196.00 -D 100 -n -l 150 -f 233.00 -D 100 -n -l 500 -f 293.66 -D 300 -n -l 300 -f 220.00 -D 100 -n -l 300 -f 233.00 -D 100 -n -l 150 -f 196.00 -D 100 -n -l 150 -f 233.00 -D 100 -n -l 500 -f 329.63 -D 100 -n -l 300 -f 220.00 -D 100 -n -l 300 -f 220.00 -D 100 -n -l 150 -f 293.66 -D 100 -n -l 150 -f 370.00 -D 100 -n -l 500 -f 440.00 -D 100
# force iptable mangle module to load (required for *vpn dockers)
/sbin/modprobe iptable_mangle
# Enlarge the LOG partition
mount -o remount,size=384m /var/log
#syn flooding changes
/sbin/sysctl -p /boot/scripts/sysctl.conf

 

/boot/scripts/sysctl.conf-

#!/bin/bash
#syn flooding changes
echo "net.core.somaxconn = 2048" >> /etc/sysctl.conf
echo "net.ipv4.tcp_max_syn_backlog = 1024" >> /etc/sysctl.conf

 

When I check the values they are still default. What did I get wrong?

Link to comment

You are mixing between a script file that patches another file compared to having a configuration file that is used as input to /sbin/sysctl

 

Your /boot/scripts/sysctl.conf is written as a shell-script intended to be run directly - not used as parameter to /sbin/sysctl

Problem is that it will then patch a configuration file that the system has already processed - so patching it doesn't help you.

 

To follow up to the suggestions you got earlier:

 

/sbin/sysctl -p /boot/config/sysctl.conf

 

Create a file /boot/config/sysctl.conf

 

Make the contents of the file specify parameters in the format expected by /sbin/sysctl, i.e.

 

net.core.somaxconn = 2048

net.ipv4.tcp_max_syn_backlog = 1024

 

Then modify the go file to call /sbin/sysctl with the above file as parameter

 

/sbin/sysctl -p /boot/config/sysctl.conf

 

The sysctl binary will take care of reading each rule and copy the numbers to the proper locations in the proc file system.

Edited by pwm
  • Like 1
Link to comment

I'm sure this is my fault but still didn't work.

 

go file-

#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &
/boot/cache_dirs -w
beep -l 300 -f 220.00 -n -l 300 -f 293.66 -D 100 -n -l 150 -f 220.00 -n -l 150 -f 293.66 -D 100 -n -l 500 -f 349.23 -D 100 -n -l 500 -f 293.66 -D 100 -n -l 300 -f 349.23 -D 100 -n -l 150 -f 293.66 -D 100 -n -l 150 -f 349.23 -D 100 -n -l 500 -f 440.00 -D 100 -n -l 500 -f 349.23 -D 100 -n -l 300 -f 440.00 -D 100 -n -l 150 -f 349.23 -D 100 -n -l 150 -f 440.00 -D 100 -n -l 500 -f 523.25 -D 100 -n -l 500 -f 261.63 -D 100 -n -l 300 -f 349.23 -D 100 -n -l 150 -f 261.63 -D 100 -n -l 150 -f 349.23 -D 100 -n -l 500 -f 440.00 -D 300 -n -l 300 -f 261.63 -n -l 300 -f 349.23 -D 100 -n -l 150 -f 261.63 -n -l 150 -f 349.23 -D 100 -n -l 500 -f 440.00 -D 100 -n -l 500 -f 349.23 -D 100 -n -l 300 -f 440.00 -D 100 -n -l 150 -f 349.23 -D 100 -n -l 150 -f 440.00 -D 100 -n -l 500 -f 523.25 -D 100 -n -l 500 -f 440.00 -D 100 -n -l 300 -f 523.25 -D 100 -n -l 150 -f 440.00 -D 100 -n -l 150 -f 523.25 -D 100 -n -l 500 -f 659.26 -D 100 -n -l 500 -f 329.63 -D 100 -n -l 300 -f 440.00 -D 100 -n -l 150 -f 329.63 -D 100 -n -l 150 -f 440.00 -D 100 -n -l 500 -f 554.00 -D 300 -n -l 300 -f 220.00 -D 100 -n -l 300 -f 233.00 -D 100 -n -l 150 -f 196.00 -D 100 -n -l 300 -f 223.00 -D 100 -n -l 750 -f 293.66 -D 300 -n -l 300 -f 220.00 -D 100 -n -l 300 -f 233.00 -D 100 -n -l 150 -f 196.00 -D 100 -n -l 300 -f 223.00 -D 100 -n -l 750 -f 311.00 -D 100 -n -l 300 -f 293.66 -D 100 -n -l 150 -f 220.00 -D 100 -n -l 150 -f 293.66 -D 100 -n -l 500 -f 349.23 -D 100 -n -l 300 -f 220.00 -D 100 -n -l 300 -f 233.00 -D 100 -n -l 150 -f 196.00 -D 100 -n -l 150 -f 233.00 -D 100 -n -l 500 -f 293.66 -D 300 -n -l 300 -f 220.00 -D 100 -n -l 300 -f 233.00 -D 100 -n -l 150 -f 196.00 -D 100 -n -l 150 -f 233.00 -D 100 -n -l 500 -f 329.63 -D 100 -n -l 300 -f 220.00 -D 100 -n -l 300 -f 220.00 -D 100 -n -l 150 -f 293.66 -D 100 -n -l 150 -f 370.00 -D 100 -n -l 500 -f 440.00 -D 100
# force iptable mangle module to load (required for *vpn dockers)
/sbin/modprobe iptable_mangle
# Enlarge the LOG partition
mount -o remount,size=384m /var/log
#syn flooding changes
/bin/sysctl -p /boot/scripts/sysctl.conf

 

/boot/scipts/sysctl.conf-

net.core.somaxconn = 2048
net.ipv4.tcp_max_syn_backlog = 1024

 

All values still at default after reboot.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.