The protection of iron or steel against corrosion by using a more reactive metal. A common form is galvanizing, in which the iron surface is coated with a layer of zinc. Even if the zinc layer is scratched, the iron does not rust because zinc ions are formed in solution in preference to iron ions. Pieces of magnesium alloy are similarly used in protecting pipelines, etc.