Guest User

Untitled

a guest
May 13th, 2020
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.31 KB | None | 0 0
  1. # Make root file system writable:
  2. mount -o remount,rw /dev/ubi0 /
  3.  
  4. # Install feature rich busybox
  5. curl --insecure https://busybox.net/downloads/binaries/1.31.0-defconfig-multiarch-musl/busybox-armv7l > /bin/busybox-v1.31.0-armv7l
  6. chmod +x /bin/busybox-v1.31.0-armv7l
  7. cd /bin
  8. ln -s busybox-v1.31.0-armv7l sysctl
  9.  
  10. # Create sysctl.conf with modified parameters
  11. cat <<EOF > /etc/sysctl.conf
  12. net.ipv4.ip_local_port_range=15000 64000
  13. net.ipv4.tcp_fin_timeout=30
  14. net.ipv4.tcp_tw_recycle=1
  15. net.ipv4.tcp_tw_reuse=1
  16. net.core.somaxconn=1024
  17. net.netfilter.nf_conntrack_max=30000
  18. EOF
  19.  
  20. # Apply parameters
  21. sysctl -p
  22.  
  23. # Create script to apply parameters on startup
  24. cat <<'EOF' > /etc/init.d/increaselimits.sh
  25. #!/bin/sh
  26.  
  27. case "$1" in
  28.         start)
  29.                 echo "Increasing Connection Limits..."
  30.                 sysctl -p
  31.                 exit 0
  32.                 ;;
  33.         stop)
  34.                 echo "Not implemented..."
  35.                 exit 1
  36.                 ;;
  37.         *)
  38.                 echo "$0: unrecognized option $1"
  39.                 exit 1
  40.                 ;;
  41. esac
  42.  
  43. EOF
  44.  
  45. # Make script executable and create link in /etc/rc3.d
  46. chmod 755 /etc/init.d/increaselimits.sh
  47. cd /etc/rc3.d
  48. ln -s ../init.d/increaselimits.sh S99increaselimits
  49.  
  50. # Make root filesystem read only
  51. mount -o remount,ro /dev/ubi0 /
Add Comment
Please, Sign In to add comment