We focus on the confinement of two-dimensional Dirac fermions within the waveguides created by realistic magnetic fields. Understanding of their band structure is of our main concern. We provide easily applicable criteria, mostly depending only on the asymptotic behavior of the magnetic field, that can guarantee existence or absence of the energy bands and provide valuable insight into the systems where analytical solution is impossible. The general results are employed in specific systems where the waveguide is created by the magnetic field of a set of electric wires or magnetized strips.