The experimental teaching of network security major has some problems,such as single application scenario and lack of real environment feeling.Aiming at this problem,this paper uses Docker technology to build a virtual experiment network,and carries out Unity3D modeling by combining the attacker's perspective and the global perspective in the attack and defense experiment,so as to create a virtual-real synthesis and integrate plot elements to make the experiment more vivid and interesting.The attack and defense instructions are graphical and programmable,which could provide interactive and guided practical teaching solutions,break through the limitations of traditional experimental teaching,and improve students'learning experience and effect.