A networking laboratory is an essential tool for teaching communications engineering. However, the effort and cost invested in creating a networking laboratory with physical equipment are significantly high, especially if the students are to work on realistic scenarios. By substituting physical networking devices by virtualized ones, virtualization technologies may contribute to simplify the laboratory management tasks and allow the creation of affordable and more complex network scenarios. In this way, students can work and experiment on realistic network scenarios, so that their learning experience is greatly improved. In this paper a detailed description of a virtualization-based networking laboratory model, evolved over the last 10 years of authors experience in teaching computer networking, is provided. This laboratory model is implemented using Virtual Networks over linuX (VNX), an open source tool specifically designed and developed to define, build, deploy and manage networking scenarios taking full advantage of virtualization, and supporting hybrid virtual/physical scenarios and heterogeneous operating systems. The features of the VNX tool, illustrated with an example of a complex network scenario used by more than 300 students, are described. A survey-based assessment of the usage experience of VNX is included in the paper, showing the validity and efficacy of the proposed laboratory model and of the VNX tool for teaching computer networking in laboratory assignments.