Waste collection is one of the targets of smart cities. It is a daily task in urban areas and it entails the planning of waste truck routes, taking into account environmental, economic and social factors. In this work, an optimal path planning algorithm has been developed together with a practical software platform for smart and sustainable cities that enables computing the optimal waste collection routes, minimizing the impact, both environmental (CO2 emissions and acoustic damage) and socioeconomic (number of trucks to be used and fuel consumption). The algorithm is executed in Net2Plan, an open-source planning tool, typically used for modeling and planning communication networks. Net2Plan facilitates the introduction of the city layout input information to the algorithm, automatically importing it from geographical information system (GIS) databases using the so-called Net2Plan-GIS library, which can also include positions of smart bins. The algorithm, Net2Plan tool and its extension are open-source, available in a public repository. A practical case in the city of Cartagena (Spain) is presented, where the optimal path planning for plastic waste collection is addressed. This work contributes to the urban mobility plans of smart cities and could be extended to other smart cities scenarios with requests of optimal path planning.