The preheating of intergalactic medium(IGM) by structure collapsing and ultraviolet background(UVB) are investigated in cosmological hydrodynamical simulations. When gravitational collapsing is the sole heating mechanism, we find that (1) $60%, 45%$ of the IGM are heated up to $S>8, 17$ kev cm$^2$ respectively at $z=0$, but the fractions drop rapidly to a few percents at $z=2$, (2) the entropy of the circum-halo gas $S_{rm{cir}}$ is higher than the virial entropy for more than $75 %$ of the halos with masses $M<10^{11.5}$ $M_{odot}$ since $z=2$, but the fraction higher than the entropy, $S_{rm{pr}}$, required in preventive model of galaxies formation is only $15-20 %$ for halos with $M<10^{10.5} M_{odot}$ at $z=0$, and decreases as redshift increases, (3)assuming a metallicity of $Z leq 0.03 Z_{odot}$, the fraction of halos whose circum-halo gas having a cooling time longer than the Hubble time $t_{cool,cir}>t_{rm{H}}$ is merely $5-10 %$ at $z lesssim 0.5$, and even less at $z geq 1$ for halos with $M<10^{10.5} M_{odot}$. (4) gas in the filaments undergoes the strongest preheating. Furthermore, we show that the UVB can not enhance the fraction of IGM with $S>17$ kev cm$^2$, but can increase the fraction of low mass halos($<10^{10.5} M_{odot}$) that having $S_{rm{cir}}>S_{rm{pr}}$ to $sim 70 %$ at $z=0$, and that having $t_{rm{cool, cir}}>t_{rm{H}}$ to $15-30 %$ at $z lesssim 0.5$. Our results indicate that preheating due to gravitational collapsing and UVB are inadequate to fulfil the needs of preventative model, especially for halos with $10^{10.5}<M<10^{11.5} M_{odot}$. Nevertheless, these two mechanisms might cause large scale galactic conformity.