NCTUns is a network simulator running on Linux. It has several unique advantages over traditional network simulators. This paper presents the novel design and implementation of its simulation engine. This paper focuses on how to combine the kernel re-entering and discrete-event simulation methodologies to execute simulations quickly. The performance and scalability of NCTUns are also presented and discussed.