Update debian.sh

This commit is contained in:
Xiufeng Guo 2024-10-31 02:28:17 +09:00
parent 9aa71ea724
commit 7e3465269d
Signed by: showfom
GPG Key ID: 29A7777777777777

View File

@ -287,8 +287,13 @@ function custom_sysctl() {
printf "\E[0;35;40m" printf "\E[0;35;40m"
echo '### Custom sysctl.conf ###' echo '### Custom sysctl.conf ###'
printf "\E[0m" printf "\E[0m"
# Backup sysctl.conf
if [ -f /etc/sysctl.conf ]; then
cp -r /etc/sysctl.conf /etc/sysctl.conf.$(date +"%Y_%m_%d_%I_%M_%p").bak cp -r /etc/sysctl.conf /etc/sysctl.conf.$(date +"%Y_%m_%d_%I_%M_%p").bak
cat /dev/null > /etc/sysctl.conf cat /dev/null > /etc/sysctl.conf
fi
cat > /etc/sysctl.d/local.conf << EOF cat > /etc/sysctl.d/local.conf << EOF
net.ipv4.ip_forward = 1 net.ipv4.ip_forward = 1
net.ipv4.conf.all.proxy_arp = 0 net.ipv4.conf.all.proxy_arp = 0
@ -330,7 +335,9 @@ net.ipv4.ipfrag_high_thresh = 4194304
net.ipv4.ipfrag_low_thresh = 3145728 net.ipv4.ipfrag_low_thresh = 3145728
net.ipv4.ping_group_range = 0 2147483647 net.ipv4.ping_group_range = 0 2147483647
EOF EOF
sysctl -p sysctl -p
printf "\E[0;33;40m" printf "\E[0;33;40m"
echo "### Custom sysctl.conf added ###" echo "### Custom sysctl.conf added ###"
printf "\E[0m" printf "\E[0m"