The objective of operating system (OS) discovery is to find which OSs are running on computers in a given network. There are two existing strategies for OS discovery-active and passive-each having fundamental limitations. This paper discusses how the theory of diagnosis can be used to address, in a simple and elegant way, the problems associated with OS discovery. The problems are formalized in a logical framework and solutions are obtained through automated reasoning. The result of using such a knowledge-oriented approach is a natural unification of the active and passive methods of OS discovery in a hybrid approach. This paper also illustrates the benefits of the hybrid approach by comparing its accuracy with other existing OS discovery tools through a large-scale experiment.