Rail is a pretty decent method of travel when it comes to zombies. Crushes just about anything in it's path, even the odd car that ends up on the tracks. The cars are pretty sturdy, and easily barricaded at the entrances. Windows are easily boarded up or barred or barricaded as well.
Also, the tracks are not necessarily all going to run through populated areas, some railway lines completely dodge whole towns. So you have very long distances which will likely be zombie free.

Threats:
-Barricade or rock slide on the tracks. Ranging from a multi-car pile-up at a train intersection, to an intentional barricade set by humans, to railcars just left on the tracks and abandoned. Clearing said obstacles will make you and the train vulnerable. Some such obstacles might not be removeable, so now you're stuck out in the middle of no where, forced to proceed on foot.
-Train cars are pretty noisy. You might attract trouble. Now sure, that trouble might never catch you, or you might plow right over/through it.
-Rail yards are often inside major city centers. And chances are high you will have to change tracks or adjust in some manner when you get there.
-Stopping inside a tunnel is NOT an option. Ever. It just isn't. If you do, you're probably dead.

More Good News:
-Most railway lines terminate at seaport shipping yards. Which means you could potentially go from rail to boat in relatively short order.
-Rail cars can carry large amounts of supplies. Including whole cars, even a boat.