lunes 9 de noviembre de 2009

man date: %C: century; like %Y, except omit last two digits (e.g., 20)?

Oh, really? The only problem that I find in that statement is that it would be correct on the very last year of a century. I mean We are in 2009 and our century is the 21st, right?
Well, let's see what date says about our century:

$ date +%C
20

Lovely! What about in 1999?

$ date -d 19990303 +%C
19

So in 1999 being the 19th century, the closest thing I was to using a computer was an abacus (considering I was a windows user at the time we can agree I was actually using something next to an abacus).

And what about the last year of the 20th century?

$ date -d 20000303 +%C
20

Only then the definition provided by 'man date' does match the actual century for a certain year. And before people start complaining about 2000 being the first year of the 21st century instead of the last of the 20th century:
The year 0 doesn't exist in our calendar. Remember the gregorian calendar is roman based and romans didn't know the concept of 0, therefore no year 0. Theoretically speaking, from Dec 31st 1 BC, you'd have jumped into
Jan 1st 1 AD. If the first year of the first century is 1 AD and the last is 100, the first year of the second century is 101, the first year of the 20th century would be 1901 and the last would be 2000 and the first of the 21st century would be 2001 and so on. I used to discuss about this very same point with my Music History professor at the Conservatory in Maracaibo and we'd get into all kinds of philosophical questions about when it was 0, the limit between year
1 BC, 1 AD and so on and we'd never get to a point. My best wishes for my dear professor Osvaldo Nolé, by the way.

More info:
- http://en.wikipedia.org/wiki/Year_zero
- http://en.wikipedia.org/wiki/Gregorian_calendar

sábado 3 de octubre de 2009

3com 3CRWER101U-75: Not working.

Hi!

I went shopping to the mall that is around my house for a wireless router this morning. I didn't want to spend a lot of time on it so I basically bought the (almost) first router that I saw. It's a 3com router. A 3CRWER101U-75 (model WL-550, I think). I bought it thinking that it'd be a reliable router, even if it wasn't very powerful. As long as my wife could be connected to the net from our room, it'd be more than enough.

So, I arrived home about 4 hours ago. Since then I've been trying to get the damn thing to work properly and I just haven't been able to get it to work.

If I try pingin the router from a box that is connected to it by wire, the connection is intermittent:

64 bytes from 192.168.200.1: icmp_seq=3594 ttl=64 time=0.384 ms
64 bytes from 192.168.200.1: icmp_seq=3595 ttl=64 time=1.14 ms
64 bytes from 192.168.200.1: icmp_seq=3596 ttl=64 time=0.678 ms
64 bytes from 192.168.200.1: icmp_seq=3597 ttl=64 time=0.467 ms
64 bytes from 192.168.200.1: icmp_seq=3598 ttl=64 time=0.563 ms
64 bytes from 192.168.200.1: icmp_seq=3599 ttl=64 time=0.789 ms
64 bytes from 192.168.200.1: icmp_seq=3609 ttl=64 time=9770 ms
64 bytes from 192.168.200.1: icmp_seq=3619 ttl=64 time=0.435 ms
64 bytes from 192.168.200.1: icmp_seq=3620 ttl=64 time=0.401 ms
64 bytes from 192.168.200.1: icmp_seq=3621 ttl=64 time=0.421 ms

See the wholes between 3599 and 3619? How about that?

Talking about the wireless, the only setting that is close to working is setting it to use WPA/WPA2 Only with TKIP+AES. And I say close because I only get to connect to the wireless on GNU/Linux with wpa_supplicant (running on the console) and even then it disconnects quite often. On windows, it's a no-go. And I'm talking about boxes that are less than 2 mts from the router while I do my testing.

Is it that I'm putting it under too much of a load while I do my testing? It's a very small router so I don't expect it to behave as a high-end router.... but even then... what's the firmware based on? Windows Vista?

I just can't believe it, really. I thought 3com products where reliable. At least this router doesn't make the company look good. What should I do? Is there a firmware update or something? Somebody help me, please!

PS I should have heard recommendations from a friend of mine who told me to get a WRT54G router instead, but I didn't get to see any at the mall, so....

Update 1
The wired connection has been working much more reliably today. So far, I haven't had any disconnections so far. However, the wireless is another story. Though the wireless can be seen by hosts, I can't connect to it:

CTRL-EVENT-SCAN-RESULTS
Trying to associate with 00:1e:c1:a2:3f:ec (SSID='Enfermitos' freq=2422 MHz)
Association request to the driver failed
CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys
Authentication with 00:00:00:00:00:00 timed out.
CTRL-EVENT-SCAN-RESULTS
Trying to associate with 00:1e:c1:a2:3f:ec (SSID='Enfermitos' freq=2422 MHz)
Association request to the driver failed
CTRL-EVENT-DISCONNECTED - Disconnect event - remove keys
Authentication with 00:00:00:00:00:00 timed out.
CTRL-EVENT-SCAN-RESULTS
Trying to associate with 00:1e:c1:a2:3f:ec (SSID='Enfermitos' freq=2422 MHz)
Association request to the driver failed

What should I try?

miércoles 9 de septiembre de 2009

dhcp-lb 0.02

Hello!

You might have read about dhcp-lb when I announced it a couple of weeks ago. It's a suite (sui generis :-) that is used to keep multi-path routing configured when you use dhcp up-links.

After it was tested at the Hospital where I used to work before, we noticed a problem and I decided to enhance the script over that discovery so I'm announcing dhcp-lb 0.02. Go get it from here.

Not much has changed, as a matter of fact. The thing is that you can tell dhcp-lb what static interfaces you are using besides the up-link. Those static interfaces are not involved in the multi-path routing (just yet), by the way... so if you have a provider that has a static configuration and another that uses dhcp, the script is not ready to handle that... but it will come... someday (hopefully in the rather not too distant future).

So, say you have interfaces eth1 and eth2 used for internet (dhcp) where eth2 has double the bandwidth of eth1 and a static connection to your intranet on eth0, the configuration file will look like this now:

dhcp-lb eth1 table-eth1 200 1
dhcp-lb eth2 table-eth2 201 2
static eth0

I also included some checkups for the configuration file (more than one space or tab can be used between the components of a configuration line, empty lines are welcome, etc.. but more checkups are still missing, I'm sure). Feel free to use it (and I thank you for using it if you do) and tell me how it goes.

Bye!

PS Thanks go to Overt Barreto at the Hospital of Pediatric Specialties in Maracaibo, Venezuela for taking the time to test the script... he had to anyway but it's always nice to have a person tell you when something goes wrong.

viernes 4 de septiembre de 2009

Carta abierta a rector de la UTN (Argentina)

Buenos días!

Soy un ingeniero de computación venezolano que vive en colombia. Acabo de enterarme de que la UTN canceló una charla del Sr. Richard Matthew Stallman a darse en su Universidad. Dicha charla, según la fuente, fue cancelada por contratos que la UTN tiene con Microsoft que impiden que se hagan críticas sobre dicha empresa.

Creo que de más está decir que debería darles _pena_ haber cancelado la charla de una persona tan importante dentro del mundo de las tecnologías como RMS por razón de dichos contratos. Cualquier mortal se vería tentado a pensar que la universidad debería ser un ambiente para el desarrollo libre de las ideas/expresión.... claro, siempre y cuando dicha universidad no tenga un contrato con alguna compañía que se lo impida.

Ojalá se den cuenta de su error y decidan llevar adelante la charla... incluso si eso implica la cancelación de los contratos (total... hay bastante software libre por ahí que les servirá para las mismas funciones y sin un contrato restrictivo). Creo que en este caso hay suficientes bases desde el punto de vista moral (como se acaba de ver con este ejemplo) como para que su universidad decida rescindir de ellos.

Muchas gracias por su atención.

sábado 29 de agosto de 2009

Popping GNU/Linux out of the Virtual Machine

Hi!

At work I'm tied to a windows machine, however I have been able to use GNU/Linux which is where I'm most productive.

First, I tried working with Portable Ubuntu. It works pretty well, however the latency can be a little high sometimes (Firefox being the most obvious case that I noticed).

About a week ago I started working on a clustering experiment and wanted to give it a shot inside Portable Ubuntu. However, I discovered it wasn't possible because its kernel doesn't support bridging (I was going to use some qemu virtual machines for the experiment).

Well, It seemed like I was going to need a virtual machine to host the experiment after all. I have used qemu and love it because of all the networking tweaking it allows you to do, however it can be very slow... and inside the virtual machine I was going to host more virtual machines, so I decided to use something else, at least on the hosting virtual machine.

I tried VirtualBox and was gladly surprised by its performance. It was veeeeeeeeeery fast.

Got Kubuntu installed on it. It works acceptably. Now the problem with virtual machines where you have a window that represents the computer's monitor is that you have to use key combinations to get in and out of the virtual machine environments.... plus the windows in the virtual machine are inside a window that looks not integrated to the real environment.

But then a truck hit me. How about finding a way to get the windows out of the virtual machine? How about using an X server on Windows (XMing, for example) and configure the Virtual Machine to use that X server. kdm can be configured to use a remote X server.

If you check /etc/kde4/kdm/kdmrc (remember it's Kubuntu, so I'm using KDE... gdm must have something similar), in the [general] section, there's StaticServer and it's set to :0 (in other words, the X server of the host). I changed that to say 10.0.2.2:0.0 (the address of the windows box from VirtualBox):

StaticServer=10.0.2.2:0.0

Then I started XMing (XMing included in Portable Ubuntu, by the way) with -rootless, so that I got no decoration for the X server window, then I restarted the kdm service on the virtual machine and there it is! kdm is displayed on the windows environment. Log in to kde and after a moment of not seen anything on the X server screen I get to see KDE's background, plasma panels and everything else. Cool! The windows are not integrated in windows, but I don't have to get in/out of the Virtual Machine screen anymore.

The only thing I'd have to complain about so far is that sometimes the latency on KDE gets too high and I don't know how to avoid it. I tried with the windows XMing and cygwin's XWing but I got the same latency issue. How can that be avoided?

Picture
The picture I'm including is the same thing running off a Kubuntu 9.04 LiveCD on my wife's box (shhhhhhhhhhh, she better not hear about it).

Sidenote
When I log into kde, depending on the resolution of Windows (the real OS of the machine), KDE's splashscreen is seen or not.

sábado 22 de agosto de 2009

dhcp-lb: Load balance with DHCP links

Hi!

Some years ago, when I worked at the Hospital of Pediatric Specialties in Maracaibo, I did a project that would update routing for our multi-link internet connection when there was a DHCP event. I decided to redo the whole thing using a simpler approach plus I would release the code without asking for permission (as it's mine now) under Affero GPLv3.

Introduction
So, you have read lartc's guide on 'Routing for multiple uplinks/providers' and it all makes sense (and does work). However, there's a catch for you: Instead of having static network configurations, your ISPs use DHCP to set your network connections and you don't intend to sit all day long waiting for DHCP event to happen to reconfigure the whole thing, do you? That's what I thought.

dhcp-lb
In order to solve the problem I just described I created dhcp-lb. It's a python script that, once configured and linked as a dhclient exit hook, can listen to dhcp events and reconfigure networking accordingly.

What I need
You need python, dhclient, iproute2 (that I think will come by default in almost every distro) and a multipath-enabled kernel (check for CONFIG_IP_ROUTE_MULTIPATH, I think).

How to get it?
Right now, the only way to get it is through bazaar from launchpad's branch I set for it. I have created a PPA, but I have to learn how to use it so be patient (maybe someone can help me in this journey). If you want it but don't want to use bazaar to get it, email me and I'll gladly send you a tgz with it.

Configuration
Configuring it is fairly simple. You need to create a file called /etc/dhcp-lb with the configuration of each link involved in the multilink default route. Each line has the configuration of each link and it has four fields (so far):
- Network Interface
- Routing Table for that interface
- Routing Table ID (numeric, less than 255... check /etc/iproute2/rt_tables)
- Weight (numeric, more than 0)
All 4 fields have to be separated by exactly a single white space at this time. One example /etc/dhcp-lb file would look like this:

# interface routing-table table-id weight
eth0 table-eth0 200 1
wlan0 table-wlan0 201 2

In this example I set wlan0 to have twice the routing weight of eth0 (for example, eth0 is 512 kbps and wlan0 is 1 mbps). Also, if the routing tables are not set in /etc/iproute2/rt_tables, dhcp-lb will take care to add them to that file, so no need to change rt_tables beforehand.

After you have done that, all you need to do is link /usr/bin/dhcp-lb into the exit hooks directory (/etc/dhcp3/dhclient-exit-hooks.d in my case) and you are done. Restart the network service and it should start working right away.

Keep in mind
dhcp-lb only configures routing with multiple uplinks and it doesn't correct any of the shortcomings that come along having multiple uplinks. It only reconfigures routing with dhcp events. What are the shortcomings? That would require a blog posting of its own, but this is the most noticeable (at least, to me):

- Balancing works beautifully for multiple short connections from your LAN. Few long connections? It won't look like it's balancing at all. It's because of the way routing works. The kernel doesn't make a routing decision for every packet that goes out of a box. Instead, it uses a routing cache to associate a target IP with the network interface it chose to use to get to it so it doesn't have to make a routing decision again... and the cache lasts for a few minutes (run this command: ip route show cache to take a look at the actual cache). After a while, it can decide to send packets to that same host through another network interface possibly breaking connections established to that host cause the other host will start receiving packets from a different address.

Conclusion
I hope this project helps you. However, this project is (as you can see from the logs) very young so expect it to have some problems (that I'll be working to solve). Have patches for it? Please, send them without hesitation. I'm open to suggestions and donations if you consider I deserve any.

Update
I just released dhcp-lb 0.02 (sep 9th 2009). Check this post to learn more about it.

domingo 16 de agosto de 2009

[OT] Adsense: Get scientology out of my site!

I set up Google's adsense on this blog. It's not being making all the truckloads of money I expected from it, but it's better than nothing nevertheless.

However, since a couple of weeks ago, the only advertisements I've seen on those spaces are dedicated to Scientology... at least on the computers I've been able to check for it.

Now, I've got a problem with that... and it's not because I don't like Scientology per se. It's just that I don't have any sympathy for any religion in particular. And come on, if there's an advertisement of Scientology every once in a while, I can let it slip through... but EVERY AD for the last couple of weeks? That is a little too much for my religious tolerance.

So, guys at Adsense, get rid of the Scientology ads on my site.... or even better, set up a page so that I can ban some ads I don't want to see on my site (like religious ones, for example).

Thanks in advance to anyone who can help in this regard.