A method of preventing the rusting and corrosion of iron by using a reactive metal that makes the cathode of an electrochemical cell. Magnesium alloy bars are used for pipelines and iron structures, while zinc or an aluminium/zinc/indium alloy is used for the jacket legs of offshore platforms where the ions from the bars are formed in preference to the steel structure. It is therefore also known as sacrificial protection and the bars are called sacrificial anodes. Galvanized iron consists of a layer of zinc, where, like the magnesium ions, zinc ions are formed protecting the iron.