The rule of thumb I have always heard is that you should generally stay for at least two years - otherwise it might raise a red flag when people read your CV. Of course, if you have a good reason, <2 yrs may still be OK.
Apart from that, there are no general rules. I depends on both what you want (do you prefer stability, or frequent new challenges), on what your job offers, and on industry practices. Some employers consider anyone who stays less than a decade a job hopper, and in some consulting companies, the majority of people is expected to leave after a few years.
Also note that there are alternatives to changing jobs, such as moving to a different department, doing consulting work as part of your job, getting a side job (with employer's permission of course), etc.