Blocking social networks using iptables

Once on one of the NAT servers I needed to block some sites.

If the sites are located on several IP addresses, then you need to find out these ranges of IP addresses, for example, look for VKontakte on bgp.he.net, for example, a list of subnets for one of the AS belonging to VK “http://bgp.he.net/AS47541#_prefixes”.

When networks or hosts are known, add rules for them in iptables, for example:

/sbin/iptables -A FORWARD -s 87.240.128.0/18 -j DROP
/sbin/iptables -A FORWARD -s 95.142.192.0/20 -j DROP

Thus, we prohibit the passage of the traffic of these networks through the server.

See also my articles:
Blocking social networks on Cisco
Blocking social networks on Mikrotik routers

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 Huawei iManager U2000 NMS on Windows Server

I will describe the procedure for installing the Huawei iManager U2000 NMS server software on a Windows Server:

1) Run on behalf of the administrator file install.bat

2) Copyright. We read and agree with the license agreement by selecting “I accept the terms”.
Continue reading “Installing Huawei iManager U2000 NMS on Windows Server”

Solution PHP Notice: Use of undefined constant x — assumed ‘x’

I once noticed the following notification when writing a PHP script:

PHP Notice:  Use of undefined constant uid - assumed 'uid' in /scripts/file.php on line 31
PHP Notice:  Use of undefined constant value - assumed 'value' in /scripts/file.php on line 32

Continue reading “Solution PHP Notice: Use of undefined constant x — assumed ‘x’”

Fn function keys on a laptop work the other way around

Usually, to extend the functionality, there is a special Fn key on laptop keyboards.
If you hold it and press keys, for example, from F1 to F12, then they will perform completely different functions, change the screen brightness, volume level, put the system into sleep mode, turn off/on the Wi-Fi adapter, etc.

But in my case, everything was the opposite, when I needed the F1-F12 keys, instead of them, functional ones worked, which usually work with the Fn clamped, and to press F4 for example, I had to clamp the Fn key as well.

As it turned out, the BIOS had an option Action Keys Mode (in Lenovo laptops – HotKey Mode), the default value of which was Enable, which resulted in the function keys working without pressing Fn.
To make the F1-F12 keys work as usual, set the value to Disable.

By the way, if your function keys do not work at all, then rather the driver is not installed in the system.

See also my article:
Why do Mac function keys work without fn and instead of F1-F12

Why do Mac function keys work without fn and instead of F1-F12

I noticed that on many laptops, including the MacBook, function keys (brightness level of the display, volume, etc.) can be used as standard without the fn (function) key. And the keys themselves from F1 to F12 have to be used with the fn key (it is located in the lower left corner of the keyboard).

So that the keys from F1 to F12 work as usual, and the functional only with the fn key – open “System settings” – “Keyboard“, then in the tab “Keyboard” select “Use the F1, F2 and other function keys as standard“.

Is done.

See also my article:
Fn function keys on a laptop work the other way around