I love doing it manually as well, but is there some reason you have to do this manually? Network Manager or WICD isn't sufficient?