Longitudinal vibration of nanorods embedded in an elastic medium with elastic restraints at both ends is studied based on the non-local elasticity theory. Using Fourier sine series and Stokes' transformation, a coefficient matrix is obtained. It is very useful for calculating the vibrational frequencies of a nanorod with any type of boundary condition (rigid or restrained). Finally, carrying out some numerical computations, the effects of the elastic medium, non-local parameters and elastic restraints at both ends on the values of vibrational frequencies have been determined. The numerical results are validated through comparison of calculated values with those in the literature.