Advanced DHCP Options: Pushing static routes to clients

The DHCP protocol contains several more or less options to configure the clients (e.g. PAC-Files, NTP-Servers, etc.). One of these cool options is the ability to push static routes to clients. This can be done in two different ways:

Single route

Pushing a single route is very easy. The configuration value consists of two ip address pairs in hex. The first address is the destination host, the second is the router.

Example:
Destination: 192.168.123.234 (Hex: C0:A8:7B:EA)
Router: 10.34.72.42 (Hex: 0A:22:48:2A)

The value is: C0:A8:7B:EA:0A:22:48:2A

If you configure a pfsense box, go to Services -> DHCP Server and add the value to the box "Additional BOOTP/DHCP Options". Its important to choose the type "String"!

Advanced DHCP Options: Pushing static routes to clients

Classless Static Routing

The DHCP option 121 follows a slightly different format. The format is <width of the subnetmask>:<netaddress>:<router address> (again, in hex).

Example:
Destination: 192.168.123.0 (Hex: C0:A8:7B:0)
Router: 10.34.72.42 (Hex: 0A:22:48:2A)
Subnet mask width: 24

Value: 24.192.168.123.10.34.72.42, in hex 18:C0:A8:7B:0A:22:48:2A

Advanced DHCP Options: Pushing static routes to clients

To provide multiple static routes, just concat all encoded values. According to RFC 3442, you should include the default route in the DHCP option 121, since clients are allowed to ignore the "default route" DHCP option if the server provides a value for the classless static routing option. The default route option is: 00:0A:0A:0A:02 (the routers ip is 10.10.10.2, the last 4 bytes), combined: 00:0A:0A:0A:02:18:C0:A8:7B:0A:22:48:2A.

Note: Windows systems up to Windows XP/Windows Server 2003 do not request the dhcp option 121 (they have to be tweaked manually to request this option). The linux dhcp client "dhcpcd" requests this option per default (if not, set option classless_static_routes in /etc/dhcpcd.conf).

Gentoo on Alix: Serial console setup

Yesterday i finally got my PCEngines Alix 2d13 for my newest geek project. Its a small embedded board, perfect for running a linux distribution and acting as a firewall.

Connecting the serial console

Since the board has no vga/hid connector, you have to use a serial console connection to actually interact with your alix. Since none of my other boxes has a serial connector i ordered a USB to Serial Adapter. You have to enable the right kernel module for the cable. In my case it was a Prolific 2303:

Device Drivers
    USB support (USB_SUPPORT [=y])
         USB Serial Converter support (USB_SERIAL [=y])
                  <*>   USB Prolific 2303 Single Port Serial Driver

After connecting the cable to your USB Port dmesg tells you the device name:

pl2303 1-1.6:1.0: pl2303 converter detected
usb 1-1.6: pl2303 converter now attached to ttyUSB0

Now, connect to the box with your favourite serial terminal program (e.g. net-dialup/minicom) using the following settings:

Device: /dev/ttyUSB0 (or /dev/ttyS0 for a real serial connection)
Bps: 38400
Parity: None
Data: 8
Stop: 1

Power on the alix. You should see the alix booting. If the console show weird characters, try varying the Bitrate. To boot from the CF card, i had to set the harddisk mode to LBA in the BIOS (To enter the BIOS, press S during the memtest).

Now, let us install Gentoo Linux on the alix.

Blogvorstellung

Heute stelle ich mal ein paar der Blogs aus dem Blogroll vor (in beliebiger Reihenfolge):

Im Bestatterweblog kann man interessante, traurige aber informative Geschichten (gerne auch in mehreren Teilen) über den Tod, Bestattungen und dem ganzen Drumherum lesen. Hin und wieder kommen erheiternde Geschichten über den Nachwuchs des Bestatters hinzu. Passend dazu das Buch "Gestatten, Bestatter: Bei uns liegen sie richtig".

Im Blog Code Inside dreht sich alles um Microsoft .NET Technologien und deren Anwendung. Immer informativ, allerdings sehr Microsoft-lastig.

Der Shopblogger schreibt aus und über einen Spar-Markt in Bremen. Neben Geschichten über Ladendiebe und Leergutautomaten gibt es hier Einblicke in das schon fast alltägliche Chaos eines (ehemals 24h)-Supermarkts.

Diego E. Pettenò schreibt über Gentoo Development, Build-Probleme und Continuous Integration (wenn er sich nicht gerade über DRM/propietäre Ebook-Reader aufregt). Nicht immer leichte Lektüre, hat aber immer Hand und Fuß.

Im Law Blog erfährt man so einiges über Stilblüten der deutschen Justiz und öfter differenzierte Kommentare und Einschätzungen zu aktuellen Themen.

Aus dem Taxi-Blog kommen herrliche Geschichten über den Alltag eines Taxifahrers in Paderborn.

Und noch eine...

Ich habe direkt noch eine MCP Prüfung hinterher geschoben und bin jetzt auch Microsoft Certified Technology Specialist für Windows Communication Foundation. :)

Und noch eine...

Nützliche Webseiten

Wenn man an einem Nameserver oder Mailserver schraubt, kommt man oft in die Situation testen zu müssen wie es denn von "aussen" aussieht. Hierzu ein paar nützliche Seiten:

  • IPTools.com: Verschiedene Möglichkeiten Routen, Domains, etc. zu testen
  • intoDNS: Verschiedene Tests für Nameserver
  • DNSsy: Prüft ähnlich wie intoDNS verschiedene Einstellungen von Nameservern
  • MXToolbox: Verschiedene Tests für Mailserver
  • Open Relay Test: Prüft auf verschiedene Arten ob ein Mailserver Mails von/für beliebige Adressen annimmt.

Verwirrte Apple-User

Apple hat mal wieder eine App aus dem AppStore geschmissen - so weit nichts neues. Konkret ging es da um eine App, die den Lautstärkeregler in einen Kameraauslöser verwandelte. Auch das ist jetzt nichts spektakuläres. Allerdings ist die Begründung des Rauswurfs dafür umso lustiger:

Anwender könnten verwirrt sein, wenn der Lautstärkeregler des iPhones auf einmal für eine andere Funktion als seine angestammte genutzt wird.

The Fastest and Funniest LEGO Star Wars story ever told

How to parse a syslog logfile in python

Thanks to the incredible pyparsing module it is really easy to parse arbitrary files without the hassle of regular expressions.

The following code parses a standard syslog-ng logfile:

from pyparsing import Word, alphas, Suppress, Combine, nums, string, Optional, Regex

month = Word(string.uppercase, string.lowercase, exact=3)
integer = Word(nums)
serverDateTime = Combine(month + " " + integer + " " + integer + ":" + integer + ":" + integer)
hostname = Word(alphas + nums + "_" + "-")
daemon = Word(alphas + "/" + "-" + "_") + Optional(Suppress("[") + integer + Suppress("]")) + Suppress(":")
message = Regex(".*")
bnf = serverDateTime + hostname + daemon + message

with open('/path/to/logfile') as syslogFile:
	for line in syslogFile:
		fields = bnf.parseString(line)
		print fields

Programmierer haben Humor #3

Programmierer haben Humor #3

Ich weiß zwar nicht, wie der auf 26 Stunden kommt (denke das sollten eher 26 Tage sein), aber lustig ist es doch :)

Howto explain a console application to Windows users

From Mastering Power-Shell:

Shortcuts are important since almost everything in PowerShell is keyboard-based. For example, by pressing the keys (Arrow left) and (Arrow right), you can move the blinking cursor to the left or right. Use it to go back and correct a typo. 

Wohhooooo :)

Programmierer haben Humor (immer noch)

I 2009/07/25 17:27:01 serverProcessor putting poison pill in queue CrawlStackerSlow, thread 0
I 2009/07/25 17:27:01 serverProcessor .. poison pill is in queue CrawlStackerSlow, thread 0. awaiting termination