Etc Linux

old nic names in CentOS 7
# add net.ifnames=0 biosdevname=0 to grub
vi /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet net.ifnames=0 biosdevname=0"

# check config
grub2-mkconfig

# save config
grub2-mkconfig -o /boot/grub2/grub.cfg

# then rename your configs in /etc/sysconfig/network-scripts
# and fix DEVICE="eth0"
swap in file
sudo su

fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile swap swap  sw 0 0" >> /etc/fstab

# less swapiness
sysctl vm.swappiness=10
echo "vm.swappiness = 10" >> /etc/sysctl.conf

# more inode cache
sysctl vm.vfs_cache_pressure=50
echo "vm.vfs_cache_pressure = 50" >> /etc/sysctl.conf
instant reboot and shutdown
# fast reboot
echo 1 > /proc/sys/kernel/sysrq 
echo b > /proc/sysrq-trigger

# fast shutdown
echo 1 > /proc/sys/kernel/sysrq 
echo o > /proc/sysrq-trigger
search routers in net
tcpdump -vvnn -i eth1 'src net 172.16.0.0/16 and ip[7:2] != 128 and ip[7:2] != 64'
gateway troubleshooting
netstat-nat -Nn

conntrack -L |awk '{if ($5 ~ /src/) print $5; else if ($4 ~ /src/) print $4}' | sed "s/src=/ /g" | sort | uniq -c | sort -n | tail -n15

sysctl tweaks
# network
net.core.rmem_max=67108864
net.core.wmem_max=67108864
net.ipv4.tcp_rmem=4096 87380 33554432
net.ipv4.tcp_wmem=4096 65536 33554432
net.core.netdev_max_backlog=30000
net.ipv4.tcp_congestion_control=htcp
net.ipv4.ip_local_port_range=1024 65000
net.core.somaxconn=256

# netfilter
net.netfilter.nf_conntrack_tcp_timeout_established=86400
net.netfilter.nf_conntrack_max=1548576
net.nf_conntrack_max=1548576

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536

# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296
Filesystem ACLs
# allow user apetrov read all files and X all dirs
setfacl -R -m d:u:apetrov:rwX,u:apetrov:rwX folder

# addе +x for user http
setfacl -m "u:http:--x" /data/dir

# copy acls
getfacl basefile | setfacl -b -M - targetfile

# delete all acls
setfacl -Rb /home/dir