The line between Eastleigh and Fareham will be closed from Saturday 25 June to Sunday 3 July while engineers stabilise a cutting between Botley and Fareham.
The cutting, outside a tunnel in Fareham, has experienced a number of failures in recent years.
In 2016, temporary repairs were made following Storm Frank but now permanent fix is needed.
Buses will replace South Western Railway services between Eastleigh and Fareham throughout the closure, while services between London Waterloo and Portsmouth Harbour via Basingstoke will start and terminate at Eastleigh and Fareham.
On Saturday 25 June and Sunday 3 July, Great Western Railway services will be diverted via Netley. Some Southern services via Botley will be diverted via Netley and Swanwick.
.