While it might seem that uneven, undulating terrain poses a substantial obstacle to fence construction, that is only the case for panel fencing. Most other types of fences, including rail fences, can follow the uneven ground using what is called the contour method of fence construction. Wherever the ground goes up or down, the rails of the fence follow it. Using the contour method makes building a fence on uneven ground as easy as on level ground.
Measure the length of a typical example of the planks that will serve as your fence rails. The rails are nailed to the middle of the fence posts, and normally each rail bridges three posts, so half of the length of the rails determines the interval between rails. Measure the height of a typical fence post and divide that by 3 to determine the depth of the post holes.
Set up the fence line by moving down where you want to install the fence with a measuring wheel, marking where the posts go by driving stakes at the appropriate intervals. Inspect the straightness of the line by periodically tying twine between stakes and moving any stakes that are out of line.
Replace the stakes with post holes. Pull the stakes up and dig pits with a mattock, posthole digger and shovel, using the measurement from step 1 for depth.
Set the fence posts. Drop a post into the pit and arrange it into a plumb (vertically straight) position with the aid of a level. Ask a helper to hold the post steady and shovel dirt back into the pit, stopping to compact it periodically with the iron tamping rod. Repeat this procedure for every post.
Determine where you want to place the rails on the post. In this example, 1.6 m (64 inches) of post are above the ground (excepting extra-long posts). For a three-rail fence, you could arrange it so the top rail is 15 cm (6 inches) below the top of the post and the bottom rail is 60 cm (2 feet) from the ground. The third rail would then go in between them at the 1.05 m (41 inch) mark.
Nail the top and bottom rails to the centre-line of the first post in the positions decided upon in step 5, hammering in 2 nails for each rail. Proceed to the next 2 posts, nailing the top and bottom rails to those posts as well.
Saw a fence rail in half and use it to bridge the first and second posts, nailing it up in the middle position from step 5. This allows you to alternate the fence rails for much of the fence line.
Follow the contours of the ground by always nailing the fence rails in the same positions on the fence rails. In some cases, steep ground will compel you to use half-rails, so saw more rails in half and abandon the alternating pattern as needed. Resume alternating the rails as soon as the ground contours permit it.