The virtual machine technology is adopted to enhance the teaching effect of network confrontation. Through an introduction on the installation and use of the virtual machine software Vmware and combining with experinental teaching of the Virtual Machine, the paper introduces preparing from the experiment,the network probe experiment, Windows basic defending experiment and virus defending a type experiment. According to making use of an experiment a teaching resources well, setting a virtual network environment on single computer and simulating attacks and defense on network safety, the teaching effect in both theory and practice teaching is promoted.