Cathodic protection is a method of protecting a piping system or an equipment against corrosion by making the protected system cathodic. This is achieved by attaching a sacrificial anode or a galvanic anode to the protected system, thus making the protected system cathodic.
The sacrificial anode / galvanic anode has a lower electrochemical potential than the protected system metal, which makes the protected system act as a cathode. The metal with the lower electrochemical potential is the first to loose electrons and get ionized. The ions move on to the electrolyte containing fluid, which means corrosion. So, the sacrificial anode gets preferentially corroded instead of the protected system and finally the sacrificial anode can be replaced by a new one to take its place. Alloys of zinc, magnesium, aluminum are commonly used material for making sacrificial anodes.