Ethernet bonding with Linux and 802.3ad

2 NIC + SwitchNowadays, most desktop mainboards provide more than one gigabit ethernet port. Connecting them both to the same switch causes most Linux distros by default to get a individual IP on each device and route traffic only on the primary device (based on device metric) or round-robin. A single connection always starts at one IP and so all traffic goes through one device, limiting maximum bandwidth to 1 GBit.

Here comes bonding (sometimes called (port) trunking or link aggregation) to play. It connects two ore more ethernet ports to one virtual port with only one MAC and so mostly one IP address. Wheres earlier only two hosts (with the same OS running) or two switches (from the same vendor) could be connected, nowadays there's a standard protocol which makes it easy: LACP which is part of IEEE 802.3ad. Continue reading

Changing scheduling parameters in Linux

Process scheduling within Linux is done by the kernel, following different aspects. Usually it's goal is to share all resources fairly among all running processes.

Sometimes, there's a need to tell the kernel explicitly to prior some process, bind some process to a special CPU and so on.

Changing process priorities is commonly known:

nice -n 10 make

runs the program make with a priority of 10 (-20 meaning most favorable and 19 least favorable scheduling). If you want to change a priority of a running program, renice is your choice. Continue reading

Installing Gentoo on ALIX.3D3

When I ordered the ALIX.3D3 board I thought installing Gentoo on this should be a piece of cake, but finally there were some stumbling blocks and that's why I want to summarize how I got gentoo running.

First of all, I recommend installing Gentoo on a normal desktop to get to know the installing process, which is a bit different from graphical installers of mainstream distros. The Gentoo Handbook is a great documentation how this done.

To install gentoo, you have to boot a minimal or "rescue" linux usually from cd/dvd. I tried to convice the bios to boot from a usb cd-rom drive, but I hadn't any success. Continue reading

v4l2grab - Grabbing JPEGs from V4L2 devices

A friend of mine, wanted to use a standard USB WebCam as an IPCam. He used an old Media-Receiver Box (T-Online S100) and installed Gentoo Linux on an CF Card.

Since Kernel 2.6.27 most of the USB webcams are supported through the Linux UVC drivers, which provides an Video4Linux2 Interface to those cams. We found some programs who claimed being able to grab JPEG images from V4L2 Cams, but most of them either didn't compile, supported only V4L Version 1 or just brought up some other errors.

So I checked up the Video for Linux Two API Specification and found there in Appendix B a small sample of howto communicate with the Cam. I adapted it to our needs and included an converter from YUV colorspace to RGB. Finally I added some code to support the export of JPEG images. Continue reading

commenting iptables rules

I often use iptables (or ip6tables, the IPv6 version of iptables) to implemented firewall rules on my linux systems.

In earlier times I used a commented bash script to setup the rules after booting, but using Gentoo nowadays there is a nice init script saving and restoring my tables. Using this I stopped commenting the firewall rules, but yesterday I found a very nice solution for this problem.

Iptables has a special "match" for comments. Continue reading