  We present a comparison of the physical properties of the ionized gas in the
circumgalactic (CGM) and intergalactic (IGM) media at $z\sim0$ between
observations and four cosmological hydrodynamical simulations: Illustris,
TNG300 of the IllustrisTNG project, EAGLE, and one of the Magneticum
simulations. For the observational data, we use the gas properties that are
inferred from cross-correlating the Sunyaev-Zel'dovich effect (SZE) from the
{\it Planck} CMB maps with the haloes and the large-scale structure
reconstructed from Sloan Digital Sky Survey data. Both the observational and
simulation results indicate that the integrated gas pressure in haloes deviates
from the self-similar case, showing that feedback impacts haloes with
$M_{500}\sim 10^{12-13}\,{\rm M_\odot}$. The simulations predict that more than
half the baryons are displaced from haloes, while the gas fraction inferred
from our observational data roughly equals the cosmic baryon fraction
throughout the $M_{500}\sim 10^{12-14.5}\,{\rm M_\odot}$ halo mass range. All
simulations tested here predict that the mean gas temperature in haloes is
about the virial temperature, while that inferred from the SZE is up to one
order of magnitude lower than that from the simulations (and also from X-ray
observations). While a remarkable agreement is found for the average properties
of the IGM between the observation and some simulations, we show that their
dependence on the large-scale tidal field can break the degeneracy between
models that show similar predictions otherwise. Finally, we show that the gas
pressure and the electron density profiles from simulations are not well
described by a generalized NFW (GNFW) profile. Instead, we present a new model
with a mass-dependent shape that fits the profiles accurately.
