2015-01-09

802.1q VLAN HOWTO

from http://ubuntuforums.org/showthread.php?t=703387
=======================================================

Install the vlan package:
Code:
sudo apt-get install vlan
Load the 8021q kernel module:
Code:
sudo modprobe 8021q
Ensure that this module gets loaded after a reboot by adding to /etc/modules:
Code:
sudo  sh -c 'grep -q 8021q /etc/modules || echo 8021q >> /etc/modules'
Configure the interface by editing /etc/network/interfaces:
Code:
sudo vi /etc/network/interfaces
and adding a stanza like this:
Code:
auto eth0.99
iface eth0.99 inet static
address 192.168.99.1
netmask 255.255.255.0
Then bring the interface up:
Code:
sudo ifup eth0.99
========================================================================
goal: several vlan-interfaces on top of a bonding trunk

first step: create the bonding config

- in /etc/network/interfaces:
Code:
 #auto bond0
iface bond0 inet manual
 pre-up ip link set bond0 up
 up ifenslave bond0 eth0
 up ifenslave bond0 eth1
 post-down ifenslave -d bond0 eth0 eth1
 post-down modprobe  -r bond0
second step: define the logical network link (repeat as to your needs)

- in /etc/network/interfaces:

Code:
 auto bond0.911
 allow-hotplug bond0.911
 iface bond0.911 inet static
 address 10.20.50.18
 netmask 255.255.255.192
 network 10.20.50.0
 broadcast 10.20.50.63
 gateway 10.20.50.2
 pre-up /etc/network/bondingstate UP bond0 911
 post-down /etc/network/bondingstate DOWN bond0 911
third step: glue them together

- in /etc/network/bondingstate:
Code:
# Script /etc/network/bondingstate
# wird aufgerufen aus /etc/network/interfaces
# 04.09.2007, no copyright
#
 
# Variablen setzen

set -x
CHANGE_STATE=$1
TRUNK=$2
VLANID=$3

case $CHANGE_STATE in
  UP)
    #egrep "$TRUNK" /etc/network/run/ifstate >/dev/null 2>&1
    if [ ! -f /proc/net/bonding/$TRUNK ] ; then
      ifup $TRUNK
      if [ $? -ne 0 ] ; then
        exit 1
      fi
    fi
    vconfig add $TRUNK $VLANID
    ;;

  DOWN)
    vconfig rem $TRUNK.$VLANID
    egrep "$TRUNK\.[0-9]+" /etc/network/run/ifstate >/dev/null 2>&1
    if [ $? -ne 0 ] ; then
      if [ -z "$VLANID" ] ; then
        exit 0
      else
        ifdown $TRUNK
      fi
    fi
    ;;
esac
What happens:

'auto bond0.911' starts setting up the interface.
'pre-up' calls bondingstate
bondingstate tests whether the bonding module is loaded,
then starts bonding, if need be.
'iface bond0' enslaves the physical NICs, then returns success
bondingstate adds the given vlan ID and returns success
'auto bond0.911' configures IP-addresses and returns success

Configuring additional links is but a copy of 'bond0.911'

On shutdown, 'post-down /etc/network/bondingstate DOWN bond0 911'
calls bondingstate, which in turn checks in /etc/network/run/ifstate
whether this is the last vlan interface and if so, shuts down bond0
bond0's post-down then will remove the kernel module

There might be routing issues. Beware of the order in /etc/network/interfaces.

2014-05-27

erlang-r17-on-osx-with-wx-and-a-working-observer

Erlang uses wxWidgets, a cross platform GUI library for it’s GUI tools. This build dependency was hard to get working pre-17, especially for 64-bit Erlang. However, 17.0 brings double rainbows and care bears for everyone that reads this HOWTO. So Enjoy!
nonode@nohost

Set correct Xcode path for compilation

As far as I know you need have Xcode install to compile Erlang from source. You can download Xcode via the Mac App Store
If you have multiple versions of Xcode installed (beta’s for example), make sure the Command Line Tools are installed and are pointing to the correct Xcode version.
Initiating an install of the Xcode Command Line Tools:
1
$ xcode-select --install
And verify that the CL-tools point to the correct Xcode install
1
$ xcode-select -s /Applications/Xcode.app/Contents/Developer

Install wxWidgets

wxWidgets is a Cross Platform GUI library that’s used by Erlang for applications like Observer.
Execute this line and get some coffee, walk the dog, take out the trash and/or play with your kids. Compilation takes a while.
1
2
3
4
5
6
$ curl -O http://optimate.dl.sourceforge.net/project/wxwindows/3.0.0/wxWidgets-3.0.0.tar.bz2
$ tar xvjf wxWidgets-3.0.0.tar.bz2
$ cd wxWidgets-3.0.0.tar.bz2
$ ./configure --with-cocoa --prefix=/usr/local
$ make && sudo make install
$ export PATH=/usr/local/bin:$PATH
Check that you got the correct wx-config
1
$ which wx-config

Install kerl

Kerl is a utility that helps you build and manage multiple instances of Erlang/OTP.
1
2
$ curl -O https://raw.github.com/spawngrid/kerl/master/kerl
$ chmod a+x kerl
Create ~/.kerlrc. I use $ vim ~/.kerlrc.
Add these lines:
1
KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac --enable-shared-zlib --enable-dynamic-ssl-lib --enable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --with-wx"

Build & Install Erlang with kerl

1
2
$ kerl update releases
$ kerl build 17.0 17.0
For a 32-bit Erlang prefix kerl build with CPPFLAGS:
1
$ CPPFLAGS="-arch i386" kerl build 17.0 17.0
Install:
1
$ kerl install 17.0 ~/erlang_17_0
Activate:
1
$ . ~/erlang_17_0/activate
And bliss out on your new wx-enabled Erlang:
1
$ erl -s observer start