AWG Blogs

Thursday, June 18, 2009

Ubuntu Default Gateway

auto eth0 -- sets eth0 to come up on /etc/init.d/networking restart

tip: put auto eth1 before auto eth0 in /etc/network/interfaces in order to make eth0 the default gateway

Wednesday, June 17, 2009

vtun Experimentation

So I get fresh stable (ubuntu LTS 8.04) Ubuntu, get all updates.
then apt-get install bridge-utils (per http://blog.kovyrin.net/2006/04/05/connecting-two-remote-local-networks-with-transparent-bridging/)
then:
apt-get install uml-utilities
tunctl -u root -t tap0
ifconfig tap0 0.0.0.0 promisc up

then apt-get install vtun

on both client and server:
modprobe tun

then put at end of /etc/network/interfaces (note: create bridge dynamically through vtun program commands instead?):
auto br0
iface br0 inet static
address 192.168.1.200 (199 for server)
netmask 255.255.255.0
bridge_ports eth0

then ifup br0

on client /etc/vtund.conf

options {
port 5000;
timeout 60;

# Path to various programs
ifconfig /sbin/ifconfig;
route /sbin/route;
firewall /sbin/iptables;
}

IP-Tunnel {
passwd abcd1234; # Password
type ether; # Ethernet tunnel
device tun0;
up {
# Connection is Up
ifconfig "%% up";
program "brctl addif br0 %%";
};
down {
# Connection is Down
ifconfig "%% down";
};
}




On server /etc/vtund.conf:
options {
# type stand;
# stand(default), inet (used only at server)
port 5000;
# Server will listen on this port for incoming requests.
syslog daemon;
# Syslog facility

# Path to various programs
ppp /usr/sbin/pppd; #Path to the pppd. Use "which pppd" to find this.
ifconfig /sbin/ifconfig;
route /sbin/route;
firewall /sbin/iptables;
ip /sbin/ip;
}
# Default session options
default {
type ether;
#tun, ether, tty(default), pipe (Used only at Server)
proto udp;
#udp, tcp(default) (Used only at server)
# device tun0;
compress no;
# no, yes, zlib:(1-9), lzo:(1-9); e.g. zlib:1 (default) (Used only at server)
encrypt no;
#yes, no (used only at server)
stat yes;
#yes, no: check /var/log/vtund/SessionName_X
speed 0;
#By default maximum speed, NO shaping (Used only at server)
keepalive yes;
#Used to keep alive the connection. (Used only at server)
}
# TUN example. Session 'cobra'.
IP-Tunnel {
passwd abcd1234; # Password
type ether; # IP tunnel
proto udp; # UDP protocol
device tap0;
compress no; # lzo:9; # LZO compression level 9
encrypt no; # Encryption
keepalive yes; # Keep connection alive
stat yes; #yes, no

up {
# Connection is Up
# 10.3.0.1 - local, 10.3.0.2 - remote
# ifconfig "%% 192.168.254.201 pointopoint 192.168.254.200 mtu 1450";
# route "add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.254.200";
ifconfig "%% up";
program "brctl addif br0 %%";
};
down {
# Connection is down
# 10.3.0.1 - local, 10.3.0.2 - remote
ifconfig "%% down";
# route "del -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.254.200";
};

}

then on server, vtund -s (change port to 5000?)

then on client: vtund IP-Tunnel 172.16.2.16 (real of IP of server).

other references:
recompile kernel http://www.howtogeek.com/howto/ubuntu/how-to-customize-your-ubuntu-kernel/

check Universal Tun/tap device driver support under Device Drivers > Network device support

try tunctl to create tap, e.g. http://www.mail-archive.com/vtun-users@lists.sourceforge.net/msg00001.html

try steps here: http://adamolson.com/articles/UnixReview.com%20%20Secure%20Tunneling%20between%20Intranets%20with%20VTun%202000.htm
or here: http://www.opennet.ru/soft/vpn_table/vtund1.html

read http://vtun.sourceforge.net/setup.html

tips for manual setup: http://www.blindhog.net/linux-bridging-for-gns3-lan-communications/

and http://www.linux.com/archive/articles/54894 vtun tutorial

bridging in Linux: http://www.linuxfoundation.org/en/Net:Bridge

http://dkprojects.wordpress.com/transparent-ethernet-bridge/ - transparent bridge (hub)

Sunday, March 22, 2009

TortoiseSVN - Quick Start

TortoiseSVN repository set up:

-Install TortoiseSVN
-Perform these steps in Windows Explorer:
-right click in new empty dir (named after your project) and
choose ToroiseSVN > create repository here. This will be your repository, so make note of its location.
-Then rightclick your project folder and click TortoisSVN > Import, Browse to the path to your newly created repository and hit ok. Alternatively, enter a path like file:///SVNRepos/MyProject
-Rename your project folder by appending ".bak" or anything
-Create a new empty folder next to your old folder having the same original name of the project folder
-Open the new empty project folder and right click in the empty folder and choose SVN Checkout...
-Make sure the path to your newly crated repository is under "URL of repository:" and hit OK

Now you have a version controlled project!

Saturday, March 7, 2009

Thoughts on Ruby on Rails

Was doing some research on the pros and cons of ROR and came across this article. A snippet:

Rails is designed from the ground up to create dynamic Web sites that use a relational database backend. It adds key words to the Ruby programming language that make Web applications easier to configure. In addition, it's designed to automatically generate a complete, if somewhat crude, Web application from an existing database schema. The latter is both Ruby's greatest strength and its Achilles' heel. Rails makes assumptions about database schema naming conventions that, if followed, make generating a basic Web site a matter of executing single command. But to do this may require additional configurations or in some cases may not be possible at all. You're also likely to find that just about every database convention that Rails expects can be overridden, but the more overriding that is needed, the less productive the platform becomes.

I knew this instinctively long ago when I did research debating whether to use an existing content management system (CMS) or create one from scratch. At that time, I was visiting blogs where followers of the ROR cult would rave about ROR and attack anyone that pointed out its flaws. There was this one guy in particularly that kept pointing to the database, and noting that the database design is too restrictive. He argued in favor of his own CMS, RADICORE, from which I got the idea to incorporate XSLT into my new CMS.

My opinion is that ROR is too tightly coupled to the database. The database design dictates the application. In that sense, it's a two-tiered application. I know next to nothing about ROR, but I've got friends and associates who work with it for a living. But I can't for the life of me understand the attraction of a platform that doesn't have a robust middle layer! Is there any concept of business objects in ROR?

Another article was linked to from the above article which lays out the restrictions and implications of a rails application:

Conventions that relate to legacy schema integration with Oracle and Rails include the following:
Tables are named in using the plural form of the model they represent. For example, an "employee" model maps to an "employees" table.
All tables that contain data that will be updated contain a primary key called "id."
In the case of Oracle Database, this primary key is incremented using a sequence with a name based on the table it increments. A table named "employees" that contains an "id" will be incremented by a sequence named "employee_seq."


Apart from the unappealingness of the restictions of how one must name the tables, I find something else more disquieting. The unspoken assumption in the Rails architecture is that tables map to entities in the traditional sense, i.e. that they reflect entities that appear perhaps in the real world and directly against which the application will perform its actions.

This makes integration of rails with one of my CMS's impossible, since the tables in my "MyEntityDB" framework are really meta-tables.

Then there's all those files in the "layouts" folder. That's another unspoken assumption that the design will reside in files. That makes another one of my CMS's impossible to work with Rails, because the design parts happen to reside in database table fields.

It also appears to be a cryptic version of Smarty.
Here's some sample ROR code from a downloadable app from here:

The embedded variables indicate a strong reliance on the application environment, which also I find disquieting. I prefer pure XSLT for the view layer, since it depends on XML for its data. That's what I use in my MyEntityDB framework, because it enforced complete separation between code and presentation (not just token separation as in Smarty Templates).


Saturday, February 21, 2009

Volts, Amps, and Watts, Oh my!

http://en.wikipedia.org/wiki/Volt

Had to read it twice before I realized that a Volt represents the potential power, while Amps represents the actual power. "Watts" represent the actual power as well, but it's the total power arrived at by multiplying amps by volts.

Another realization I had when researching power consumption constraints for a possible home data center was that the "watts" specification on the side of appliances is actually the measure of watts per hour (DUH!). So if the space heater is 1500 watts, that means it's using 1500 watts (1.5 kW) per hour (if it's turned on and set to High).

More notes:
Helpful discussion here.