未加星标

Troubleshooting NSGs using Diagnostic Logs

字体大小 | |
[系统(windows) 所属分类 系统(windows) | 发布者 店小二03 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

Troubleshooting NSGs using Diagnostic Logs
I’ve wrote about how to use Network Security Group (NSG)before.

Chances are, once you get a complicated enough set of rules in a NSG, you’ll find yourself with NSGs that do not do what you think they should do.

Troubleshooting NSGs isn’t trivial.

I’ll try to give some guidance here but to this date (January 2017), there is no tool where you can just say “please follow packet X and tell me against which wall it bumps”. It’s more indirect than that.

Connectivity

First thing, make sure you can connect to your VNET.

If you are connecting to a VM via a public IP, make sure you have access to that IP (i.e. you’re not sitting behind an on premise firewall blocking the outgoing port you are trying to use), that the IP is connected to the VM either directly or via a Load Balancer.

If you are connecting to a VM via a private IP through a VPN Gateway of some sort, make sure you can connect and that your packets are routed to the gateway and from there they get routed to the proper subnet.

An easy way to make sure of that is to remove all NSGs and replace them by a “let everything go in”. Of course, that’s also opening your workloads to hackers, so I recommend you do that with a test VM that you destroy afterwards.

Diagnose

Then I would recommend to go through the official Azure guidelines to troubleshoot NSGs . This walks you through the different diagnosis tools.

Diagnostic Logs

If you reached this section and haven’t achieve greatness yet, well… You need something else.

What we’re going to do here is use NSG Diagnostic Logs to understand a bit more what is going on.

By no means is this magic and especially in an environment already in use where a lot of traffic is occurring, it might be difficult to make sense of what the logs are going to give us.

Nevertheless, the logs give us a picture of what really is happening. They are aggregated though, so we won’t see your PC IP address for instance. The aggregation is probably what limit the logs effectiveness the most.

Sample configuration

I provide here a sample configuration I’m going to use to walk through the troubleshooting process.

{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"VM Admin User Name": {
"defaultValue": "myadmin",
"type": "string"
},
"VM Admin Password": {
"defaultValue": null,
"type": "securestring"
},
"Disk Storage Account Name": {
"defaultValue": "<your prefix>vmpremium",
"type": "string"
},
"Log Storage Account Name": {
"defaultValue": "<your prefix>logstandard",
"type": "string"
},
"VM Size": {
"defaultValue": "Standard_DS2",
"type": "string",
"allowedValues": [
"Standard_DS1",
"Standard_DS2",
"Standard_DS3"
],
"metadata": {
"description": "SKU of the VM."
}
},
"Public Domain Label": {
"type": "string"
}
},
"variables": {
"Vhds Container Name": "vhds",
"VNet Name": "MyVNet",
"Ip Range": "10.0.1.0/24",
"Public IP Name": "MyPublicIP",
"Public LB Name": "PublicLB",
"Address Pool Name": "addressPool",
"Subnet NSG Name": "subnetNSG",
"VM NSG Name": "vmNSG",
"RDP NAT Rule Name": "RDP",
"NIC Name": "MyNic",
"VM Name": "MyVM"
},
"resources": [
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('Public IP Name')]",
"apiVersion": "2015-06-15",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "Public IP"
},
"properties": {
"publicIPAllocationMethod": "Dynamic",
"idleTimeoutInMinutes": 4,
"dnsSettings": {
"domainNameLabel": "[parameters('Public Domain Label')]"
}
}
},
{
"type": "Microsoft.Network/loadBalancers",
"name": "[variables('Public LB Name')]",
"apiVersion": "2015-06-15",
"location": "[resourceGroup().location]",
"tags": {
"displayName": "Public Load Balancer"
},
"properties": {
"frontendIPConfigurations": [
{"name": "LoadBalancerFrontEnd","comments": "Front end of LB: the IP address","properties": { "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses/', variables('Public IP Name'))]" }}
}
],
"backendAddressPools": [
{"name": "[variables('Address Pool Name')]"
}
],
"loadBalancingRules": [
{"name": "Http","properties": { "frontendIPConfiguration": { "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('Public LB Name')), '/frontendIPConfigurations/LoadBalancerFrontEnd')]" }, "frontendPort": 80, "backendPort": 80, "enableFloatingIP": false, "idleTimeoutInMinutes": 4, "protocol": "Tcp", "loadDistribution": "Default", "backendAddressPool": { "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('Public LB Name')), '/backendAddressPools/', variables('Address Pool Name'))]" }, "probe": { "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('Public LB Name')), '/probes/TCP-Probe')]" }}
}
],
"probes": [
{"name": "TCP-Probe","properties": { "protocol": "Tcp", "port": 80, "intervalInSeconds": 5, "numberOfProbes": 2}
}
],
"inboundNatRules": [
{"name": "[variables('RDP NAT Rule Name')]","properties": { "frontendIPConfiguration": { "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('Public LB Name')), '/frontendIPConfigurations/LoadBalancerFrontEnd')]" }, "frontendPort": 3389, "backendPort": 3389, "protocol": "Tcp"}
}
],
"outboundNatRules": [],
"inboundNatPools": []
},
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', variables('Public IP Name'))]"
]
},
{
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('VNet Name')]",
"apiVersion": "2016-03-30",
"location": "[resourceGroup().location]",
"properties": {
"addressSpace": {
"addressPrefixes": ["10.0.0.0/16"
]
},
"subnets": [
{"name": "default","properties": { "addressPrefix": "[variables('Ip Range')]", "networkSecurityGroup": { "id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('Subnet NSG Name'))]" }}
}
]
},
"resources": [],
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('Subnet NSG Name'))]"
]
},
{
"apiVersion": "2015-06-15",
"name": "[variables('Subnet NSG Name')]",
"type": "Microsoft.Network/networkSecurityGroups",
"location": "[

本文系统(windows)相关术语:三级网络技术 计算机三级网络技术 网络技术基础 计算机网络技术

主题: .NetSGVPN
分页:12
转载请注明
本文标题:Troubleshooting NSGs using Diagnostic Logs
本站链接:http://www.codesec.net/view/523205.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(windows) | 评论(0) | 阅读(31)