Principal characteristics of interlayer interaction and relative motion of hexagonal boron nitride (h-BN) layers are investigated by the first-principles method taking into account van der Waals interactions. Dependences of the interlayer interaction energy on relative translational displacement of h-BN layers (potential energy surfaces) are calculated for two relative orientations of the layers, namely, for the layers aligned in the same direction and in the opposite directions upon relative rotation of the layers by 180 degrees. It is shown that the potential energy surfaces of bilayer h-BN can be approximated by the first Fourier components determined by symmetry. As a result, a wide set of physical qualintities describing relative motion of h-BN layers aligned in the same direction including barriers to their relative sliding and rotation, shear mode frequency and shear modulus are determined by a single parameter corresponding to the roughness of the potential energy surface, similar to bilayer graphene. The properties of h-BN layers aligned in the opposite directions are described by two such parameters. The possibility of partial and full dislocations in stacking of the layers is predicted for h-BN layers aligned in the same and opposite directions, respectively. The extended two-chain Frenkel-Kontorova model is used to estimate the width and formation energy of these dislocations on the basis of the calculated potential energy surfaces.