%3CLINGO-SUB%20id%3D%22lingo-sub-1381569%22%20slang%3D%22en-US%22%3EConnecting%20to%20On-Premise%20Networks%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1381569%22%20slang%3D%22en-US%22%3E%3CP%3EThis%20blog%20post%20is%20written%20as%20a%20guide%20for%20peering%20Lab%20Services%20with%20an%20on-premise%20network.%26nbsp%3B%20Every%20network%20architecture%20is%20different%20and%20so%20this%20post%26nbsp%3B%20is%20not%20intended%20as%20a%20detailed%20step-by-step%20instructional%20document.%26nbsp%3B%20Rather%2C%20the%20intention%20of%20this%20document%20is%20to%20give%20guidance%20for%20the%20general%20steps%20and%20mention%20any%20possible%20issues%20that%20may%20arise%20with%20common%20network%20architectures.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20document%20discusses%20connecting%20to%20an%20on-premise%20network.%20%26nbsp%3B%26nbsp%3BIt%20is%20assumed%20that%20on-premise%20network%20has%20a%20network%20gateway%20to%20which%20a%20VPN%20tunnel%20(site-to-site%20or%20ExpressRoute)%20may%20be%20connected.%20%26nbsp%3BDetails%20regarding%20how%20to%20setup%20an%20on-premise%20network%20will%20not%20be%20covered%20in%20this%20document.%26nbsp%3B%20It%20is%20important%20to%20know%20the%20following%20information%20before%20proceeding.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EWhat%20type%20of%20VPN%20tunnel%20is%20supported%20to%20the%20on-premise%20network%3F%26nbsp%3B%20It%20should%20be%20either%20site-to-site%20or%20ExpressRoute.%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fexpressroute%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EExpressRoute%3C%2FA%3E%20is%20a%20private%20connection%20between%20the%20Azure%20datacenters%20infrastructure%20on%20the%20Customer%E2%80%99s%20premises.%26nbsp%3B%20A%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvpn-gateway%2Fvpn-gateway-howto-site-to-site-resource-manager-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Esite-to-site%20VPN%3C%2FA%3E%20gateway%20connection%20used%20to%20connect%20to%20your%20on-premises%20network%20over%20IPsec.%26nbsp%3B%26nbsp%3BNOTE%3A%20If%20the%20connection%20type%20is%20ExpressRoute%2C%20you%20will%20need%20someone%20with%20the%20appropriate%20permissions%20to%20create%20a%20connection%20to%20the%20ExpressRoute%20gateway.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3COL%20start%3D%222%22%3E%0A%3CLI%3EThe%20public%20ip%20address%20of%20the%20vpn%20gateway%20for%20the%20on-premise%20network.%3C%2FLI%3E%0A%3CLI%3EShared%20key%20for%20the%20connection%20from%20the%20hub%20gateway%20to%20the%20on-premise%20gateway.%26nbsp%3B%20A%20shared%20key%20is%20like%20a%20password%20to%20ensure%20the%20connection%20is%20expected.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EThe%20diagram%20below%20shows%20the%20architecture%20of%20the%20solution%20that%20will%20be%20used.%26nbsp%3B%20There%20is%20an%20on-premise%20network%20with%20a%20vpn%20gateway.%26nbsp%3B%20Since%20virtual%20networks%20created%20for%20a%20classroom%20lab%20cannot%20be%20connected%20directly%20to%20an%20on-premise%20network%2C%20we%20will%20create%20a%20virtual%20network%20in%20the%20as%20the%20lab%20account.%26nbsp%3B%20This%20virtual%20network%20will%20be%20connected%20via%20a%20VPN%20tunnel%20to%20the%20on-premise%20network.%26nbsp%3B%20It%20will%20also%20be%20peered%20to%20the%20virtual%20network%20created%20in%20the%20Azure%20Lab%20Services%20subscription%20for%20your%20classroom%20lab.%26nbsp%3B%20The%20virtual%20network%20in%20the%20same%20subscription%20as%20the%20lab%20account%20is%20the%20glue%20that%20makes%20the%20scenario%20work.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22planetmaher_0-1589255428656.jpeg%22%20style%3D%22width%3A%20523px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F190822iF587BDE7841B87B8%2Fimage-dimensions%2F523x481%3Fv%3D1.0%22%20width%3D%22523%22%20height%3D%22481%22%20title%3D%22planetmaher_0-1589255428656.jpeg%22%20alt%3D%22planetmaher_0-1589255428656.jpeg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EA%20couple%20notes%20before%20we%20get%20started%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EThe%20lab%20account%20resource%20and%20the%20Azure%20virtual%20network%20to%20be%20peered%20must%20be%20in%20the%20same%20region.%3C%2FLI%3E%0A%3CLI%3EThe%20virtual%20network%20should%20be%20in%20the%20same%20subscription.%26nbsp%3B%20If%20this%20is%20not%20possible%2C%20as%20might%20be%20the%20case%20when%20using%20Express%20Route%2C%20the%20lab%20account%20will%20need%20to%20be%20peered%20to%20a%20vnet%20in%20the%20same%20subscription%20and%20then%20a%20vnet-to-vnet%20connection%20made%20with%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvpn-gateway%2Fvpn-gateway-howto-site-to-site-resource-manager-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EBGP%3C%2FA%3E%20enabled%20between%20the%20peered%20vnet%20and%20the%20ExpressRoute%20hub%20vnet.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22toc-hId--1351722789%22%20id%3D%22toc-hId--1351722789%22%3ECreate%20your%20Lab%20Account%3C%2FH2%3E%0A%3CP%3EFollow%20the%20instructions%20at%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Flab-services%2Fclassroom-labs%2Fhow-to-manage-lab-accounts%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehow%20to%20manage%20lab%20accounts%3C%2FA%3E%20to%20create%20your%20lab%20account.%26nbsp%3B%20Don%E2%80%99t%20worry%20about%20peering%20vnets%20yet.%26nbsp%3B%20We%20need%20to%20setup%20our%20vnet%20first.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1135790044%22%20id%3D%22toc-hId-1135790044%22%3ECreating%20the%20VNet%20and%20Gateway%20in%20Your%20Subscription%3C%2FH2%3E%0A%3COL%3E%0A%3CLI%3ECreate%20a%20resource%20group%20to%20hold%20the%20virtual%20network%20and%20related%20resources.%26nbsp%3B%3CUL%3E%0A%3CLI%3EName%3A%20%3CSPAN%3Ehub-rg%3C%2FSPAN%3E.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvirtual-network%2Fquick-create-portal%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ECreate%20a%20virtual%20network%3C%2FA%3E%20in%20the%20%3CSPAN%3Ehub-rg%3C%2FSPAN%3E%20resource%20group.%3CUL%3E%0A%3CLI%3EName%3A%20%3CSPAN%3Ehub-vnet%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3ESubscription%3A%20Same%20subscription%20as%20your%20lab%20account.%3C%2FLI%3E%0A%3CLI%3ELocation%3A%20Same%20location%20as%20your%20lab%20account.%3C%2FLI%3E%0A%3CLI%3EAddress%20Range%3A%20Select%20ip%20range%20that%20does%20not%20overlap%20with%20any%20existing%20ip%20ranges%20%26nbsp%3Bfor%20the%20on-premise%20network.%26nbsp%3B%20This%20address%20range%20will%20specify%20the%20address%20range%20for%20all%20classroom%20lab%20virtual%20machines.%20%26nbsp%3BWe%20will%20use%20%3CSPAN%3E10.1.0.0%2F16%3C%2FSPAN%3E.%26nbsp%3B%20Remember%20this%20range%20for%20later.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ENOTE%3C%2FSTRONG%3E%3A%20It%20is%20extremely%20important%20that%20the%20vnet%20be%20created%20in%20the%20same%20subscription%20and%20location%20as%20your%20lab%20account.%26nbsp%3B%20You%20will%20not%20see%20this%20virtual%20network%20as%20an%20option%20in%20the%20peered%20network%20setting%20for%20the%20lab%20account%20otherwise.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3COL%20start%3D%224%22%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvpn-gateway%2Fvpn-gateway-about-vpn-gateway-settings%23gwsub%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ECreate%20a%20gateway%20subnet%3C%2FA%3E%20in%20%3CSPAN%3Ehub-vnet%3C%2FSPAN%3E.%26nbsp%3B%20This%20is%20required%20to%20create%20a%20vpn%20gateway.%26nbsp%3B%3CUL%3E%0A%3CLI%3EOpen%20the%20virtual%20network%20in%20the%20Azure%20Portal%20and%20click%20%E2%80%98Add%20gateway%20subnet%E2%80%99.%3C%2FLI%3E%0A%3CLI%3EChoose%20an%20ip%20range%20that%20is%20within%20the%20larger%20vnet%20range%20that%20doesn%E2%80%99t%20overlap%20any%20existing%20subnets.%26nbsp%3B%20We%20will%20use%20%3CSPAN%3E10.1.255.0%2F27%3C%2FSPAN%3E.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ENOTE%3C%2FSTRONG%3E%3A%20It%20is%20recommended%20to%20use%20a%20%2F27%20or%20%2F28%20range%20for%20your%20gateway%20subnet.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%3ECreate%20a%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvpn-gateway%2Fvpn-gateway-howto-site-to-site-resource-manager-portal%23VNetGateway%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Evirtual%20network%20gateway%20instance%3C%2FA%3E.%26nbsp%3B%3CUL%3E%0A%3CLI%3E%3CSTRONG%3ENOTE%3C%2FSTRONG%3E%3A%20This%20step%20can%20take%20up%20to%2045%20minutes%20to%20complete.%3C%2FLI%3E%0A%3CLI%3EIn%20the%20Azure%20search%20for%20%E2%80%98Virtual%20Network%20Gateway%E2%80%99%20when%20adding%20a%20new%20resource%3C%2FLI%3E%0A%3CLI%3ESubscription%3A%20same%20as%20lab%20account%3C%2FLI%3E%0A%3CLI%3EName%3A%20%3CSPAN%3Ehub-vpn-gateway%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3ERegion%3A%20Same%20as%20lab%20account%20and%20vnet%3C%2FLI%3E%0A%3CLI%3EGateway%20type%3A%20VPN%20or%20ExpressRoute%20as%20appropriate%3C%2FLI%3E%0A%3CLI%3EVPN%20type%3A%20Leave%20a%20Route-base%20unless%20on-premise%20network%20architecture%20requires%20policy-based.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EWARNING%3C%2FSTRONG%3E%3A%20If%20using%20a%20policy-based%20vpn%2C%20you%20must%20update%20the%20address%20spaces%20on%20both%20sides%20of%20the%20tunnel%20simultaneously.%26nbsp%3B%20Otherwise%2C%20you%20could%20cause%20a%20disruption%20in%20the%20tunnel.%3C%2FLI%3E%0A%3CLI%3ESku%3A%20Sku%20options%20are%20listed%20in%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvpn-gateway%2Fvpn-gateway-about-vpn-gateway-settings%23gwsku%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fvpn-gateway%2Fvpn-gateway-about-vpn-gateway-settings%23gwsku%3C%2FA%3E.%26nbsp%3B%20We%20will%20use%20Generation%201%2C%20VpnGw1.%3C%2FLI%3E%0A%3CLI%3EVirtual%20network%3A%20%3CSPAN%3Ehub-vnet%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EPublic%20ip%20address%3A%20create%20a%20new%20public%20ip%20called%20%3CSPAN%3Ehub-gw-pip%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%3E%3CSTRONG%3ENOTE%3C%2FSTRONG%3E%3A%20If%20%E2%80%98enable%20active-active%20mode%E2%80%99%20or%20%E2%80%98configure%20BGP%20ASN%E2%80%99%20need%20to%20be%20enabled%2C%20contact%20consult%20your%20IT%20department.%26nbsp%3B%20Both%20settings%20are%20more%20advanced%20and%20outside%20the%20scope%20of%20this%20document.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3COL%20start%3D%225%22%3E%0A%3CLI%3EWait%20for%20the%20virtual%20network%20gateway%20instance%20creation%20to%20complete.%26nbsp%3B%20You%20will%20need%20to%20know%20the%20address%20of%20the%20public%20ip%20(%3CSPAN%3Ehub-gw-pip%3C%2FSPAN%3E)%20before%20continuing.%3C%2FLI%3E%0A%3CLI%3ECreate%20a%20local%20network%20gateway%3CUL%3E%0A%3CLI%3EName%3A%20%3CSPAN%3Ehub-local-gw%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EIP%20address%3A%20%3CSPAN%3Eonpremise%20ip%20address%20(%3C%2FSPAN%3EThis%20is%20the%20public%20ip%20of%20the%20onpremise-vpn-gateway%20instance.)%3C%2FLI%3E%0A%3CLI%3EAddress%20space%3A%20Address%20space%20for%20onpremise-vnet.%26nbsp%3B%26nbsp%3B%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH2%20id%3D%22toc-hId--671664419%22%20id%3D%22toc-hId--671664419%22%3ECreate%20Connection%20between%20Hub%20Gateway%20and%20On-Premise%20Gateway%3C%2FH2%3E%0A%3CP%3EConnections%20must%20be%20created%20in%20both%20directions%20to%20be%20complete.%26nbsp%3B%20First%2C%20let%E2%80%99s%20start%20with%20the%20hub%20gateway%20to%20on-prem%20gateway%20connection.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EOpen%20%3CSPAN%3Ehub-vnet-gateway%3C%2FSPAN%3E%20in%20the%20Azure%20Portal.%3C%2FLI%3E%0A%3CLI%3EChoose%20Connections.%3C%2FLI%3E%0A%3CLI%3EClick%20%3CSTRONG%3EAdd%3C%2FSTRONG%3E%3CUL%3E%0A%3CLI%3EName%3A%20%3CSPAN%3EHubtoOnPrem%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EConnection%20type%3A%20IPSec%20for%20site-to-site%20connections.%20%26nbsp%3BChoose%20ExpressRoute%20for%20that%20type%20of%20connection.%3C%2FLI%3E%0A%3CLI%3ESecond%20virtual%20network%20gateway%3A%20choose%20%3CSPAN%3Ehub-local-gw%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EShared%20key%20(PSK)%3A%20shared%20keyed%20for%20connection%20to%20the%20onpremise%20gateway.%26nbsp%3B%20This%20should%20be%20a%20value%3C%2FLI%3E%0A%3CLI%3EIKE%20Protocol%3A%20leave%20at%20IKEV2.%26nbsp%3B%20(Route%20based)%3C%2FLI%3E%0A%3CLI%3EWARNING%3A%20IKEV1%20(policy%20based)%20is%20the%20older%20version%20of%20the%20protocol.%26nbsp%3B%20Changes%20to%20one%20side%20of%20%E2%80%98PolicyBased%E2%80%99%20or%20%E2%80%98RouteBased%20with%20PolicyBasedTrafficSelectors%E2%80%99%20can%20cause%20issues%20with%20the%20tunnel.%26nbsp%3B%20Update%20both%20sides%20together.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3ESecond%2C%20create%20the%20connection%20from%20the%20on-prem%20network%20to%20the%20Azure%20virtual%20network.%26nbsp%3B%20Once%20that%20hub%20to%20on-prem%20connection%20is%20made%2C%20the%20on-prem%20to%20hub%20connection%20must%20be%20made%20by%20the%20person%20or%20team%20maintaining%20the%20on-premise%20network.%26nbsp%3B%20The%20same%20shared%20key%20must%20be%20used.%3C%2FP%3E%0A%3CP%3EEach%20row%20in%20the%20connections%20blade%20for%20virtual%20network%20can%20be%20clicked%20to%20open%20the%20connection%20details%20blade.%26nbsp%3B%20The%20status%20will%20tell%20you%20if%20the%20bi-direction%20connection%20is%20complete%20or%20not.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1815848414%22%20id%3D%22toc-hId-1815848414%22%3EPeer%20hub%20vnet%20to%20Lab%20Services%20Lab%20Account%26nbsp%3B%3C%2FH2%3E%0A%3CP%3EPeer%20the%20lab%20account%20to%20the%20hub%20vnet%20by%20following%20instructions%20at%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Flab-services%2Fclassroom-labs%2Fhow-to-connect-peer-virtual-network%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Flab-services%2Fclassroom-labs%2Fhow-to-connect-peer-virtual-network%3C%2FA%3E.%26nbsp%3B%20Remember%20the%20%3CSPAN%3Ehub-vnet%3C%2FSPAN%3E%20must%20be%20in%20the%20same%20subscription%20and%20region%20as%20the%20lab%20account%20to%20be%20seen%20in%20the%20drop%20down.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EIMPORTANT%3C%2FSTRONG%3E%3A%20The%20vnet%20peering%20on%20the%20lab%20account%20must%20be%20done%20before%20any%20labs%20are%20created.%26nbsp%3B%20Previously%20created%20template%20machines%20or%20student%20virtual%20machines%20are%20not%20updated.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EIMPORTANT%3C%2FSTRONG%3E%3A%20Also%2C%20it%20is%20important%20to%20set%20an%20address%20range%20for%20the%20new%20lab%20to%20use.%26nbsp%3B%20If%20not%20specified%20Lab%20Services%20will%20default%20to%20something%20like%2010.x.0.0%2F16.%26nbsp%3B%20If%20you%20used%20any%20of%20the%20default%20ranges%20making%20the%20hub%20vnet%2C%20the%20lab%20services%20lab%20vnets%20could%20overlap%20the%20hub%20vnet%E2%80%99s%20address%20space%20causing%20issues.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EMake%20sure%20to%20specify%20an%20address%20range%20large%20enough%20to%20hold%20all%20the%20lab%20you%20wish%20to%20create.%26nbsp%3B%20A%20subnet%20with%20a%20%2F23%20subnet%20is%20created%20for%20each%20lab.%26nbsp%3B%20(%2F23%20CIDR%20range%20creates%20a%20maximum%20of%20512%20addresses.)%26nbsp%3B%20For%20example%2C%20a%20%2F21%20address%20range%20will%20be%20large%20enough%20to%20create%204%20labs%20for%20that%20lab%20account.%26nbsp%3B%20Azure%20side%20adds%20these%20addresses%20to%20the%20total%20vnet%20address%20spaces%20for%20the%20vnet%20gateway.%26nbsp%3B%20The%20onpremises%20vpn%20must%20include%20the%20lab%20vnet%20address%20space%20as%20well%20as%20the%20hub%20vnet%20address%20space%20for%20traffic%20to%20flow%20over%20the%20peering%20branches.%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-8393951%22%20id%3D%22toc-hId-8393951%22%3EConclusion%3C%2FH2%3E%0A%3CP%3EYou%20are%20now%20ready%20to%20start%20creating%20labs.%26nbsp%3B%20Make%20sure%20to%20check%20any%20NSG%20settings%20on%20the%20on-premise%20network%20to%20all%20traffic%20from%20the%20Lab%20Services%20hosted%20VMs%20to%20the%20on-premise%20server.%3C%2FP%3E%0A%3CP%3EIf%20you%20want%20to%20test%20that%20a%20lab%20vm%20can%20connect%20to%20an%20onpremise%20machine%2C%20it%20is%20common%20to%20use%20ping.%26nbsp%3B%20Ping%20is%20a%20tool%20available%20on%20both%20Windows%20and%20Linux%20that%20sends%20messages%20using%20the%20ICMP.%26nbsp%3B%20By%20default%2C%20Azure%20VMs%20block%20the%20ICMP.%26nbsp%3B%20To%20use%20ping%2C%20you%20will%20need%20to%20add%20a%20firewall%20rule%20on%20the%20Azure%20VM%20to%20allow%20ping%2C%20update%20any%20NSG%20rules%20blocking%20ICMP%20and%20possibly%20update%20the%20firewall%20rules%20on%20the%20destination%20resource%20in%20the%20on-premise%20environment.%3C%2FP%3E%0A%3CP%3EAlternately%2C%20if%20the%20resource%20you%20want%20to%20reach%20is%20available%20on%20a%20different%20port%2C%20you%20can%20use%20the%20Test-Connection%20PowerShell%20cmdlet.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3ETest-netconnection%20%3CIP%3E%20-Port%20%3CPORTNUMBER%3E%3C%2FPORTNUMBER%3E%3C%2FIP%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1381569%22%20slang%3D%22en-US%22%3E%3CP%3EGuide%20for%20connecting%20Lab%20Services%20with%20an%20on-premise%20network.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1381569%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ELab%20Services%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

This blog post is written as a guide for peering Lab Services with an on-premise network.  Every network architecture is different and so this post  is not intended as a detailed step-by-step instructional document.  Rather, the intention of this document is to give guidance for the general steps and mention any possible issues that may arise with common network architectures.

 

The document discusses connecting to an on-premise network.   It is assumed that on-premise network has a network gateway to which a VPN tunnel (site-to-site or ExpressRoute) may be connected.  Details regarding how to setup an on-premise network will not be covered in this document.  It is important to know the following information before proceeding.

  1. What type of VPN tunnel is supported to the on-premise network?  It should be either site-to-site or ExpressRoute.  ExpressRoute is a private connection between the Azure datacenters infrastructure on the Customer’s premises.  A site-to-site VPN gateway connection used to connect to your on-premises network over IPsec.  NOTE: If the connection type is ExpressRoute, you will need someone with the appropriate permissions to create a connection to the ExpressRoute gateway.
  1. The public ip address of the vpn gateway for the on-premise network.
  2. Shared key for the connection from the hub gateway to the on-premise gateway.  A shared key is like a password to ensure the connection is expected.

The diagram below shows the architecture of the solution that will be used.  There is an on-premise network with a vpn gateway.  Since virtual networks created for a classroom lab cannot be connected directly to an on-premise network, we will create a virtual network in the as the lab account.  This virtual network will be connected via a VPN tunnel to the on-premise network.  It will also be peered to the virtual network created in the Azure Lab Services subscription for your classroom lab.  The virtual network in the same subscription as the lab account is the glue that makes the scenario work.

planetmaher_0-1589255428656.jpeg

 

A couple notes before we get started:

  1. The lab account resource and the Azure virtual network to be peered must be in the same region.
  2. The virtual network should be in the same subscription.  If this is not possible, as might be the case when using Express Route, the lab account will need to be peered to a vnet in the same subscription and then a vnet-to-vnet connection made with BGP enabled between the peered vnet and the ExpressRoute hub vnet.

Create your Lab Account

Follow the instructions at how to manage lab accounts to create your lab account.  Don’t worry about peering vnets yet.  We need to setup our vnet first.

Creating the VNet and Gateway in Your Subscription

  1. Create a resource group to hold the virtual network and related resources. 
    • Name: hub-rg.
  2. Create a virtual network in the hub-rg resource group.
    • Name: hub-vnet
    • Subscription: Same subscription as your lab account.
    • Location: Same location as your lab account.
    • Address Range: Select ip range that does not overlap with any existing ip ranges  for the on-premise network.  This address range will specify the address range for all classroom lab virtual machines.  We will use 10.1.0.0/16.  Remember this range for later.
    • NOTE: It is extremely important that the vnet be created in the same subscription and location as your lab account.  You will not see this virtual network as an option in the peered network setting for the lab account otherwise.
  1. Create a gateway subnet in hub-vnet.  This is required to create a vpn gateway. 
    • Open the virtual network in the Azure Portal and click ‘Add gateway subnet’.
    • Choose an ip range that is within the larger vnet range that doesn’t overlap any existing subnets.  We will use 10.1.255.0/27.
    • NOTE: It is recommended to use a /27 or /28 range for your gateway subnet.
  2. Create a virtual network gateway instance
    • NOTE: This step can take up to 45 minutes to complete.
    • In the Azure search for ‘Virtual Network Gateway’ when adding a new resource
    • Subscription: same as lab account
    • Name: hub-vpn-gateway
    • Region: Same as lab account and vnet
    • Gateway type: VPN or ExpressRoute as appropriate
    • VPN type: Leave a Route-base unless on-premise network architecture requires policy-based.
    • WARNING: If using a policy-based vpn, you must update the address spaces on both sides of the tunnel simultaneously.  Otherwise, you could cause a disruption in the tunnel.
    • Sku: Sku options are listed in https://docs.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-about-vpn-gateway-settings#gwsku.  We will use Generation 1, VpnGw1.
    • Virtual network: hub-vnet
    • Public ip address: create a new public ip called hub-gw-pip
    • NOTE: If ‘enable active-active mode’ or ‘configure BGP ASN’ need to be enabled, contact consult your IT department.  Both settings are more advanced and outside the scope of this document.
  1. Wait for the virtual network gateway instance creation to complete.  You will need to know the address of the public ip (hub-gw-pip) before continuing.
  2. Create a local network gateway
    • Name: hub-local-gw
    • IP address: onpremise ip address (This is the public ip of the onpremise-vpn-gateway instance.)
    • Address space: Address space for onpremise-vnet.  

Create Connection between Hub Gateway and On-Premise Gateway

Connections must be created in both directions to be complete.  First, let’s start with the hub gateway to on-prem gateway connection.

  1. Open hub-vnet-gateway in the Azure Portal.
  2. Choose Connections.
  3. Click Add
    • Name: HubtoOnPrem
    • Connection type: IPSec for site-to-site connections.  Choose ExpressRoute for that type of connection.
    • Second virtual network gateway: choose hub-local-gw
    • Shared key (PSK): shared keyed for connection to the onpremise gateway.  This should be a value
    • IKE Protocol: leave at IKEV2.  (Route based)
    • WARNING: IKEV1 (policy based) is the older version of the protocol.  Changes to one side of ‘PolicyBased’ or ‘RouteBased with PolicyBasedTrafficSelectors’ can cause issues with the tunnel.  Update both sides together.

Second, create the connection from the on-prem network to the Azure virtual network.  Once that hub to on-prem connection is made, the on-prem to hub connection must be made by the person or team maintaining the on-premise network.  The same shared key must be used.

Each row in the connections blade for virtual network can be clicked to open the connection details blade.  The status will tell you if the bi-direction connection is complete or not.

Peer hub vnet to Lab Services Lab Account 

Peer the lab account to the hub vnet by following instructions at https://docs.microsoft.com/en-us/azure/lab-services/classroom-labs/how-to-connect-peer-virtual-netwo....  Remember the hub-vnet must be in the same subscription and region as the lab account to be seen in the drop down. 

 

IMPORTANT: The vnet peering on the lab account must be done before any labs are created.  Previously created template machines or student virtual machines are not updated.

 

IMPORTANT: Also, it is important to set an address range for the new lab to use.  If not specified Lab Services will default to something like 10.x.0.0/16.  If you used any of the default ranges making the hub vnet, the lab services lab vnets could overlap the hub vnet’s address space causing issues.

 

Make sure to specify an address range large enough to hold all the lab you wish to create.  A subnet with a /23 subnet is created for each lab.  (/23 CIDR range creates a maximum of 512 addresses.)  For example, a /21 address range will be large enough to create 4 labs for that lab account.  Azure side adds these addresses to the total vnet address spaces for the vnet gateway.  The onpremises vpn must include the lab vnet address space as well as the hub vnet address space for traffic to flow over the peering branches.

Conclusion

You are now ready to start creating labs.  Make sure to check any NSG settings on the on-premise network to all traffic from the Lab Services hosted VMs to the on-premise server.

If you want to test that a lab vm can connect to an onpremise machine, it is common to use ping.  Ping is a tool available on both Windows and Linux that sends messages using the ICMP.  By default, Azure VMs block the ICMP.  To use ping, you will need to add a firewall rule on the Azure VM to allow ping, update any NSG rules blocking ICMP and possibly update the firewall rules on the destination resource in the on-premise environment.

Alternately, if the resource you want to reach is available on a different port, you can use the Test-Connection PowerShell cmdlet.

 

 

 

Test-netconnection <ip> -Port <portnumber>