A collection of thoughts, tips, musings and the occasional recipe. Basically all the stuff I am supposed to remember.

Setting up IPv6 connectivity for my home LAN and my laptop

Our ISP has been saying that they will be rolling out a trial of IPv6 for more than 3 years now. Since this does not appear to be forthcoming I decided instead to make use of an IPv6 tunnel.

This tunnel behaves in much the same way as a VPN tunnel. You use IPv4 to connect to an endpoint, then use IPv6 addresses on the tunnel virtual interfaces. I used the Hurricane Electric tunnelbroker.net for my home IPv6 access, and a sixxs.net AYIYA tunnel for my laptop when away from home. I chose the AYIYA for my laptop since it is NAT friendly and is a better choice if your IPv4 address changes regularly. Both services are free.

Since I have a simple Linux machine as my main router this was actually a straightforward process. If you have a router that supports IPv6 tunnels, this can be even easier. In my case I had to setup the tunnel interface in /etc/network/interfaces (this is a Debian install, this should be the same for Ubuntu). The actual IPs have been obfuscated):

iface eth1 inet6 static
address 2001:a:b:c::3
netmask 64

auto he-ipv6
iface he-ipv6 inet6 v4tunnel
address 2001:aaaa:b:cccc::2
netmask 64
endpoint 216.218.226.238
local 1.2.3.4
ttl 255
gateway 2001:aaaa:b:c::1

kwin crashes after enabling nVidia optimus in Ubuntu 13.10

After enabling the nvidia drivers for my optimus based laptop (Intel iGPU + nvdia discreet GPU), kwin crashed regularly. The main symptom was that application windows would not respond to mouse clicks, even though the mouse cursor still responded.

The fix was to create some symlinks in /usr/lib that pointed to a specific OpenGL library as apparently the nvidia OpenGL library was getting called by default (this should not be the case since optirun should be loading the nvidia libraries at run time).

  1. sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so /usr/lib/libGL.so
  2. sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/libGL.so.1

This seems to have corrected the issue for now.

Connecting to ProXPN with Linux

I recently heard about the VPN service from ProXPN. Since they were using OpenVPN under the hood I thought that it would be pretty straightforward to get running on my Ubuntu laptop (running 12.10 at the time of writing this). I have Vyper VPN (also using OpenVPN) working on this exact same configuration.

It turns out that officially there is no support for Linux, and the only downloads were .dmg (OsX), and .exe (windows)files. This was not looking good.

What I did first was to use 7zip to extract the contents of the downloaded .exe file. In the extracted folder was a folder called "config". In this folder was the .ovpn config file, was well as a folder called "ssl" which contained all of the required certs:

  1.  ls config/ssl
  2. ca.crt  client.crt  client.key

With this information I was able to build a command line to connect to the ProXPN service. The only two missing pieces was an auth.txt file containing my ProXPN username (an email address) and password. This is the same username and password you used to register with them.

Mounting Virtualbox Shared Folders in Linux

Shared folders are pretty easy to access. It turns out that is also pretty easy to do under Linux as well.

  1. sudo mount -t vboxsf -o umask=000 sharename /path/to/mount/point

The only catch is that you need to create the mount point first, just like most other file systems.

Client side SSH keep alives

I was looking for a client side keep alive since I do not have administrative access to all the machines I ssh in to.

Basically you create or edit the following file in your home directory:

  1. $HOME/.ssh/config

and in this file you enter the following line:

  1. ServerAliveInterval 60

Change the interval to whatever you like, I find once per minute is usually good enough and there does not seem to be any performance impact.

I found this tip at the following site:
http://madphilosopher.ca/2005/07/an-ssh-keep-alive-tip/

Updated CPU frequency scaling script

This is an update to my earlier command line frequency scaling script. This version uses the dialog utility to provide a rudimentary GUI.

  1. #!/bin/bash
  2. # Wrapper to easily set the CPU Frequency Governor
  3. # dialog is a utility installed by default on all major Linux distributions.
  4. # But it is good to check availability of dialog utility on your Linux box.
  5.  
  6. which dialog &> /dev/null
  7.  
  8. [ $? -ne 0 ]  && echo "Dialog utility is not available, please install it" && exit 1
  9.  
  10. # Check that a valid governor is set
  11.  
  12. # Creating an array with each of the CPUs numeric ID
  13. declare -a  CPUs=( `cat /proc/cpuinfo |grep processor |cut -f 2 -d \:` )
  14.  
  15. # Setting up the dialogue interface:
  16.  dialog --clear --backtitle "Console Based CPU Governor Selection" --title "MAIN MENU" \
  17.     --menu "Use [UP/DOWN] key to move" 18 100 6 \
  18.     "performance" "Set for maximum performance, watch the temp!" \
  19.     "ondemand"  "Usually the default, scale speed up as required." \
  20.     "conservative"    "Conservatively scale up as required." \
  21.     "powersave"     "Maximum power savings or lowest temp." \
  22.     "userspace"      "Send control to a userspace application." \
  23.     "EXIT"      "TO EXIT" 2> menuchoices.$$
  24.  
  25. # This computes the number of elements in the array, we use this to control our loop in the SetSpeed function
  26. elements="${#CPUs[*]}"
  27.  
  28. SetSpeed ()
  29. {  

Syndicate content