This paper studies the consensus problem for a class of unknown heterogeneous nonlinear multi-agent systems via a network with random packet dropouts. Based on the dynamic linearization technique, novel model-free adaptive consensus protocols with the data compensation mechanism are designed for both leaderless and leader-following cases. The advantage of this approach is that only neighborhood input and output data of the agents are required in the protocol design. For the stability analysis, a new Squeeze Theorem based method is developed to derive the theoretic results instead of the traditional contraction mapping principle used in model-free adaptive control. It is shown that the consensus can be achieved for both leaderless and leader-following cases if the communication topology is strongly connected. Finally, numerical simulations verifying the correctness of the theoretical results are given.