DD-WRT, DNSmasq, fight!

May 7, 2012 1 comment

I half completed this mini project, including getting a GPS driven ntp time source working, but haven’t felt it necessary to finish the write-up…

Aim

  1. DHCP addresses for all connected hosts (some statically allocated)
  2. DNS caching on the router
  3. DHCP hostnames available through DNS (DNSmasq [Local DNS])
  4. (optional) Blackhole certain DNS queries for ad blocking (add-hosts/pixelserv?)
  5. (optional) DHCP options (4|42) – Time Server (Clients to sync time to router) (DNSmasq “dhcp-option = 42,192.168.0.4″)
  6. (optional) DHCP options (7) – Log Server (Central syslog server)
  7. (optional) DHCP options (123) – GeoConf

Method

Debian Squeeze – Openswan

September 19, 2011 Leave a comment

During installation, the /var/lib/dpkg/info/openswan.postinst post installation script fails to check whether a CA cert exists before trying to copy it.

This throws the mysterious error : "cp: cannot stat `': No such file or directory"

Wrap the offending line (around line 176) with a quick check :

if [ "$cafile" ]; then
cp "$cafile" /etc/ipsec.d/cacerts
fi

OSX dialog boxes

July 17, 2011 Leave a comment

Ever since OSX ran on X86 hardware, it has been my primary OS – exclusively on MacBook Pro’s – and whilst learning it’s idiosyncrasies didn’t take long, as a heavy user of keyboard shortcuts I’d always been frustrated by dialog box choices.

 

The Tab key wouldn’t switch between the buttons, holding Alt or Cmd doesn’t hint at any shortcut letters available, but what does work is pressing the first letter of each buttons text whilst holding Cmd.

So in the example dialog box above, Cmd-C would cancel the choice, Cmd-K would keep the file and lastly Cmd-M would move the file to the trash. Simple, but not as obvious as you might think!

Tags: ,

Debian squeeze, distcc-pump and kernel builds

June 18, 2011 Leave a comment

Compiling a new kernel on an Intel N270 Atom-based Linux system can be awfully slow, so setting up distcc or ccache begins to really make sense.

However, there’s something about ccache and the Linux build process that don’t play nicely, using it’s masquerade setup I didn’t get a single hit from its cache.

Distcc on the other hand, especially when distributed pre-processing too with the distcc-pump invocation has a dramatic effect on the time taken to produce a new kernel (it’s very easy to fire up a stripped down Debian virtual machine to use as an extra distcc node), and here’s how I setup this Debian Squeeze 6.0.1 installation :

 

Firstly, install the kernel source of your choice and distcc using apt :

# apt-get install distcc-pump linux-source-2.6.32

 
Secondly, fix the distcc-pump script as it looks for python modules in the version 2.5 path, whereas Debian Squeeze comes with 2.6 out of the box :

# vi +43 /usr/bin/distcc-pump
include_server='/usr/lib/pymodules/python2.6/include_server/include_server.py'

 
Thirdly, setup some hosts to distribute the compiling to, here I choose to limit my faster ‘compute’ node to eight simultaneous jobs, and just one job at a time for the slower Atom system (the cpp,lzo options tell distcc to push pre-processing jobs to this host also and compress the source files across the wire) :

# cat /etc/distcc/hosts
compute/8,cpp,lzo localhost/1

 
Finally, as we can’t pass a ‘-j8′ option to the make command to request eight threads of compiling at once, we set the environment variable CONCURRENCY_LEVEL accordingly, the distcc-pump startup creates a socket which distcc can then talk to, though it borks the PATH, so we change that back to put /usr/lib/distcc at the beginning for its masquerading as a compiler to work correctly, and thats all you need to do before compiling and installing your kernel the Debian way.

# export DISTCC_VERBOSE=0
# export CONCURRENCY_LEVEL=8
# eval `distcc-pump --startup`
# echo $PATH
/usr/bin:/usr/lib/distcc:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# export PATH=/usr/lib/distcc:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# cd /usr/src/linux-source-2.6.32
# make menuconfig
# fakeroot make-kpkg --initrd --append-to-version=testbuild --revision=0.1 kernel_image
# distcc-pump --shutdown
# dpkg -i ../linux-image-2.6.32.testbuild_0.1_i386.deb

Tags:

root password exposure on Ops Center provisioned hosts?

March 4, 2011 Leave a comment

# ls -l /var/opt/sun/jet/config/jumpstart.conf
-rwxr-xr-x 1 root other 1551 Apr 13 2010 /var/opt/sun/jet/config/jumpstart.conf

Contains the DES encrypted root password on line prefixed “JS_Default_Root_PW=” set during installation and is world-readable.

Tags:

PingChat! EULA

January 28, 2011 Leave a comment

Solaris 11 Express & VirtualBox & OSX

January 24, 2011 Leave a comment

Using curl, I downloaded sol-11-exp-201011-text-x86.iso, setup a basic VM in VirtualBox with four NICs and began to poke around.

My first impressions :

  • My ‘Network Adapters’ in VirtualBox are enumerated backwards in the VM. eg. Adapter1 is e1000g3, Adapter4 is e1000g0
  • DHCP is nice and easy (though a reboot after these steps was needed?) : ifconfig e1000g3 plumb;ifconfig e1000g3 dhcp start;touch /etc/dhcp.e1000g3;echo inet fry > /etc/hostname.e1000g3;cp /etc/nsswitch.dns /etc/nsswitch.conf;svcadm enable -r dns/client
  • NWAM is either going to take some getting used to, or is going to get disabled very quickly.

Virgin Media – Traffic Shaping

December 19, 2010 Leave a comment

Nice download results for HTTP traffic, but dont expect much from the puny 512kbit upload bandwidth!
Speed

ping

Virgin Media heavily traffic shape P2P traffic also, so dont expect much more than 120kb/s out of your 10Mbit link if you download torrents.

Disassociated due to inactivity – RESOLVED

October 19, 2010 4 comments

Infuriating wireless behaviour from my Apple MacBookPro5,3.
Every time it wakes from sleep, the wireless disconnects within about a minute and fails to re-join.

19/10/2010 18:48:47    kernel    hibernate image path: /var/vm/sleepimage
19/10/2010 18:48:48    kernel    AirPort: Link Down on en1. Reason 8 (Disassociated because station leaving).
19/10/2010 18:48:49    kernel    System SafeSleep
19/10/2010 20:17:34    kernel    Wake reason = EC LID0
19/10/2010 20:17:34    kernel    System Wake
19/10/2010 20:17:34    kernel    Previous Sleep Cause: 5
19/10/2010 20:17:34    kernel    en1: 802.11d country code set to 'X3'.
19/10/2010 20:17:34    kernel    en1: Supported channels 1 2 3 4 5 6 7 8 9 10 11 12 13 36 40 44 48 52 56 60 64 100 104 108 112 116 120 124 128 132 136 140
19/10/2010 20:17:36    kernel    Auth result for: 00:22:6b:7a:79:d7 MAC AUTH succeeded
19/10/2010 20:17:36    kernel    AirPort: Link Up on en1
19/10/2010 20:17:36    kernel    AirPort: RSN handshake complete on en1
19/10/2010 20:18:40    kernel    en1: 802.11d country code set to 'DE'.
19/10/2010 20:18:40    kernel    en1: Supported channels 1 2 3 4 5 6 7 8 9 10 11 12 13 36 40 44 48 52 56 60 64 100 104 108 112 116 120 124 128 132 136 140
19/10/2010 20:19:01    kernel    AirPort: Link Down on en1. Reason 4 (Disassociated due to inactivity).

It’s been doing this for months now and I can’t figure out why, my Darwin debugging skills are too weak.

MPI and Solaris on Coolthreads

October 4, 2010 Leave a comment

Coolthreads. Interesting boxes. What follows is a log of my experiments with MPI (Message Passing Interface)  as a way to exploit the large number of worker threads present on T-series Sun hardware.

With the workload below coordinated by MPICH2,  we see near linear performance increases from 1 to 16 threads and then a very shallow increase as we approach 32 threads, at which point there is no further improvement.

Could this performance ceiling be due to memory bandwidth limits or cache contention perhaps?

While 0 > x <= 64, mpirun -np $x ./john --test --format=MD5

CPUs:   1       Raw:    1149 c/s real, 1149 c/s virtual
CPUs:   2       Raw:    2298 c/s real, 2298 c/s virtual
CPUs:   3       Raw:    3447 c/s real, 3447 c/s virtual
CPUs:   4       Raw:    4596 c/s real, 4596 c/s virtual
CPUs:   5       Raw:    5739 c/s real, 5733 c/s virtual
CPUs:   6       Raw:    6882 c/s real, 6894 c/s virtual
CPUs:   7       Raw:    8043 c/s real, 8043 c/s virtual
CPUs:   8       Raw:    9192 c/s real, 9186 c/s virtual
CPUs:   9       Raw:    10303 c/s real, 10297 c/s virtual
CPUs:   10      Raw:    11438 c/s real, 11402 c/s virtual
CPUs:   11      Raw:    11941 c/s real, 11921 c/s virtual
CPUs:   12      Raw:    13606 c/s real, 13598 c/s virtual
CPUs:   13      Raw:    14741 c/s real, 14784 c/s virtual
CPUs:   14      Raw:    15822 c/s real, 15840 c/s virtual
CPUs:   15      Raw:    16298 c/s real, 16298 c/s virtual
CPUs:   16      Raw:    16815 c/s real, 16817 c/s virtual
CPUs:   17      Raw:    17094 c/s real, 17105 c/s virtual
CPUs:   18      Raw:    16467 c/s real, 16514 c/s virtual
CPUs:   19      Raw:    18438 c/s real, 18438 c/s virtual
CPUs:   20      Raw:    18449 c/s real, 18464 c/s virtual
CPUs:   21      Raw:    18516 c/s real, 18507 c/s virtual
CPUs:   22      Raw:    18638 c/s real, 18619 c/s virtual
CPUs:   23      Raw:    18433 c/s real, 18447 c/s virtual
CPUs:   24      Raw:    18998 c/s real, 19016 c/s virtual
CPUs:   25      Raw:    18857 c/s real, 18859 c/s virtual
CPUs:   26      Raw:    19126 c/s real, 19126 c/s virtual
CPUs:   27      Raw:    19377 c/s real, 19327 c/s virtual
CPUs:   28      Raw:    19603 c/s real, 19566 c/s virtual
CPUs:   29      Raw:    19745 c/s real, 19730 c/s virtual
CPUs:   30      Raw:    19876 c/s real, 19783 c/s virtual
CPUs:   31      Raw:    20100 c/s real, 20023 c/s virtual
CPUs:   32      Raw:    20049 c/s real, 20048 c/s virtual
CPUs:   33      Raw:    20123 c/s real, 20154 c/s virtual
CPUs:   34      Raw:    19971 c/s real, 19995 c/s virtual
CPUs:   35      Raw:    20120 c/s real, 20148 c/s virtual
CPUs:   36      Raw:    20010 c/s real, 19988 c/s virtual
CPUs:   37      Raw:    20038 c/s real, 20049 c/s virtual
CPUs:   38      Raw:    19955 c/s real, 19955 c/s virtual
CPUs:   39      Raw:    19871 c/s real, 19795 c/s virtual
CPUs:   40      Raw:    19849 c/s real, 19852 c/s virtual
CPUs:   41      Raw:    19788 c/s real, 19809 c/s virtual
CPUs:   42      Raw:    19841 c/s real, 19828 c/s virtual
CPUs:   43      Raw:    20012 c/s real, 19974 c/s virtual
CPUs:   44      Raw:    19947 c/s real, 19952 c/s virtual
CPUs:   45      Raw:    20055 c/s real, 20019 c/s virtual
CPUs:   46      Raw:    19994 c/s real, 19973 c/s virtual
CPUs:   47      Raw:    20094 c/s real, 20091 c/s virtual
CPUs:   48      Raw:    20190 c/s real, 20148 c/s virtual
CPUs:   49      Raw:    20340 c/s real, 20360 c/s virtual
CPUs:   50      Raw:    20271 c/s real, 20224 c/s virtual
CPUs:   51      Raw:    20456 c/s real, 20455 c/s virtual
CPUs:   52      Raw:    20596 c/s real, 20592 c/s virtual
CPUs:   53      Raw:    20411 c/s real, 20385 c/s virtual
CPUs:   54      Raw:    20503 c/s real, 20491 c/s virtual
CPUs:   55      Raw:    20372 c/s real, 20355 c/s virtual
CPUs:   56      Raw:    20274 c/s real, 20299 c/s virtual
CPUs:   57      Raw:    20347 c/s real, 20278 c/s virtual
CPUs:   58      Raw:    20343 c/s real, 20297 c/s virtual
CPUs:   59      Raw:    20299 c/s real, 20324 c/s virtual
CPUs:   60      Raw:    20360 c/s real, 20313 c/s virtual
CPUs:   61      Raw:    20395 c/s real, 20313 c/s virtual
CPUs:   62      Raw:    20423 c/s real, 20353 c/s virtual
CPUs:   63      Raw:    20364 c/s real, 20393 c/s virtual
CPUs:   64      Raw:    20352 c/s real, 20431 c/s virtual

Notes:

  • MPICH2 was compiled with the following flags :

./configure --enable-fast --enable-timer-type=gethrtime --enable-cache --enable-cxx --disable-f77 --disable-f90 --enable-threads --with-device=ch3:sock --prefix=/usr/local/mpich2

  • Results above are for 32-bit compilation of libraries and executables, there was no performance benefit to be seen when recompiled as 64-bit.

Room for improvements:

  • Analyse MPI performance, read Jack Dongarra paper ‘Review of Performance Analysis Tools for MPI Parallel Programs‘.
  • Use the Oracle Message Passing Toolkit (formerly Sun HPC ClusterTools) instead of MPICH, as its an optimised implementation for Solaris and includes Dtrace hooks.
  • Use the new hydra process manager, which is the default from MPICH2 1.3 releases onwards, instead of mpd.
  • Experiment with mpiexec CPU and cache binding options to reduce contention of hardware resources.
Follow

Get every new post delivered to your Inbox.