We investigate the dispersion measure(DM) and scattering of FRBs by the intergalactic-medium(IGM), foreground and host halos, using cosmological hydrodynamical simulation. We find that the median DM caused by foreground halos is around 30% of that caused by the IGM, but has a much larger variance. The DM induced by hosts deviates from a log-normal distribution, but exhibits an extended distribution in the range of $1-3000 {rm{pc, cm^{-3}}}$ with a median value $sim 100 {rm{pc, cm^{-3}}}$. Then we produce mock FRB sources, assuming a uniform distribution in the range $zsim 0-0.82$, to consider the propagation effect of IGM, foreground and host halos on FRB signals simultaneously. The DM distribution of mock sources agrees well with the observation. The fitted DM-redshift relation of the mock sources can provide a rough estimation of the redshifts of observed events with errors $delta z lesssim 0.15$. The distribution of mock sources in the DM-scattering time($tau$) space can also match the observation, assuming a Kolmogorov turbulence model with the inner and outer scale is 1000 km to 1 AU, and 0.2-10 pc respectively. Finally, we estimate the relative importance of these medium on DM and $tau$ in our models. The IGM and host halos are the primary and secondary sources to the extragalactic DM, $rm{DM_{exg}}$. Meanwhile, the contribution from foreground halos increases as $rm{DM_{exg}}$ increases. The host and foreground halos may be the most important medium for scattering. Statistically, the latter may dominate the scattering of events with $rm{DM_{exg}} gtrsim 200 {rm{pc, cm^{-3}}}$.