Traveling from Peniche to Lisbon and Porto

The best way to get from the beach city of Peniche to Porto and Lisbon via bus and train.