Fast radio bursts (FRBs) are millisecond-duration radio transients and can be used as a cosmological probe. However, the dispersion measure (DM) contributed by intergalactic medium (IGM) is hard to be distinguished from other components. In this paper, we use the IllustrisTNG simulation to realistically estimate the $DM_{rm IGM}$ up to $zsim 9$. We find $DM_{rm IGM} = 892^{+721}_{-270}$ pc cm$^{-3}$ at $z=1$. The probability distribution of $DM_{rm IGM}$ can be well fitted by a quasi-Gaussian function with a long tail. The tail is caused by the structures along the line of sight in IGM. Subtracting DM contributions from the Milky Way and host galaxy for localized FRBs, the $DM_{rm IGM}$ value is close to the derived $DM_{rm IGM}-z$ relation. We also show the capability to constrain the cosmic reionization history with the $DM_{rm IGM}$ of high-redshift FRBs in the IllustrisTNG universe. The derived $DM_{rm IGM}-z$ relation at high redshifts can be well fitted by a $tanh$ reionization model with the reionization redshift $z=5.95$, which is compatible with the reionization model used by the IllustrisTNG simulation. The $DM_{rm IGM}$ of high-redshift FRBs also provides an independent way to measure the optical depth of cosmic microwave background (CMB). Our result can be used to derive the pseudo-redshifts of non-localized FRBs for $DM_{rm IGM}<4000$ pc cm$^{-3}$.