Mirko Slomka's side will travel to the Allianz Arena on either September 24 or 25 to face the cup holders for a place in the third round of the competition.
"It's extremely difficult and of course we're the rank outsiders in this duel," said Hannover's director of sport Dirk Dufner.
"Bayern are the be all and end all domestically and in Europe."
Hannover face Bayern in the Bundesliga on September 14 in what is set to be a difficult few weeks.
"Playing Bayern twice in 10 days is very demanding," Dufner said.
"It's a huge challenge, but we take it as it comes and want to get the best we can out of it."
Borussia Dortmund will also be travelling to the Allianz Arena to face Bayern's city rivals 1860 Munich in another mouthwatering tie, while a local derby between Freiburg and Stuttgart is the pick of the rest of the 16 ties.
Carnival clubs Mainz and Cologne meet at the Coface Arena while there will be at least four lower-league sides progressing to the last 16 with Osnabruck hosting Hertha Berlin, Saarbrucken entertaining Paderborn, Sandhausen travelling to the lowest-ranked club still left in the competition, Wiedenbruck, and FSV Frankfurt facing Ingolstadt.
Other tricky ties for Bundesliga sides come in Kaiserslautern, where Hertha Berlin face an ambitious second-division side who only missed promotion to the Bundesliga in a play-off last May, and Bielefeld, where Bayer Leverkusen will be Arminia's guests.
Draw (selected ties): Bayern Munich v Hannover, SC Freiburg v VfB Stuttgart, 1860 Munich v Borussia Dortmund, VfL Wolfsburg v VfR Aalen, Arminia Bielefeld v Bayer Leverkusen, Hamburg v SpVgg Greuther Furth, Eintracht Frankfurt v VfL Bochum, 1899 Hoffenheim v Energie Cottbus,
FSV Mainz 05 v FC Koln, Kaiserslautern v Hertha Berlin, Preußen Munster v Augsburg, Darmstadt 98 v Schalke.