Both spark ignition (SI) natural gas engines and compression ignition (CI) dual fuel (DF) engines suffer from knocking when the unburnt mixture ignites spontaneously prior to the flame front arrival. In this study, a parametric investigation is performed on the knocking performance of these two engine types by using the GT-Power software. An SI natural gas engine and a DF engine are modelled by employing a two-zone zero-dimensional combustion model, which uses Wiebe function to determine the combustion rate and provides adequate prediction of the unburnt zone temperature, which is crucial for the knocking prediction. The developed models are validated against experimentally measured parameters and are subsequently used for performing parametric investigations. The derived results are analysed to quantify the effect of the compression ratio, air-fuel equivalence ratio and ignition timing on both engines as well as the effect of pilot fuel energy proportion on the DF engine. The results demonstrate that the compression ratio of the investigated SI and DF engines must be limited to 11 and 16.5, respectively, for avoiding knocking occurrence. The ignition timing for the SI and the DF engines must be controlled after −38°CA and 3°CA, respectively. A higher pilot fuel energy proportion between 5% and 15% results in increasing the knocking tendency and intensity for the DF Engine at high loads. This study results in better insights on the impacts of the investigated engine design and operating settings for natural gas (NG)-fuelled engines, thus it can provide useful support for obtaining the optimal settings targeting a desired combustion behaviour and engine performance while attenuating the knocking tendency.