Gastly actually learns substitute via TM, so breeding for it is useless. However, if you really want to know…
Breed gastly and gastly, both knowing substitute (from TM), then the gastly from the egg should know substitute. I'm not an expert in breeding, so if anyone notices this is incorrect, please inform me and I'll change me answer. Hope I helped!
[Gastly Page][1]
Scroll down for the tms.
[1]: http://pokemondb.net/pokedex/gastly