The quadruped robot can achieve stable locomotion with contact force control. The crucial technique of it is to convert the control of the center of mass (COM) to the control of supporting legs. In this paper, we propose a force distribution and control strategy based on model decomposition and optimal contact constrains for the quadruped robot with trotting gait. The quadruped robot can be modeled as a virtual planar seven-link and a virtual planar three-link under the supposition that the control of the COM is decoupled. Meanwhile, an optimal contact constraint will be proposed and the desired contact force can be found. The simulation and experiment results show that the robot can track the desired trajectories exactly and steadily.