Rust can be prevented in many ways. Iron can be coated with a metal above it in the activity series. Sacrificial electrodes can be used and will oxidize in place of iron.
Work Step by Step
Iron can simply be kept away from water, which will prevent the reaction from occurring.