Let S be a unital ring in which 2 is invertible, and let R = H(S) be the quaternion ring over S. In this paper, we characterize the generalized derivations of R and show that every generalized Jordan derivation on R is a generalized derivation. We also consider the question when a derivation (generalized derivation) of a quaternion ring is an inner derivation (generalized inner derivation). In addition, we show that the structures of the center, ideals, and the above-mentioned derivations of the quaternion rings and matrix rings are similar