The solution to the error “ImportError: No module named ldap”

Installed iRedMail on Ubuntu Server in February 2016 and noticed an error when trying to send a message via Roundcube:

SMTP error (451): Unable to add recipient “Email” (4.3.5 Server configuration problem)

I checked if iredapd is running:

telnet localhost 7777

It turned out that it was not running because the response from telnet was displayed:

Unable to connect to remote host: Connection refused

Tried to run:

sudo /etc/init.d/iredapd start

To which he received the answer:

ImportError: No module named ldap

I installed the module with the command:

sudo apt-get install python-ldap

Execute the commands:

sudo -i
cd /opt/iredapd/
find . -name '*pyc' | xargs rm -f {}

Now restart the service:

sudo service iredapd restart

Done, there is no error.

Starting a TFTP server in Windows

One of the options for running the tftp server on Windows is to download and run the application from the link

After running the application to test it, you need to run the tftp client, if it is not installed on Windows, we set it by typing:

dism /online /Enable-Feature /FeatureName:TFTP

Or you can also open the “Control Panel” – “Uninstall the program” or “Programs and components” – “Enable or disable Windows components”, tick the “TFTP Client” and click “OK”.

To transfer and download files from the TFTP server, open the command line and execute the commands:

tftp PUT file.txt
tftp GET file.txt

See also:
Installing and Configuring a TFTP Server in Ubuntu

Turning test mode on and off in Windows 7

Sometimes I had to put unsigned drivers to flash different junk, so I included a test mode in which the installation of unsigned drivers is allowed. If the test mode is disabled, the drivers will stop working again.

You can enable the test mode in Windows 7 from the command line (cmd) or from the “Run” line which is opened by the Win+R key combination.
In any of the lines, you need to run the following command to enable the test mode:

bcdedit.exe -set TESTSIGNING ON

To turn off:

bcdedit.exe -set TESTSIGNING OFF

After each command, you must restart the computer.
When the test mode is enabled, the “Test mode” and the version of the Windows assembly are displayed on the desktop in the lower right corner.

The solution to the warning “Lack of Free Swap Space on Zabbix Server”

Put somehow on a new Linux server Zabbix and immediately began to display the following warning:

Lack of Free Swap Space on Zabbix Server

The warning says that there is no place in the Swap section, having seen that there is no Swap partition at all, it’s strange that when installing Ubuntu 14.04 LTS with the option to use the entire disk it was not created automatically, there was only 6 GB of RAM on the server.

On this solution of the problem in my case was the creation of the Swap partition, after which the warning disappeared.
Look another my article on this – How to create SWAP in Linux

Well, if there is a lot of RAM and it’s free basically, then Swap can make no sense, so you can simply turn off the trigger for this server creating a notification. To do this, open the Zabbix panel, go to the “Settings” tab – “Network nodes”, in front of this server, click “Triggers” and deactivate the trigger creating this warning.


The page break in the HTML document

I had to somehow make an HTML check template for a thermal printer, which after each page can make a tape break.

Since the check should have been broken into two parts, I did not touch the first part, and put the second part in the div tag with the style:

<div style="page-break-before:always;">

Style “page-break-before” determines the gap in front of the page, so before the second page the tape was torn, well, and at the end of the printing process, the printer itself is breaking according to the settings of the printer. You can also specify that the gap should be executed after the page: “page-break-after” or “page-break-inside” inside the page.

I will describe the meaning:
always (always adds a page break)
auto (automatically adds a page break if it is required)
avoid (forbids page break)
left (skips one or two pages so that the next page is even when printing)
right (skips one or two pages so that the next page when printing is odd)
inherit (inherits the value)

The page break style can be specified for example in the table:

<table style="page-break-after:always">

Either in CSS:

table { page-break-after:always; }

Configuring the D-Link DES-3528 Switch

Today I configured the next switch D-Link DES-3528.

I will lay out the configuration below and briefly describe it.
When typing commands, you can use the TAB key so that the switch offers options, and after any command through a space, you can write a question mark “?” and see possible subcommands.

To view the current switch configuration, use the command:

show config current_config

Let’s get started.
We connect to the switch with a console cable at the speed of 9600 or at the standard IP address and add the administrator (initially the login without login and password):

create account admin admin

Enable password encryption so that it is not stored in the config file open:

enable password encryption

Add vlan for management and for users (I have 207 core for management, 226 for users, 25 use port as uplink):

create vlan core tag 207
config vlan core add tagged 25
create vlan local_smart tag 226
config vlan local_smart add untagged 1-28
config port_vlan 1-28 acceptable_frame admit_all pvid 226
config vlan default delete 1-28

Change the IP address of the switch and specify the gateway:

config ipif System ipaddress vlan core
create iproute default 1 primary

Let’s enable the restriction of broadcast traffic on client ports:

config traffic control 1-24,26-28 broadcast enable action drop broadcast_threshold 100 countdown 0 time_interval 5

Enable loop protection on client ports:

enable loopdetect
config loopdetect recover_timer 300 interval 10 mode port-based
config loopdetect log state enable
config loopdetect ports 1-24,26-28 state enable
config loopdetect trap loop_detected

Enable traffic segmentation so that clients do not see each other:

config traffic_segmentation 1-24,26-28 forward_list 25
config traffic_segmentation 25 forward_list 1-24,26-28

We will enable DHCP server locks on the client side so that they do not distribute IP:

config filter dhcp_server ports 1-24,26-28 state enable
config filter dhcp_server illegal_server_log_suppress_duration 30min
config filter dhcp_server trap_log enable

Let’s specify which IPs are allowed to log on to the switch (so that users do not see it):

create trusted_host network snmp telnet ssh http https ping
create trusted_host network snmp telnet ssh http https ping

Set up SNMP if you need it:

enable snmp
delete snmp community public
delete snmp community private
delete snmp user initial
create snmp community NAME view CommunityView read_only

Turn on the protection against BPDU flood:

enable bpdu_protection
config bpdu_protection recovery_timer 2400
config bpdu_protection log none
config bpdu_protection ports 1-24,26-28 state enable
config bpdu_protection ports 1-28 mode drop

Enable switch protection so that if the processor is fully loaded, you can go to it:

config safeguard_engine state enable utilization rising 100 falling 95 trap_log enable mode fuzzy

If necessary, configure the time synchronization with the NTP server:

enable sntp
config time_zone operator + hour 2 min 0
config sntp primary poll-interval 5000

This completes the basic configuration of the D-Link DES-3528 switch.


Today wrote a Zabbix template for the BDCOM P3310B so that it was convenient to monitor it and to explore a few necessary OIDs.
To test an OID from a Linux terminal, for example, use the command:

snmpwalk -v2c -c public OID

Actually, I’ll list OID below and describe it.
CPU usage for 1 second:


CPU usage for 60 seconds:


CPU usage for 5 minutes:




Description of network interfaces from the configuration (that is, description of the onu):


MAC addresses on interfaces (ONU):


Signal level ONU Rx/Tx (result divide by 10 or multiply by 0.1 in Zabbix):


Distance to ONU and RTT (TQ):


SNMP contact information:


SNMP Location:


If snmpwalk produces an error, then look at the emu article: Installing MIB in Ubuntu and Solving the Error “SNMP Cannot Find Module …”

See also:
SNMP OID and MIB for interfaces