The magnetic anomaly created by ferromagnetic ships may endanger their invisibility. Nowadays, a new technique called closed-loop degaussing system can reduce the magnetic anomaly especially permanent one in real-time. To achieve it, a model able to predict off-board magnetic field from onboard measurements is required. Many researchers settle the problem by some numerical models. In this paper, we propose a linear neural network to solve it. The method can avoid many problems from linear model. Its high accuracy and good generalization ability have been tested by a mockup experiment.