This question already has an answer here:

Is it possible to incorporate a network into the MMQGIS hub distance analysis? Essentially I have a point shapefile with zip code centroids and I'd like to determine the closest shipping hub (also point shapefile) for each assuming the path must follow a road (a line shapefile).

Unlike creating a road distance matrix I would like to have a single hub identified for each zip code centroid. A further distinction is that neither the zip code centroids nor the hubs actually lie directly on the roads so I'd like to have the source (zip centroids) and destination (hubs) be the closest point on the road/line.

marked as duplicate by Chris W, Fezter, Mapperz Mar 24 '15 at 2:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.