The boundary value problem of magnetotail equilibrium