Speed limit on D-Link switch ports

We will use the bandwidth capping command “config bandwidth_control
Write it in the following order:

config bandwidth_control PORTS rx_rate no_limit/VALUE 64-1024000 tx_rate no_limit/VALUE 64-1024000

The value is set in kilobits, for example, to limit the client at port 5 of the incoming rate to 50 megabit, use the command:

config bandwidth_control 5 tx_rate 51200

View bandwidth_control parameters:

show bandwidth_control 5

An example of limiting the incoming and outgoing speeds of 1 megabit per port from 1 to 24:

config bandwidth_control 1-24 tx_rate 1024 rx_rate 1024

To remove the limit use the command:

config bandwidth_control 1-24 tx_rate no_limit rx_rate no_limit

You can configure it via the web-interface by opening the menu “QoS” -> “Bandwidth Control” and you need to specify the parameters in the cells and click the “Apply “.

Configuring low-level discovery in Zabbix

Low-level discovery allows you to automatically create data items, triggers, graphics.
Massively it is better not to use it, since in practice it noticed that it gives a significant load on the system.

Here is an example of the discovery configuration for viewing the port load of the managed switch.
To start, open the “Settings” – “Templates“, create a new template, or click “Discovery“.
Click “Create rule” and fill out the main parameters:

Name: Interaces
Type: SNMPv2 agent
Key: snmp.discovery
SNMP OID: ifDescr
SNMP community: public
Port: 161

The second step is to create a prototype data element:

Name: ifInOctets.$1
Type: SNMPv2 agent
Key: ifInOctets.["{#SNMPINDEX}"]
SNMP community: public
Port: 161
Type of information: Numeric (float)
Units: B
Use custom multiplier: 8
Store value: Delta (speed per second)
New aplication: ifInOctets

Example of creating a prototype of a trigger:

Name: ifOperStatus.{#SNMPINDEX} on {HOST.HOST} was changed
Expression: {template name:ifOperStatus.["{#SNMPINDEX}"].diff()}=1

Instead “ifInOctets” similarly you can use for example: ifOutOctets, ifInErrors, ifOutErrors, ifInDiscards, ifOutDiscards, ifOperStatus etc.

When creating a graph in the name, we write for example “Traffic Port {#SNMPINDEX}” and add to the Item, for example, two data elements responsible for the incoming (ifInOctets) and outgoing traffic (ifOutOctets).

See also:
SNMP OID and MIB for interfaces

How to format UDF Volume in Ubuntu

I recently wanted to format the USB flash drive in the Ubuntu operating system, but since it was in UDF format, formatting was refused and many programs did not see it as a flash drive.

To begin with, let’s look at the discs:

sudo fdisk -lu

Then the solution was to execute the following command:

sudo shred -vzn 0 /dev/sdc

After that, the flash drive can be formatted by any program.

Install and configure lm-sensors

Run the command to install the utility in Ubuntu / Debian:

sudo apt-get install lm-sensors sensord

We introduce the sensor detection command:

sudo sensors-detect

Information about detected sensors will be recorded in the file /etc/modules

Let’s review the sensor data:


I’ll describe some of the start keys sensors:
-c, –config-file (specifying the configuration file)
-h, –help (display help)
-s, –set (execution of `set ‘messages (only from root)
-f, –fahrenheit (temperature display in fahrenheit)
-A, –no-adapter (do not show the adapter for each chip)
–bus-list (generating bus messages for sensors.conf
-u (raw conclusion)
-v, –version (display version of the program)

Installing and Configuring SNMPD + MRTG

MRTG (Multi Router Traffic Grapher) – a tool for displaying various data in graphs.

The installation command in Ubuntu/Debian:

sudo apt-get install mrtg snmp snmpd

In CentOS:

yum install mrtg net-snmp net-snmp-utils

The command below can tell you which additional modules are in the repository:

apt-cache search mrtg

Open the configuration file /etc/snmp/snmpd.conf

sudo nano /etc/snmp/snmpd.conf

Comment on the line:

com2sec paranoid default public

And uncomment the line:

com2sec readonly default public

Restart snmpd so that changes to the configuration file take effect:

sudo /etc/init.d/snmpd restart

You can check snmp by commands:

netstat -nlp | grep snmpd
snmpwalk -v2с -c public localhost

Beginners can generate a simple configuration file with the command:

sudo cfgmaker public@localhost >> /etc/mrtg.cfg

where public is the name of the community (the password is in other words), and localhost is the host address or ip.

Example of starting the configuration file /etc/mrtg.cfg:

WorkDir: /var/www/mrtg
Options[_]: growright, bits, nobanner
Background[_]: #B0C4DE
EnableIPv6: no
Language: russian
EnableSnmpV3: no
Interval: 10
Refresh: 600
Include: /etc/mrtg/server1.cfg
Include: /etc/mrtg/server2.cfg

Create the working directory:

sudo mkdir /var/www/mrtg

Then you must write or generate the index.html file with the command:

sudo indexmaker /etc/mrtg.cfg > /var/www/mrtg/index.html

We look at the log /var/log/mrtg.log so that there are no errors.

Here is an example of setting up SNMP on D-Link switches:

private CommunityView Read Write
public CommunityView Read Only

Example of a manual start script (mrtg.sh):

#run mrtg
export $LANG
/usr/bin/mrtg /etc/mrtg.cfg --logging /var/log/mrtg.log

IPTables rules for Samba

To open access to Samba in IPTables, you must add four rules at once:

sudo iptables -A INPUT -p udp -m udp --dport 137 -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --dport 138 -j ACCEPT
sudo iptables -A INPUT -p tcp -m tcp --dport 139 -j ACCEPT
sudo iptables -A INPUT -p tcp -m tcp --dport 445 -j ACCEPT

To only allow access to a particular network, for example

sudo iptables -A INPUT -s -p udp -m udp --dport 137 -j ACCEPT
sudo iptables -A INPUT -s -p udp -m udp --dport 138 -j ACCEPT
sudo iptables -A INPUT -s -p tcp -m tcp --dport 139 -j ACCEPT
sudo iptables -A INPUT -s -p tcp -m tcp --dport 445 -j ACCEPT

To remove a rule, we’ll specify the same command, replacing -A with -D, for example:

sudo iptables -D INPUT -s -p udp -m udp --dport 137 -j ACCEPT
sudo iptables -D INPUT -s -p udp -m udp --dport 138 -j ACCEPT
sudo iptables -D INPUT -s -p tcp -m tcp --dport 139 -j ACCEPT
sudo iptables -D INPUT -s -p tcp -m tcp --dport 445 -j ACCEPT

To view the list of rules, use the command:

sudo iptables -nvL

See also my articles:
Configuring IPTables
Installing and Configuring Samba on Linux

How to schedule shutdown Windows

There are several ways to schedule a Windows shutdown.

1) You can execute the command shown below in the “Run” window (it can also be opened with the WIN+R keys), also on the command line or the PowerShell, for all variants the command is the same:

shutdown –s –t 3600

Where 3600 is the number of seconds after which Windows will shut down and the computer will shut down.
3600 seconds = 1 hour.

Similarly, you can put the computer into hibernation mode if it is available:

shutdown –h –t 3600

To cancel a command, you must:

shutdown /a

2) The second way is to create a simple task in the task scheduler.
Open the Control Panel\System and Security\Administration\Task Scheduler.
Click “Create a simple task …”.
Enter any name for the new task, for example, “Shutdown.”
In the next window, select “Once.”
In the next window, we indicate the time when we need to complete the task.
In the next window, select “Run the program.”
In the line “Program or script:” we indicate the program:


and in the line “Add arguments (optional):” -s
Create a task.

Similarly, you can create a task such as sleep mode by entering “Program or script:” in the line:

C:\Windows\System32\rundll32.exe powrprof.dll,SetSuspendState Sleep

If you want to delete it, in the Task Scheduler window on the left click “Job Scheduler Library” and clicking the right button on the desired task, click “Delete”.

See also my article – Enable or disable Hibernate mode in Windows

Lenovo A3000 Hard Reset

On the test I will use Lenovo A3000-H.

Let’s get started. Turn off the tablet if it is possible, if not, we still press and hold the power key and the volume up key at the same time until the following menu appears:

Recovery Mode
Fastboot Mode
Normal Mode

Press the volume up key to select the desired mode, and go to the volume down key. In our case, let’s move on to Recovery Mode.

There was a robot, we put the power button on and another menu will appear. In it, on the contrary, by the sound reduction button we select the necessary operation, and the magnifications will be performed by it.
First we choose and execute “wipe cache partition“, later “wipe data/factory reset” and at the end we execute “reboot system now“, the device will reboot with standard settings and without user data.