This summer, my two children have expressed an interest in learning about what daddy does. I’ve never taught kids to program before, but I wanted to share what we’ve been working on so far.

The first thing that we did was find good logic computer games to work on. The best I’ve found so far is lightbot. You give a little robot commands and even call functions to tell him how to move and light up tiles. The downside to this game is that it gets challenging very fast. First and second graders can’t really handle nested loops too well when starting out.

http://armorgames.com/play/2205/light-bot

After some experience with lightbot, we were able to translate some of those concepts directly into the KTurtle environment on Edubuntu linux. KTurtle is a graphical drawing program that moves a pen (the turtle) around a canvas. You move the turtle by issuing text commands such as “forward 100″ and “turnright 90″. I’ve given the kids some challenges to work toward on our white-board. For anything that required a bit of trig and the Pythagorean theorem, I gave them the numbers.

IMAG0015.jpg

How do you teach kids to program? What suggestions do you have for me?

Post to Twitter

Posted by Andrew, filed under Linux. Date: June 2, 2010, 9:18 am | 1 Comment »

If you followed my previous post, you know I dug into some serious networking in order to get myself some static IP addresses. As of today, FlexJunk has officially become self-hosted. Since fixing the IP issues, I’ve built a new server box to house flexjunk.com. I had never built a rack-mount system, so this was my first foray into that arena.

Specs:
Ubuntu Server 9.10 64-bit OS
IStarUSA WO2-15B 15U Open Frame Rack
ARK 4U-500-CA Black Rackmount case
Intel Core i7 2.66GHz
12GB DDR3 1600 Ram
6x Seagate Barracuda 7200rpm 80gb drives (RAID 5)

Post to Twitter

Posted by Andrew, filed under Linux. Date: February 9, 2010, 10:31 am | No Comments »

I recently purchased a block of 8 Static IP addresses for use with my U-Verse plan. U-Verse has always been a very stable and reliable ISP for me the last two years and their price of $15/month was pretty good so I jumped. This gives me 5 usable IPs that I can use to host various websites.

I want to host websites on a machine on my internal LAN in the 192.168.x.x block, but use port forwarding on my firewall so that port 80 can be sent on through. The reason for this is mostly so that I can access the server machine on the internal LAN, host print servers, etc… while still using it as a secured internet webserver.

Normally, ISPs give you a block of IP addresses, you assign them in your router and send them on where you want to go. Not so with U-Verse. Each static IP is actually dynamically assigned via DHCP from the U-Verse gateway router box. Each IP address pulled dynamically off the gateway MUST have a different mac address. Unfortunately, most off the shelf firewall routers don’t support this capability. They have one, maybe two, mac addresses that they use. Normally, the uplink port has a single mac address that it pulls a dhcp ip address from.

I’m using a D-Link DIR-615 rev. C that I had laying around and noticed that OpenWRT listed it as a supported device. OpenWRT is custom firmware flash for routers that runs a small version of the Linux operating system on it. I figured if I could get Linux running on the device, then I’d be able to accomplish what I wanted…namely, pull all 5 usable IP addresses off the U-Verse gateway, and forward certain traffic on a per-IP/port basis to particular internal LAN machines.

I first downloaded an OpenWRT package (http://downloads.openwrt.org/snapshots/trunk/ar71xx/openwrt-ar71xx-dir-615-c1-squashfs.uni) for my router. I then held in the reset switch for 30 seconds while plugging in the power. This puts the router into recovery mode. I manually set my computer’s ip address to 192.168.0.2 and navigated to http://192.168.0.1 which brings up the recovery flash page of router where I could apply the .uni flash file for OpenWRT.

I reset my computer’s ip to dynamic and restarted the router. After all the lights stopped blinking, made sure I had a valid 192.168.1.x IP address and did

telnet 192.168.1.1

This brought me up to the linux shell of the router. I ran the passwd command to set my root password for the device and then exited the shell. Once the password for root is set, telnet becomes disabled, but SSH is enabled. I then used putty to connect to 192.168.1.1 again.

Next, I installed the packages ip and kmod-macvlan. These packages allow you to create virtual ethX adapters with separate mac addresses.

opkg update
opkg install ip
opkg install kmod-macvlan
opkg install hostapd-mini
opkg install luci-admin-full  
opkg install luci-fastindex
opkg install luci-app-firewall

I modified /etc/rc.local to create the virtual adapters.

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

#AMW edits
ip link add link eth1 eth2 type macvlan
ifconfig eth2 hw ether 00:24:01:f5:1b:84

ip link add link eth1 eth3 type macvlan
ifconfig eth3 hw ether 00:24:01:f5:1b:85

ip link add link eth1 eth4 type macvlan
ifconfig eth4 hw ether 00:24:01:f5:1b:86

ip link add link eth1 eth5 type macvlan
ifconfig eth5 hw ether 00:24:01:f5:1b:87

ip link add link eth1 eth6 type macvlan
ifconfig eth6 hw ether 00:24:01:f5:1b:88

ifup -a

route add default gw 75.30.80.1 dev eth1

ntpclient -c 1 -s -h ntp1.dlink.com

exit 0

eth0 is my local LAN interface. eth1 is my main outgoing public internet interface. eth2-6 are virtual macvlan interfaces that will each hold one of the static ip addresses. I also modified the file /etc/config/network so that the new virtual adapters would be included in dhcp setup.

config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.0.0.0'

config 'interface' 'lan'
        option 'ifname' 'eth0'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '192.168.1.1'
        option 'netmask' '255.255.255.0'

config 'interface' 'wan'
        option 'ifname' 'eth1'
        option 'proto' 'dhcp'

#First static IP
config 'interface' 'wan1'
        option 'ifname' 'eth2'
        option 'proto' 'dhcp'
        option 'defaultroute' '0'
        option 'peerdns' '0'
        option 'gateway' '0.0.0.0'

#second static IP
config 'interface' 'wan2'
        option 'ifname' 'eth3'
        option 'proto' 'dhcp'
        option 'defaultroute' '0'
        option 'peerdns' '0'
        option 'gateway' '0.0.0.0'

#third static IP
config 'interface' 'wan3'
        option 'ifname' 'eth4'
        option 'proto' 'dhcp'
        option 'defaultroute' '0'
        option 'peerdns' '0'
        option 'gateway' '0.0.0.0'

#fourth static IP
config 'interface' 'wan4'
        option 'ifname' 'eth5'
        option 'proto' 'dhcp'
        option 'defaultroute' '0'
        option 'peerdns' '0'
        option 'gateway' '0.0.0.0'

#fifth static IP
config 'interface' 'wan5'
        option 'ifname' 'eth6'
        option 'proto' 'dhcp'
        option 'defaultroute' '0'
        option 'peerdns' '0'
        option 'gateway' '0.0.0.0'

I made sure to set the gateway option on all of the virtual adapters to 0.0.0.0 so that the regular default gateway of eth1 would be used instead of the static IP default gateways.

After re-booting the router, I navigated to the U-Verse gateway and configured each of my new mac addresses so they mapped to the static IP addresses instead of internal 10.0.0.x ones.

After rebooting the router one last time, I now had all of my static IPs assigned on the router and could install and utilize the LuCI interface for configuring routing and port forwarding.



Post to Twitter

Posted by Andrew, filed under Linux, security. Date: January 6, 2010, 11:41 am | 17 Comments »

WCAP On Gentoo-64

WCAP On Gentoo-64

Being an uber-geek, running a standard linux distro just isn’t enough excitement for me. For my business’s server, I run Gentoo linux. I use it mostly for subversion, but I also wanted to try out some AIR apps on it. The first hurdle to overcome was that AIR is a 32-bit app and my Gentoo install is 64-bit. I needed to emerge two libraries to get the necessary 32-bit versions of them.

emerge -av emul-linux-x86-baselibs emul-linux-x86-gtklibs

I tried running the standard AIR installer for linux, but got stuck when it said that I could only install on debian based systems like Ubuntu.
To get around this, download the AIR-SDK: http://www.adobe.com/products/air/tools/sdk/

I untar’d it to AIR-SDK in my home folder.

mkdir ~/AIR-SDK<br />
cd ~/AIR-SDK<br />
tar -xvjf ~/air_1.5_sdk.tbz2

Next, I downloaded WCAP Pro and unzipped it to AIR-APPS/wcap

mkdir ~/AIR-APPS/wcap<br />
unzip WCAPPro.air -d ~/AIR-APPS/wcap

Finally, I created a desktop shortcut to run as the root user and setup my icon for it.

/home/westbam/AIR-SDK/bin/adl&nbsp;-nodebug&nbsp;/home/westbam/AIR-APPS/wcap/META-INF/AIR/application.xml&nbsp;/home/westbam/AIR-APPS/wcap/

I had tried to run it as a normal user, but the system would only work when I ran it as root. I’m not quite sure yet why it requires root access to work correctly.

Post to Twitter

Posted by Andrew, filed under AIR, Linux. Date: January 3, 2009, 12:14 pm | No Comments »