Azure Network Security Group Vs Route Tables
Asked Answered
G

1

5

Networking newbie here. From the Documentation it feels like both NSG and Routing tables(UDR) are doing the same thing - capable of defining ACLs at multiple levels (Vnet, Subnet, VM)

https://learn.microsoft.com/en-us/azure/virtual-network/network-security-group-how-it-works https://learn.microsoft.com/en-us/azure/virtual-network/virtual-networks-udr-overview

So how are they different and when is each used?

thanks.

Gadabout answered 3/3, 2021 at 22:3 Comment(0)
C
10

Azure automatically creates a route table for each subnet within an Azure virtual network and adds system default routes to the table. The route table is like a networking map that tells the traffic from one place to another place via the next hop. This generates the "path" but does not filter traffic.

The Azure network security group is used to filter network traffic to and from Azure resources in an Azure virtual network. It contains security rules that allow or deny inbound network traffic to, or outbound network traffic from, several types of Azure resources. If there is no route to one place from a subnet, you even do not need to configure the security rules because there is no path. So when you consider the NSG it should have a successful network route.

For example, usually, we can access Azure VM in Azure virtual network via SSH or RDP over the Internet but it has a less secure way to expose the port 22 or 3389. We can restrict access to your Azure VM via specifying the source IP address in the NSG. This setting allows traffic only from a specific IP address or range of IP addresses to connect to the VM. Read more details here. In this scenario, we need to ensure that there is a route to the internet from your Azure virtual network and vice versa.

Cohen answered 4/3, 2021 at 1:47 Comment(2)
So UDR is only for mapping routes and it does not do any filtering? Can you also clarify at what levels do both UDR and NSG operate - VM/Subnet/Vnet etc? ThanksGadabout
Yes, UDR is only for routing. In Azure, UDR is assigned to the subnet level, the NSG can be assigned to the subnet and the network interface level.Cohen

© 2022 - 2024 — McMap. All rights reserved.