Vibrations and external disturbances of various origins (e.g. structural, wind, axis control) have been shown to degrade the image quality at the instrument focus of the telescopes. Furthermore, the next generation of extremely large telescopes (ELTs) and their associated adaptive optics (AO) systems will reach new levels of high angular resolution, thus reducing vibrations represents becomes highly desirable to ensure that the scientific instruments will take full advantage of this unprecedented resolution. We present a method that aims to mitigate the effect of vibrations at Paranal's MACAO and Gemini North's ALTAIR instruments. A frequency-based controller, based on the H2 synthesis technique [1,2], is used to maximize the performance of the tip and tilt closed-loop systems. The pseudo open-loop slopes are reconstructed from on-sky data and then used to find the controller that minimizes the variance of the tip-tilt residuals in an off-line simulation of the closed-loop system.