The two sides were already due to meet in pre-season and they will now also face each other in a competitive fixture a few weeks later.
The first round draw was made on Thursday afternoon.
Meanwhile, Middlesbrough have been handed a home tie against Barnsley in the first round of this season's Carabao Cup.
The sides last met in the competition in 2020 at the same stage, with the Tykes winning 2-0.
Meanwhile, Sunderland will travel to Hillsborough in the first round of the Carabao Cup.
The Black Cats, who reached the quarter finals of the competition last season, will face Sheffield Wednesday just months on from the play-off semi final.
Ross Stewart gave Sunderland a slender advantage in the first leg of that tie, before a late strike from Patrick Roberts cancelled out Lee Gregory’s goal and sent his side through.
The ties will be played on the week commencing August 8, 2022.