We consider configurations of the magnetic flux trapped in a layered superconductor (superlattice) in the form of oblique strings of Josephson vortices (one vortex per layer). It is shown that the string consisting of unipolar Josephson vortices is stable provided the spacing in the string is larger than a certain critical value; otherwise, the string consisting of alternating Josephson vortices is stable. Then, a string with pinned edges in the presence of a dc bias current is considered. A critical current density that gives rise to rupture of the string is found. The string plays the role of a specific barrier preventing penetration of an additional flux quantum into the system. To analyze this role in detail, we consider collisions of a free vortex with the string pinned at its edges. The following outcomes of the collision have been found: capture, reflection, destruction of a chain, and elastic scattering.