Pep Guardiola's side were not rewarded with a kind draw after defeating Preussen Munster 4-1 in the opening round.
They will face their Bundesliga rivals next up away from home, although Mirko Slomka's men were less than convincing in their first-round clash with Energie Cottbus, progressing on penalties after a 2-2 draw.
Bayern kicked off their Bundesliga title defence with a 2-1 win over Wolfsburg on Friday, while Hamburg held Cologne to a goalless draw a day later.
In the other standout tie of the round, Eintracht Frankfurt were pitted against Borussia Monchengladbach, while amateurs Magdeburg have been rewarded for their shock 1-0 win over Augsburg with the chance to welcome UEFA Champions League hopefuls Bayer Leverkusen.
Borussia Dortmund visit St Pauli in one of five matches between teams from the first and second tiers, with 1860 Munich's clash against Freiburg one of the other notable matches.
Dynamo Dresden of 3. Liga ousted Schalke in the first round and host fellow giant-killers Bochum, who disposed of Stuttgart.
Draw in full:
Hamburg v Bayern Munich
Eintracht Frankfurt v Borussia Monchengladbach
1860 Munich v Freiburg
Hoffenheim v FSV Frankfurt
Aalen v Hannover
Wolfsburg v Heidenheim
St Pauli v Borussia Dortmund
Chemnitzer v Werder Bremen
Arminia Bielefeld v Hertha Berlin
Duisburg v Cologne
Kaiserslautern v Greuther Furth
Leipzig v Erzgebirge Aue
Dynamo Dresden v Bochum
Magdeburg v Bayer Leverkusen
Kickers Offenbach v Karlsruher
Wurzburger Kickers v Eintracht Braunschweig
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.