The invention discloses a routing method based on Q learning and a trust model in an Ad Hoc network, and mainly solves the problem of secure routing lookup in the Ad Hoc network. The routing method comprises the implementation steps that 1, a Q value table is generated; 2, the total number of adjacent nodes of each node is calculated; 3, each node evaluates trust values of all the nodes adjacent to the node; 4, trust awards are allocated; 5, instant awards are acquired; 6, aggregation awards are acquired; 7, Q values in the Q value table of the Ad Hoc network nodes are updated; 8, whether or not a current node in a routing request packet is a destination node is judged, if yes, the step 9 is executed, and otherwise, the step 6 is executed; 9, forward routing information is established; and10, data packets are sent. According to the routing method, combination of the trust model, a Q learning algorithm and a routing technology is achieved, a global optimal route can be dynamically looked up according to the environment of the Ad Hoc network, and the security and the stability of the network are effectively improved.