The study of physical and chemical properties of massive protostars is critical to better understand the evolutionary sequence which leads to the formation of high-mass stars. IRAS 18151-1208 is a nearby massive region (d = 3kpc, L ~ 20000 Lsun) which splits into three cores: MM1, MM2 and MM3 (separated by 1-2). We aim at (1) studying the physical and chemical properties of the individual MM1, MM2 and MM3 cores; (2) deriving their evolutionary stages; (3) using these results to improve our view of the evolutionary sequence of massive cores. The region was observed in the CS, C34S, H2CO, HCO+, H13CO+, and N2H+ lines at mm wavelengths with the IRAM 30m and Mopra telescopes. We use 1D and 2D modeling of the dust continuum to derive the density and temperature distributions, which are then used in the RATRAN code to model the lines and constrain the abundances of the observed species. All the lines were detected in MM1 and MM2. MM3 shows weaker emission, or even is undetected in HCO+ and all isotopic species. MM2 is driving a newly discovered CO outflow and hosts a mid-IR-quiet massive protostar. The abundance of CS is significantly larger in MM1 than in MM2, but smaller than in a reference massive protostar such as AFGL2591. In contrast the N2H+ abundance decreases from MM2 to MM1, and is larger than in AFGL2591. Both MM1 and MM2 host an early phase massive protostar, but MM2 (and mid-IR-quiet sources in general) is younger and more dominated by the host protostar than MM1 (mid-IR-bright). The MM3 core is probably in a pre-stellar phase. We find that the N2H+/C34S ratio varies systematically with age in the massive protostars for which the data are available. It can be used to identify young massive protostars.