The magnetic field of the magnetosphere and tail