The right way - or should I say, the correct was, is to press them out with a bearing press. But, I have almost always used a good, stout steel drift punch about ten inches long - gives you a bit of length to hang onto, and knocked them out. I use a piece of three inch pipe, and set the hub front side (first, because it is the smaller race) down in it, and start pecking from the backside. Just use small, firm whacks, and work in a cross pattern all the way around the race, until it pops out. Be careful not to "cock" it, because that will mess up the hub for the new race to go back into.

Putting the new one in, use a brass hammer, and a brass drift, so you don't mess the new race up.