Firmware Update D-Link DIR-815

For the test, I will update the firmware on the router D-Link DIR-815 revision A1.
The router has firmware 1.00 (Fri 06 Aug 2010), on official FTP found version 1.04, b03 (Wed May 15, 2013).

To update the firmware in the D-Link DIR-815 router, perform the following necessary steps:

1) Let’s see the revision on the label under the router and download the new firmware from the official FTP for it http://ftp.dlink.ru/pub/Router/DIR-815/Firmware/
Updating the firmware of the router for the wrong revision can lead to its failure.

2) Open the router settings by typing in the browser address http://192.168.0.1 (can be 192.168.1.1) and enter the default login — admin without password.

3) In the opened interface at the top, open the tab “Tools“, left in the menu select “Firmware“. On the opened page the current version of the firmware will be displayed, if it is older than downloaded, then click “Browse” and select the previously downloaded new firmware file, and then click “Upgrade” to start the update process.

We will wait for the update to be completed, usually about 5 minutes. After the termination the router itself will reboot.
Categorically, you can not turn off the power when the firmware is updated.

Script to check for an empty directory

Recently noticed on one of his backup scripts that he stopped working and just created an empty directory with the current date, so there was an idea to add to it a check on an empty directory with a notification sent to the email.

Example of a script for checking for an empty directory, taking into account hidden files:

if [ `ls -a /backups/dir/ | grep -v "^\.$" | grep -v "^\..$" | wc -l` = "0" ]; then echo "Empty dir"; else echo "Non empty dir"; fi

Example of checking the directory with the name of the current date and if it is empty – by sending an email:

if [ `ls -a /backups/`date +%Y-%m-%d`/ | grep -v "^\.$" | grep -v "^\..$" | wc -l` = "0" ]; then (echo "Subject:Empty dir"; echo "Empty dir";) | sendmail info@example.com; else echo "Non empty dir"; fi

How to catch broadcast storms on FoxGate switches

First of all, let’s look at the statistics of active traffic on ports:

show interface ethernet counter rate

Then we’ll look at the packet counters, especially pay attention to the BroadCast (pkts) column:

show interface ethernet counter packet

For a specific port, we will execute the command to view the statistics of the network interface several times:

show interface ethernet 1/25

And let’s pay attention to how the incoming and outgoing values of the broadcast packets change, if they do not change, then the broadcast packets do not go through this port, if the digit increases rapidly, then maybe there is a broadcast storm.

If necessary, we will enter the competing mode and set the limit of transmitted broadcast packets in kilobits (minimum value 1) for the required ports:

config
Interface Ethernet1/1
storm-control broadcast 50
Interface Ethernet1/2
storm-control broadcast 50
Interface Ethernet1/3
storm-control broadcast 50
...

Note that with a low broadcast bandwidth limit, DHCP broadcast requests from clients can also be blocked.

See also:
Block DHCP servers on FoxGate switches
Configuring the Foxgate S6224-S2 Switch

Updating the Linux kernel on Hetzner servers

It took one day to update the CentOS kernel on the server in Hetzner, which worked without rebooting for about 2 years.

I looked at various information about the system, the versions of the installed kernels and the running kernel:

lsb_release -a
uname -r
uname -a
cat /proc/version
sudo rpm -q kernel
ls /boot | grep vmlinuz

Updated kernel:

yum -y update

Rebooted the server using the link in cPanel https://example.com:2087/scripts/dialog?dialog=reboot

You can also use the command:

reboot

After rebooting the server did not start, I immediately made a request for technical support via the https://robot.your-server.de.
Technical support responded within two minutes, as they reported, the server did not respond to keystrokes, there was a black screen, after the physical shutdown and power-up, it successfully launched.
Here such there are cases of a reset, it is necessary to be ready to everything.
At the next reboots, hangup no longer occurred.

Dying gasp Alarm on Huawei OLT

Sometimes on Huawei OLT you can see Dying gasp Alarm (0x2e11a00b).

Since they often occur, most likely they can be seen by running the commands:

display alarm active alarmid 0x2e11a00b
display alarm history alarmid 0x2e11a00b

I will give an example:

ALARM 531377 FAULT MINOR 0x2e11a00b SERVICE QUALITY 2017-12-06 08:19:27+02:00
ALARM NAME : The dying-gasp of GPON ONTi (DGi) is generated
SRVEFF : SA
PARAMETERS : FrameID: 0, SlotID: 5, PortID: 6, ONT ID: 32, Equipment ID:
TL-GP110
DESCRIPTION : The ONT is power off
CAUSE : The power supply of the ONT is abnormal
ADVICE : Check the power supply of the ONT and ensure that the power
supply works in the normal state

These alarms occur when power is lost or the power cord is removed from the ONT, at this moment ONT manages to send the Dying gasp message to the OLT.
Dying gasp is also used on many other devices, for example, to correctly terminate the connection.

Opening and analysis of files created with NetFlow

Here is an example of viewing statistics:

cat ft-v05.2015-05-01.000759+0300 | flow-stat -f 10 -S 3 | less
cat ft-v05.2015-05-01.000759+0300 | flow-stat -n -p -w -f 26 -S 2 | less
flow-cat ft-v05.2017-12-07.170236+0200 | flow-print | less

You can see the flow-stat tips by typing:

man flow-stat

I will give an example of exporting data to another format (for example, in csv, which can then be opened in windows by any convenient program):

flow-cat ft-v05.2015-05-01.000759+0300 | flow-export -f 2 | less
flow-cat ft-v05.2015-05-01.000759+0300 | flow-export -f 2 > csv.csv

You can display the list with the specified source address with the following command:

flowdumper -se '"192.168.0.1" eq $srcip' ft-v05.2015-06-17.175701+0300

Export the list only with the specified source address to a file, for example, with the following command:

flowdumper -se '"192.168.0.1" eq $srcip' ft-v05.2015-06-17.175701+0300 > file.txt

Example of exporting from multiple files:

flowdumper -se '"192.168.0.1" eq $srcip' /backup/flows/acct/first/2016/2016-01/ft-v05.2015-06-17* > /backup/result.txt

See also:
Installing and using flow-tools

Restart Apple Watch

It was necessary recently to restart the watch Apple Watch 2, which began to visually slow to work.

1) The first thing you need to try to turn them off and turn it on.
To do this, the clock should be disconnected from the charger, then you need to press and hold the side button until the “Off” slider appears, on which you want to drag your finger.
After switching off, you must press the side button again to turn the clock on.

2) There is also the possibility of forced restart, which can be done for example when the clock does not respond.
To do this, press the side button and the wheel at the same time, then hold them for about 10 seconds until the Apple logo appears.
Forced restart can not be done when updates are being installed or they are launched (the Apple logo is displayed).

See also the video:

How to Delete an AliExpress Account

To delete an account on AliExpress, you need to enter into it by entering your login and password, then open “Profile Settings” and on the left in the menu select “Change Settings”.
In the window that opens, click “Deactivate Account”.

Then enter your email in the line “Enter your username:”, type “Deactivate my account” below, then specify the reason for deactivation and click “Deactivate my account”.

After that, the account will be inactive, but you can reactivate it if you want.