Improve sysctl settings
- Fix kernel.shmmax and kernel.shmall on 32-bit Linux. Thanks @komanshidaruma! - Clean up other sysctl settings
This commit is contained in:
parent
68a6375399
commit
05c2cb911b
24
vpnsetup.sh
24
vpnsetup.sh
@ -335,30 +335,32 @@ bigecho "Updating sysctl settings..."
|
||||
|
||||
if ! grep -qs "hwdsl2 VPN script" /etc/sysctl.conf; then
|
||||
conf_bk "/etc/sysctl.conf"
|
||||
if [ "$(getconf LONG_BIT)" = "64" ]; then
|
||||
SHM_MAX=68719476736
|
||||
SHM_ALL=4294967296
|
||||
else
|
||||
SHM_MAX=4294967295
|
||||
SHM_ALL=268435456
|
||||
fi
|
||||
cat >> /etc/sysctl.conf <<EOF
|
||||
|
||||
# Added by hwdsl2 VPN script
|
||||
kernel.msgmnb = 65536
|
||||
kernel.msgmax = 65536
|
||||
kernel.shmmax = 68719476736
|
||||
kernel.shmall = 4294967296
|
||||
kernel.shmmax = $SHM_MAX
|
||||
kernel.shmall = $SHM_ALL
|
||||
|
||||
net.ipv4.ip_forward = 1
|
||||
net.ipv4.tcp_syncookies = 1
|
||||
net.ipv4.conf.all.accept_source_route = 0
|
||||
net.ipv4.conf.default.accept_source_route = 0
|
||||
net.ipv4.conf.all.accept_redirects = 0
|
||||
net.ipv4.conf.default.accept_redirects = 0
|
||||
net.ipv4.conf.all.send_redirects = 0
|
||||
net.ipv4.conf.default.send_redirects = 0
|
||||
net.ipv4.conf.lo.send_redirects = 0
|
||||
net.ipv4.conf.$NET_IFACE.send_redirects = 0
|
||||
net.ipv4.conf.all.rp_filter = 0
|
||||
net.ipv4.conf.default.accept_source_route = 0
|
||||
net.ipv4.conf.default.accept_redirects = 0
|
||||
net.ipv4.conf.default.send_redirects = 0
|
||||
net.ipv4.conf.default.rp_filter = 0
|
||||
net.ipv4.conf.lo.rp_filter = 0
|
||||
net.ipv4.conf.$NET_IFACE.send_redirects = 0
|
||||
net.ipv4.conf.$NET_IFACE.rp_filter = 0
|
||||
net.ipv4.icmp_echo_ignore_broadcasts = 1
|
||||
net.ipv4.icmp_ignore_bogus_error_responses = 1
|
||||
|
||||
net.core.wmem_max = 12582912
|
||||
net.core.rmem_max = 12582912
|
||||
|
@ -321,30 +321,32 @@ bigecho "Updating sysctl settings..."
|
||||
|
||||
if ! grep -qs "hwdsl2 VPN script" /etc/sysctl.conf; then
|
||||
conf_bk "/etc/sysctl.conf"
|
||||
if [ "$(getconf LONG_BIT)" = "64" ]; then
|
||||
SHM_MAX=68719476736
|
||||
SHM_ALL=4294967296
|
||||
else
|
||||
SHM_MAX=4294967295
|
||||
SHM_ALL=268435456
|
||||
fi
|
||||
cat >> /etc/sysctl.conf <<EOF
|
||||
|
||||
# Added by hwdsl2 VPN script
|
||||
kernel.msgmnb = 65536
|
||||
kernel.msgmax = 65536
|
||||
kernel.shmmax = 68719476736
|
||||
kernel.shmall = 4294967296
|
||||
kernel.shmmax = $SHM_MAX
|
||||
kernel.shmall = $SHM_ALL
|
||||
|
||||
net.ipv4.ip_forward = 1
|
||||
net.ipv4.tcp_syncookies = 1
|
||||
net.ipv4.conf.all.accept_source_route = 0
|
||||
net.ipv4.conf.default.accept_source_route = 0
|
||||
net.ipv4.conf.all.accept_redirects = 0
|
||||
net.ipv4.conf.default.accept_redirects = 0
|
||||
net.ipv4.conf.all.send_redirects = 0
|
||||
net.ipv4.conf.default.send_redirects = 0
|
||||
net.ipv4.conf.lo.send_redirects = 0
|
||||
net.ipv4.conf.$NET_IFACE.send_redirects = 0
|
||||
net.ipv4.conf.all.rp_filter = 0
|
||||
net.ipv4.conf.default.accept_source_route = 0
|
||||
net.ipv4.conf.default.accept_redirects = 0
|
||||
net.ipv4.conf.default.send_redirects = 0
|
||||
net.ipv4.conf.default.rp_filter = 0
|
||||
net.ipv4.conf.lo.rp_filter = 0
|
||||
net.ipv4.conf.$NET_IFACE.send_redirects = 0
|
||||
net.ipv4.conf.$NET_IFACE.rp_filter = 0
|
||||
net.ipv4.icmp_echo_ignore_broadcasts = 1
|
||||
net.ipv4.icmp_ignore_bogus_error_responses = 1
|
||||
|
||||
net.core.wmem_max = 12582912
|
||||
net.core.rmem_max = 12582912
|
||||
|
Loading…
Reference in New Issue
Block a user