Increase default storage size of lxd container
lxc storage set default volume.size 20GB
lxc storage set default volume.size 20GB
Check open files limit for the process named redis:
cat /proc/$(ps aux | grep redis | head -n 1 | kazy -x -r "\d+")/limits | kazy -i "open files" -i Limit
Check current number of open files for the process named redis:
sudo ls -l /proc/$(ps aux | grep redis | head -n 1 | kazy -x -r "\d+")/fd | wc -l
Print system limits:
14:53 $ ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 514130
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 514130
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
Print just open files limit
16:52 $ ulimit -Sn
1024
Get number of open files for a specific process:
# Get process id
16:56 $ ps aux | grep wshub
cobro 3200102 2.0 0.0 3676920 86488 ? Ssl 16:12 0:54 /opt/cobro/src/wshub/wshub -port 8015 -redis 127.0.0.1:6379 -auxport 8016
client 3212070 0.0 0.0 12132 1160 pts/0 S+ 16:57 0:00 grep --color=auto wshub
# Check current limits for the process
16:57 $ cat /proc/3200102/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size unlimited unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 514130 514130 processes
Max open files 1024 262144 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 514130 514130 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
# Print number of open files for the process
17:03 $ sudo ls -l /proc/3200102/fd | wc -l
157
Systemd needs this limit specified per service (otherwise it will be 1024):
[Service]
LimitNOFILE=2048
Lets say there is this error when using rootless containers with podman:
Error: rootlessport cannot expose privileged port 80, you can add 'net.ipv4.ip_unprivileged_port_start=80' to /etc/sysctl.conf (currently 1024), or choose a larger port number (>= 1024): listen tcp 0.0.0.0:80: bind: permission denied
To solve this problem, the value of net.ipv4.ip_unprivileged_port_start
needs to be changed
Print current value:
sudo sysctl net.ipv4.ip_unprivileged_port_start
Print all configuration:
sudo sysctl -a
Temporarily change the value:
sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80
To permanently modify the value, create a new file in /etc/sysctl.d
. To apply changes, either reboot or execute sudo sysctl -p /etc/sysctl.d/99-custom.conf
Service from Constellix: DNS Propagation
ansible-playbook my.yml -i 162.55.82.217, -e "ansible_user=root"
The trick is to add ,
after the IP address
ssh -L <LOCAL_PORT>:127.0.0.1:<REMOTE_PORT> remote_server
TCP connections to <LOCAL_PORT>
will be forwarded to 127.0.0.1:<REMOTE_PORT>
on remote host remote_server
Main article is provided by Hetzner team here. This article contains instructions for creating vlan
interface in Centos 8 using nmcli
.
Assumptions (same us in the main article + listed below):
4001
enp195s0
Steps:
nmcli connection add type vlan con-name vlan4001 ifname vlan4001 vlan.parent enp195s0 vlan.id 4001
nmcli connection modify vlan4001 802-3-ethernet.mtu 1400
nmcli connection modify vlan4001 ipv4.addresses '10.0.1.2/24'
nmcli connection modify vlan4001 ipv4.gateway '10.0.1.1'
nmcli connection modify vlan4001 ipv4.dns '10.0.0.4' # (optional)
nmcli connection modify vlan4001 ipv4.method manual
nmcli connection modify vlan4001 +ipv4.routes "10.0.0.0/16 10.0.1.1"
nmcli connection down vlan4001
nmcli connection up vlan4001
# Prints what gateway is used to reach the ip
ip route get 10.0.0.5
# Print all connection information
nmcli connection show vlan4001
# Print routing table
ip r
# Use tui interface for NetworkManager
dnf install NetworkManager-tui
nmtui
Restarting NetworkManager wasn’t enough to apply custom routes. Bring interface up and down
And the link to the great RedHat documentation
Listen on specified port:
nc -l -v -k 8888
Connect via netcat:
nc -v google.com 80
journalctl -n 1000 | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" | sort | uniq -c