Allen Zhang
Allen Zhang

Reputation: 2552

How to add a gateway subnet to Vnet that contains VMs on Azure

My existing Vnet has a default subnet: 10.0.1.0/24

And I have a VM in it with IP address: 10.0.1.8

Now I want to add a gateway subnet so that I can connect web app to it, and the web app should be able to use the VM's private IP to access it.

But when I try to add a gateway subnet, I can't specify 10.0.1.0/24 because it overlaps with the default. I can't specify 10.0.0.0/24 either because the VM is not within this range.

How do I do it, then?

Upvotes: 0

Views: 1634

Answers (1)

Hannel
Hannel

Reputation: 1706

You cannot add a gateway subnet that uses the same address space (10.0.1.0/24) as VNet.

If you original subnet has a smaller address space (ie: /26, /28) then you can add a gateway subnet using that format.

If you original subnet is using the whole address space (ie: /24) then a work around will be to add a new address space to the VNet and add new subnets on that address to the VNet splitting them up correctly.

Upvotes: 0

Related Questions