The game will also pitch Ronaldo against his former club for the first time since he left in a world record £80million deal in 2009.
Ferdinand was first to react to the draw on Twitter, writing: 'Oh yes, Madrid!! What a great couple a games that'll be!! @Cristiano see u soon bro!!'
That was followed by Ruud van Nistelrooy, who played for both.
He wrote: 'United or Madrid.. Who do I want to win? Played my heart out for them both. Proud to have played for both. #impossible #MayTheBestTeamWin.'
Draw in full:
Shakhtar Donetsk v Borussia Dortmund
Valencia v Paris St-Germain
Porto v Malaga