Here, the metal to be protected, like underground pipe lines, cables, ship hulls, etc., is connected by a wire to a more anodic material. So, the anodic material sacrifices and undergoes corrosion.
Mg, Zn, Al are used are sacrificial anodes
Impressed Current Cathodic Protection:
Here, an impressed current is applied to convert corroding material from anode to cathode.
A direct current is applied to the anode (an inert material like graphite) which is buried inside the soil and to the corroding material which is to be protected.
A DC voltage us applied such that the corrosion current becomes 0 or negative
Ships docked in harbour are protected as such
The principle involved in this method is to force the metal to be protected to behave like a cathode so that corrosion is prevented. There are 2 types