Network Rail in Wales and the Borders is renewing the track in the 170-year-old Dinmore Tunnel on the Marches Line to "improve reliability".
The Marches Line runs from Newport in south-east Wales to Shrewsbury in the West Midlands region of England by way of Abergavenny, Hereford and Craven Arms.
A spokesperson for Network Rail said: "Buses will replace trains between Hereford and Shrewsbury during a nine-day closure on the Marches Line between Tuesday September 12 to Thursday, September 21 as teams work around the clock to renew the track and ballast inside the historic tunnel."
Network Rail, along with principal contractors, Colas Rail, will access the railway from Wellington Level Crossing, to replace the ballast and track travelling towards London.
Dinmore Tunnel was constructed in 1853.
Network Rail says the new track will boost reliability of journeys on the Marches line – an important rail link that connects South Wales to the Midlands and beyond.
Transport for Wales will operate a bus replacement service from Hereford to Shrewsbury while the railway is shut, followed by a reduced rail service from Cardiff to Shrewsbury from Friday, September 22 to Friday September 29.
Clarisse Grother, senior programme manager at Network Rail Wales & Borders, said: “We will be working around the clock to get the work completed as quickly and safely as possible, and I would like to apologise to passengers and the local community for any disruption this may cause.”
After the track renewal is complete, from Saturday September 30 to Sunday November 19 (Saturday nights) there will be follow-up work from 11pm to 9.40am.
Passengers are advised to check before they travel at journeycheck.com/tfwrail