Previous studies have demonstrated that the of pair-programming has beneficial effects on student learning. Based on pair-programming, this study proposes pair-programming configuration for learning computer networks and designs a virtualization-based lab that allow the pair input command from two computers to one terminal at the same time. In the experiment, university students were divided into two groups: In this experimental group, a pair-programming was applied for perform lab assignments, whereas the students in the control group completed lab assignments solo. The results show that the experimental group significantly outperformed the control group in learning achievement and also had more confidence in their work, thereby reducing the instructor's workloads. Finally, the findings of the questionnaires reveal that the experimental students considerably enjoyed the pair-programming configuration in the virtualization-based lab and had the high motivation to use the proposed system. Therefore, pair-programming configuration is suitable and helpful to facilitate learning in a computer networks lab.