I think the best thing you can do is just say "Don't hit" "That hurts mommy" or whatever. If you smack him on the butt on the hand it will confuse him. He should be getting out of this stage at 21 months, he's definitely old enough to understand. If he does it out of anger, then tell him "No. That hurts mommy" and stop the activity for 1 minute. (A "time-out" you could say) If he does it out of excitement, just remind him, "we don't hit" "that hurts mommy" "hitting isn't nice" in as nice of a voice as you can. I have three kids, and my youngest just went into this phase. I hope it helps!
at 4:18 PM on Jun. 20, 2008