BGP. Channel Balancing on Quagga

I will give an example of balancing only incoming traffic with two channels using Quagga.

On the test, I will use Ubuntu 16.04.4 LTS and Quagga 0.99.24.1, the network interface ens1f0 for the second provider with one neighbors and ens2f0 for the first provider with two neighbors, the local network will be connected to ens2f1. Both providers announce “default”.
3.3.3.0/23 this will be my network with white IP addresses.
Continue reading BGP. Channel Balancing on Quagga

NetData installation

NetData – monitoring system that displays real-time statistics on web panels.

On the test, I will install NetData on Ubuntu 18.04 and Ubuntu 16.04.
Before installing, you can upgrade the system:

sudo apt-get update
sudo apt-get upgrade

If Ubuntu version is 18.04 and newer, then NetData is installed with the command:

sudo apt-get install netdata

After installation, the configuration will be in /etc/netdata/, the logs in /var/log/netdata/.

On Ubuntu 16.04 and older, you can install as follows (the installation will be done in /opt/netdata/):

sudo bash <(curl -Ss https://my-netdata.io/kickstart-static64.sh)

Restart NetData can command:

sudo systemctl restart netdata

View status:

sudo systemctl status netdata
sudo ps ax | grep netdata

After installing NetData, you can immediately open it in the browser http://HOST:19999
I recommend to immediately restrict access to the tcp port 19999, for example through iptables.

Installing and using mysqltuner.pl

MySQLTuner – This is a Perl script that will give recommendations for improving the performance and stability of the MySQL server.
GitHub Page – https://github.com/major/MySQLTuner-perl

MySQLTuner in Ubuntu can be installed with the command:

sudo apt-get install mysqltuner

In CentOS as follows:

yum install mysqltuner

Continue reading Installing and using mysqltuner.pl

Install Apache JMeter in Ubuntu

Apache JMeter — load testing tool.

For Apache JMeter you need to install Java, see my article – Installing Java on Linux.

For an example I’ll install Apache JMeter in Ubuntu Desktop 18.04.

After Java is installed, copy the link to the archive with the latest version of Apache JMeter from the official site http://jmeter.apache.org/download_jmeter.cgi and download it:

wget http://apache.volia.net//jmeter/binaries/apache-jmeter-4.0.tgz

Extract the archive:

tar -xf apache-jmeter-4.0.tgz

Run:

cd apache-jmeter-4.0/bin/
./jmeter

After the startup, a message was displayed that you can create tests in the Apache JMeter graphical mode, and you can execute them only from the terminal, for example:

jmeter -n -t [jmx file] -l [results file] -e -o [Path to web report folder]

By the way, Apache JMeter in Windows is run through the jmeter.bat file.

Testing network bandwidth with Iperf

Iperf — cross-platform console client-server program – a TCP and UDP traffic generator for testing network bandwidth.

The installation command in Ubuntu:

sudo apt-get install iperf

To display help in the console, type:

iperf --help

Let’s see what version was installed:

iperf -v

To test network bandwidth, the following commands are executed:

On server:

iperf -s -i1

On the client:

iperf -c HOST -t 5

On the client from Windows, you can run the bat file, the pause command will prevent the window from closing:

iperf -c HOST -t 5
pause

You can download the version for Windows on the website iperf.fr
If iperf 2 is installed on the server, then the same is downloaded for Windows. The client of the third version did not connect to the server on the second one.

I’ll describe some startup options:
-i (statistics update interval)
-s (running in server mode)
-c (running in client mode)
-p (manual port specification, standard 5001 TCP)
-D (start the server as a daemon)
-t (test time, standard 10 seconds)

Suppose we run the server as a daemon:

iperf -s -D

Press Ctrl+C to exit, the server will work in the background to complete it, see PID commands and finish:

sudo ps ax | grep iperf
sudo netstat -tulpn | grep :5001
sudo kill -9 PID

See also:
IPTables rules for Iperf

Changing the processor core frequency in Linux

To see the minimum, current and maximum frequency of the processor cores, execute the command:

grep '' /sys/devices/system/cpu/cpu0/cpufreq/scaling_{min,cur,max}_freq

For example, in my case, the following is displayed:

/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq:800000
/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq:907482
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq:4000000

On idle servers, there is probably no point in raising the minimum frequency of the processor cores, but on heavily loaded ones, such as the access server for example, I usually increase, because the processor is constantly loaded, jumping frequencies only hinder and judging by the graphs after the changes, the load on the processor decreases noticeably.

To set the minimum frequency for all processor cores to the same as the maximum, create a script with the code below and execute it:

#!/bin/bash
cpucount=$(grep -c 'model name' /proc/cpuinfo)
sysdir=/sys/devices/system/cpu
for cpu in $(eval echo cpu{0..$((cpucount-1))}); do
        cat $sysdir/$cpu/cpufreq/scaling_max_freq > $sysdir/$cpu/cpufreq/scaling_min_freq
done

Test iops using fio

fio (flexible I/O tester) – a tool that creates write / read streams to evaluate the performance of the file system, so to speak, see the speed in MB / s, IOPS, etc.

Installed in Ubuntu / Debian commands:

sudo apt-get update
sudo apt-get install fio

For systems with a graphical interface, you can install the management utility:

sudo apt-get install gfio

An example of a random write / read test:

fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randrw --rwmixread=75

Random reading test:

fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randread

Test random recording:

fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=test --bs=4k --iodepth=64 --size=4G --readwrite=randwrite

During the test, the test file is created, do not forget to delete it when finished:

rm test

Installing and using ioping

ioping – a simple tool for monitoring disk I/O delays in real time, similar to ping showing network latency.

You can install in Ubuntu / Debian using the command:

sudo apt-get install ioping

Here is an example of a run with 10 requests for a delay test to the / tmp directory:

ioping -c 10 /tmp

An example of a query with an interval of 0.2ms and an increased query size:

ioping -i 0.2 -c 10 -s 1M -S 5M /tmp

Test to disk:

ioping -R /dev/sda
ioping -RL /dev/sda

I’ll describe the possible startup options:
-c count (stop after the specified number of requests)
-w deadline (stop after the specified amount of time)
-p period (display raw statistics after each specified number of requests)
-P period (display raw statistics after each specified number of seconds)
-i interval (the interval between requests in seconds)
-s size (request size (4k))
-S size (size of the working set)
-k (after the command is finished, leave (do not delete) the working file ioping.tmp)
-L (sequential operations instead of random ones, this will also set the query size to 256k (like -s 256k))
-A (asynchronous I/O)
-C (cached I/O)
-D (straight I/O)
-B (do not display execution information, it will only appear when the command is finished in raw format)
-q (do not display execution information, it will be displayed only when the command completes)
-h (display help)
-v (view version)