Jan 122013
 

I bought a new wireless router (TP-Link N750 TL-WDR4300) that had fantastic hardware specs. It was to replace what I had been using, an Airport extreme, that was having problems dealing with the number of DHCP leases on my network. I also didn’t like the lack of flexibility in firewalling, DHCP options, and on and on. Basically the Airport worked great, but sticks to Apple’s design philosophy: user’s don’t really know what they want, so we’ll tell them. One thing I really liked about the Airport, however, was that it worked great with IPv6.

The new TP-Link router didn’t support IPv6, crashed a lot, would randomly stop routing bridged traffic between the wired and wireless interfaces, and did a pretty good job of pissing me off. It’s OS was based on an older version of either OpenWRT or dd-wrt; and this was the source of my problems. Since it wasn’t really working I decided to go ahead and drop OpenWRT’s latest snapshot on the router, I figured what do I have to lose.  (I am super happy with the results, what a great community project!)

I’m not going to cover how to install it, that’s well-enough documented at the OpenWRT site.  I am going to give a couple of pointers to getting IPv6 working on Comcast’s network.  It’s actually pretty easy once you install the right packages.  There are  different ways to get IPv6 working in OpenWRT, and this is the combination I got to work, I tried a lot of things.  Other setups might work better or not at all, I don’t know–I stopped once it worked.

opkgs you will want: Wide DHCP Client, and the route advertisement daemon. (You don’t need wide-dhcp-server.)

opkg install wide-dhcpv6-client radvd

First a couple of gotchas that tripped me up.

  • Comcast only delegates a /64 prefix (standard ISP practice is a /60,) which means a few things that at first tricked me …
    • You can’t subnet a /64, so at layer 3 you will talk to the upstream router using link local addresses.
    • The br-lan interface will get the delegated address.
    • The default config for wide dhcp6c assumes a /60 delegation, if you don’t change this you won’t get your lease.
  • By default the native IPv6 stack is configured to listen for route advertisements and send route solicitations.  This conflicts with what dhcp6c is doing. I’m not sure, but it might be possible to use the native IPv6 settings in /etc/config/network but I’m not sure if it works as expected with the /64 delegation; I was seeing the wan interface get the address assignment and not the internal layer-3 interface we would use as the default gateway.
    • If you are seeing strange behavior on your network this might be the cause … when I didn’t know better and had both native and dhcp6c enabled I would restart the network, or reboot the router and IPv6 would be working great.  A few hours later it would stop working.  I would also see that my clients had been assigned new network prefixes.  But they had not disabled the old ones (marked as deprecated but still listening.)  And I could’t route IPv6 anymore.

Here are some of my settings that got my OpenWRT routing IPv6 on Comcast (sorry, just config files I didn’t even install the web gui.)

Continue reading »

 Posted by on January 12, 2013
Oct 262012
 

(With  google returning more than a million hits for the search “bash PS1″, it may be a little presumptive that I have anything to add to the conversation, but this was an interesting exercise for me, so I’ll share it anyways.  Besides this may actually be my most nitpicky *nix nerd post yet.)

Here’s my brand new . . . super-duper space-saving, non-forking, color-changing PS1 prompt (that doesn’t mess up readline!)

export PS1='[\[\e[$(((($?>0))*31))m\]\h:\W\[\e[00m\]]\$ '

I happened across a blog post (8 Useful and Interesting Bash Prompts) covering different PS1 prompts that people are using.  I hadn’t thought of it before, but the first prompt “Show Happy face upon successful execution“ caught my attention because I write a lot of scripts, and of those many are used by other programs–so return codes are important, and not something I always remember to check.  I hadn’t thought of it before, but I liked the idea!

Anyways, it got me thinking about how it works … a lot of the fancy PS1 formulas you see out there are running several commands (even if it isn’t obvious–generally if a bracket or tick is involved, there’s a subshell forking out.)  When your system is grinding to a halt, every fork counts.  So I don’t like the idea of running an additional shell script every time I press enter.

So, the example that Joshua Price provides, while really cool, adds extra forks every time you hit the return key.  This is pretty easy to demonstrate using bash’s “set -x” command:

Each one of those “++” signs you see is a new process being created.  I’m a bit of an efficiency freak, so I don’t like that.

Curiosity got the better of me, and I somehow decided that I would achieve the same end (return status indication within PS1) without a single forked process.  So I went about modifying my (now previously) favorite PS1 prompt … the ultra-simple:

Continue reading »

 Posted by on October 26, 2012
Nov 042011
 

EC2 Micro Instance Limitations

EC2 offers a lot of advantages over many web site hosting options.  I am a bit of a control freak and like having full control over my web server.  This has advantages and disadvantages of course, meaning more work but more flexibility.  Running a WordPress blog on a micro instance can be a serious challenge.  I have fought with getting my site to have a minimum level of stability, and here are some of my notes on what helped.  Amazon offers a free EC2 micro instance for a year to new users, so it is a very attractive option for hosting a web site.

The EC2 micro instance is pretty cheap compared to the other system options that Amazon offers, but there are some caveats that may shock you after using it for a while.  There are a couple of major problems with using this option for hosting a website:

  • CPU Usage restrictions: If you use 100% CPU for more than a few minutes, Amazon will “steal” CPU time from the instance, meaning that they throttle your instance.  This can last (from my observations) as long as five minutes, and then you get a few seconds of 100% again, then the restrictions are back.  This will cripple your website, making it slow, and even timing-out requests.
  • Limited Memory: The instance is limited to 613MB of RAM, and does not have a swap partition.  If you run out of memory the system will panic and reboot.
Here is one symptom of CPU throttling from EC2, looking at the CPU usage from the “top” command:
According to the top man page: “st = steal (time given to other DomU instances)

 

If you have more than 1000 visitors or so a day, a micro instance probably isn’t worth your time.  But for many small sites (like mine) it does make sense.  I wasn’t aware of these limitations before setting up my site, and I very quickly ran into site reliability issues.  Here are a few of the things that I did to make my site more stable.

You can save a lot of money by purchasing a reserved instance for a year, but my advice is to run for a few months before making the leap.  If you find that your micro instance doesn’t cut it, you have just thrown away a chunk of cash.

So, let’s look at a few of the things you can do to make a WordPress site run reasonably well on a Micro Instance:

  • Configuration:
  • Tune Apache to run the correct number of threads.
  • Use the minimum required memory for MySQL.
  • Pre-cache your web pages.
  • Use a content distribution network (CDN) such as CloudFront.
  • Setup a swap partition.
  • Reacting to site overload:
    • Configure alerting for CPU usage and network traffic.
    • Be ready to rent a larger instance if you get a big traffic spike.
    • Use a 32 bit operating system.

    Continue reading »

     Posted by on November 4, 2011
    Jul 162009
     

    I am back in school, and that means research papers, hooray.  I am being smarter about it all these days though–templates and citation management software are definitely the way to go!

    It would sure be nice if Apple would include templates for the major paper formats with their word processor.  And all the ones I could find that others had posted were either not really templates, or got the formatting wrong.

    So I created one based off of their research paper template that references the latest rules at Purdue.  I couldn’t have done it so quickly if it weren’t for this great tutorial over at the Mac Law Students website, thanks for the handy write-up.

    So, if you came here looking for a free APA template for Pages, try this one out and let me know if it works for you: APA template for Pages 09′.

    Updated July 17, 2009: Fixed a few annoyances in the template (page titles were not repeating and hyphenation was set for document.)

     Posted by on July 16, 2009