Category Archives: Howto

The How to do … section

Port Channel between two (Cisco Catalyst) switches

Connecting switches with two or more Ethernet cables is a piece of cake :)
All you need to do is create/configure a port-channel on both switches and plug in the cables.

The following setup should work on Cisco Catalyst switches. Three different VLANs are used:
Access ports for clients (vlan2) and server/admin network (vlan1) and voip (vlan3).

Step 1:
Define port-channel (Switch A)

interface Port-channel2
description ### Uplink-Channel to switch B ###
switchport trunk allowed vlan 1,2,3
switchport mode trunk
switchport nonegotiate

Step 2:
Assign port-channel to physical interfaces (Switch A)

interface GigabitEthernet0/1
description ### Uplink-Channel to switch B ###
switchport trunk allowed vlan 1,2,3
switchport mode trunk
switchport nonegotiate
channel-group 2 mode active

interface GigabitEthernet0/2
description ### Uplink-Channel to switch B ###
switchport trunk allowed vlan 1,2,3
switchport mode trunk
switchport nonegotiate
channel-group 2 mode active

Please note that [id] in “channel-group [id] mode active” must match [id] in “interface Port-channel[id]”

Step 3:
Create a port-channel and assign it to physical interfaces the same way as on Switch A now on Switch B

interface Port-channel2
description ### Uplink-Channel to switch A ###
switchport trunk allowed vlan 1,2,3
switchport mode trunk
switchport nonegotiate

interface GigabitEthernet0/1
description ### Uplink-Channel to switch A ###
switchport trunk allowed vlan 1,2,3
switchport mode trunk
switchport nonegotiate
channel-group 2 mode active

interface GigabitEthernet0/2
description ### Uplink-Channel to switch a ###
switchport trunk allowed vlan 1,2,3
switchport mode trunk
switchport nonegotiate
channel-group 2 mode active

Step 4:
Get yourself two Ethernet cables and plug them in

Mail compression with Dovecot

The popular IMAP server Dovecot supports compression incoming Mails in order to save disk space on the server.
This feature can be enabled by using the zlib plugin.

Installation and configuration is very simple, just add “zlib” to the mail_plugins configuration.
If you want you can specify the level of compression too – but the default value is just fine.

mail_plugins = $mail_plugins zlib

Only new Mails get compressed upon arrival. Existing Mails stay as they are.
As soon as a new Mail arrives, it gets compressed and is stored in your mailbox. If you have a closer look on the actual mail file you see that it is not a ordinary text file but a compressed file.

[root@server cur]# file 1398234.M33854922198.mail.server.com,S=2420,W=2465:2,S
1398234.M33854922198.mail.server.com,S=2420,W=2465:2,S: gzip compressed data, from Unix

Additional information can be found in the Dovecot Wiki.

How to create a time lapse video from GoPro photos

Recently I came around to try the time-lapse feature of my shiny new “GoPro Hero 3″ cam.
I set it up to take a picture every two seconds and I ended up with around 20 000 photos after about 15 hours. (Thank you, Christoph :) )
Picture Specs: Width: 2592 pixels; Height: 1944 pixels; Exposure Time: 1/2 sec.

Re-size
After importing them into a single folder I decided to re-size them (make sure to keep the aspect ratio, check it here: aspect ratio calculator).

mogrify -resize 2048x1536! *.JPG

This command re-sizes all pictures to 2048×1536 – make sure to keep the originals

Create a file which contains the names of all photos
In order to have the correct order of your photos create a file containing all names of the photos.

ls -1tr | grep -v files.txt > files.txt

create avi file
With the following command you get a avi file (mjpeg codec) with 25fps

mencoder -idx -nosound -noskip -ovc lavc -lavcopts vcodec=mjpeg -o output.avi -mf fps=25 'mf://@files.txt'

create mkv
Now convert the avi to mkv

avconv -i output.avi -c:v libx264 -preset slow -crf 15 output-final.mkv

Credits go to “CyberAngel” who wrote a great posting here: http://ubuntuforums.org/showthread.php?t=2022316&p=12091502#post12091502