  We discuss the interplay between dark matter, leptogenesis and a new gauge
boson $Z^\prime$ in the $B-L$ model. A fermion dark matter $\chi$ carrying
$U(1)_{B-L}$ charge is introduced to the model but not coupling with other
particles. We consider the freeze-out and freeze-in mechanisms, and obtain the
correct relic density respectively. We have scanned the feasible parameter
space and found that the dark matter direct detection experiments imposed the
most stringent constraints on the parameter space. The constraint on the
parameter space places a limit on the mass of dark matter with $m_{\chi}
\approx 1/2 M_{Z'}$ within a narrow region in the case of freeze-out scenario,
and we can obtain the right baryon asymmetry result in the case of
$m_{\chi}\subset[654$ GeV, 664 GeV]. For the freeze-in scenario, we have a much
broader parameter space for $m_{\chi}$ and $M_{Z^\prime}$ but $g_{BL}$ is
restricted at $10^{-5}$ level for $Q=0.1$. In both scenarios,
$g_{BL}-M_{Z^\prime}$ is limited within a narrow region by the dark matter
relic density, direct detection and baryon asymmetry constraints.
