There are three basic lenses that can be adapted to meet these requirements.
Normal Lenses: Often called a 50mm lens, the standard lens that may have come with your camera can take good pictures of your model railroad. A normal lens will usually stop down to f/16, and close focus to two feet or less from a subject. At f/16, depth of field will be good, and pictures taken with a normal lens look the most realistic--that is, the perspective is similar to what we are used to seeing with the naked eye.
Wide Angle Lenses: Wide angles, such as the 24mm, can focus very close, usually down to a foot, and will stop down to f/22 or f/32, providing greater depth of field than the normal lens. However, pictures taken with wide angles may not seem "normal." The foreground will be exaggerated and subjects in the distance will appear tiny and far away.
Macro Lenses: a macro lens in the normal range (55mm to 60mm) will provide great results and if you don't own a normal lens, these lenses can be used quite normally in addition to doing macro work. Macros will focus to less than a foot, have a minimum f/stop of f/32, and can therefore provide great depth of field when fully stopped down. Like the normal lens, the perspective is what we expect to see with the naked eye.
Close-Up Accessories: With the exception of teleconverters, avoid close up accessories. While some can take good pictures, they are of little value for most model railroad photography because they have virtually no depth of field. A teleconverter, combined with a wide angle or normal lens, however, can do almost as good a job as a macro lens. If you happen to own one, or you can buy one fairly cheap, you can take great pictures.
Teleconverters: All the photos in the gallery were taken with a 24-50mm zoom lens fitted to a 1.4 teleconverter. A teleconverter is a lens that fits between the regular lens and the camera body. It multiplies the focal length of the lens. So my 24-50mm zoom becomes a 34-70mm zoom. Why not just use a 35-70mm zoom? When a teleconverter is attached to a lens, it increases the focal length, but the apparent minimum focusing distance stays the same! So my "macro 34-70mm" zoom will still focus as close as the 24-50. At 50mm, the 24-50mm zoom I use has a minimum aperture of f/32. With the teleconverter attached, that becomes f/45 for outstanding depth of field. Look at some of the pictures in the gallery. The pictures are sharp from foreground to background, something not often found in model railroad photography. What I really like about this combination, however, which I could not get in a fixed focal length macro, is the ability to compose without constantly readjusting the tripod. If you have taken model railroad pictures, you know what a bonus that is. The penalty for this rig, however, is longer exposure times.