Optimal prestress of cracked structures with given frictionless and frictional crack interfaces is studied in this paper. The externally placed prestressing cables are modelled by the pin-load method. The static analysis (state) problem is a symmetric or nonsymmetric variational inequality. The arising nonsmooth and nonconvex optimal control problem is solved by a two level combination of nonsmooth optimization with structural analysis and sensitivity techniques.