Menu

Forward remote port to a local one via SSH tunnel

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

· 25 May 2021

Connect dedicated servers with cloud servers in hetzner via vSwitch

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):

  • VLAN ID is 4001
  • parent network interface is enp195s0

Steps:

  1. Create new connection:
nmcli connection add type vlan con-name vlan4001 ifname vlan4001 vlan.parent enp195s0 vlan.id 4001
  1. Configure the connection:
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"
  1. Restart the connection
nmcli connection down vlan4001
nmcli connection up vlan4001
  1. Verify configuration
# 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

· 15 May 2021

netcat example

Listen on specified port:

nc -l -v -k 8888

Connect via netcat:

nc -v google.com 80
· 29 Mar 2021

Extract and count IP addresses from logs

journalctl -n 1000 | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" | sort | uniq -c
· 29 Mar 2021

Print dnsmasq statistic to journalctl

sudo pkill -USR1 dnsmasq
· 29 Mar 2021

Print repository usage

Print how many packages are installed per repository:

sudo dnf list --installed | grep -E -o "@.*" | sort | uniq -c
· 29 Mar 2021

Rose frame colour

Matching nail polisher colour for Rose Pro SL Disc (red) is Rimmel A Spritzzz (714)

· 6 Mar 2021

Remove host entry from known_hosts file

To remove a host entry from ~/.ssh/known_hosts you can do it manually by editing the file or use ssh-keygen application:

ssh-keygen -R 135.181.157.20

This should fix Host key verification failed error

· 4 Mar 2021

Clear file from leading new line and etc

cat file | tr -d [$'\t\r\n'] > new_file
· 26 Feb 2021

Intel i5-10400 CPU benchmark

CPU benchmark from desktop PC

$ sysbench cpu run --time=5
sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)

Running the test with following options:
Number of threads: 1
Initializing random number generator from current time


Prime numbers limit: 10000

Initializing worker threads...

Threads started!

CPU speed:
    events per second:  1389.45

General statistics:
    total time:                          5.0001s
    total number of events:              6949

Latency (ms):
         min:                                    0.70
         avg:                                    0.72
         max:                                    1.04
         95th percentile:                        0.75

Threads fairness:
    events (avg/stddev):           6949.0000/0.00
    execution time (avg/stddev):   4.9991/0.00
· 22 Feb 2021