Atomic vibrations are partially screened by electrons. In a metal this screening can change rapidly for vibrations associated to certain points of the Brillouin zone, entirely determined by the shape of the Fermi surface. The consequent anomalous behaviour of the phonon dispersion is called Kohn anomaly. Graphite is a semimetal. Nanotubes can be metals or semiconductors. We demonstrate that two Kohn anomalies are present in the phonon dispersion of graphite and that their slope is proportional to the square of the electron-phonon coupling. Metallic nanotubes have much stronger anomalies than graphite, due to their reduced dimensionality. Semiconducting nanotubes have no Kohn anomalies.