azure - 无法解析 Azure 中的 DNS 地址

标签 azure firewall azure-dns

我有一个 Hub-Spoke 模型。我还有一个 Azure DNS 区域。我的 Hub and Spoke 中有一个防火墙,使用路由表。我已在 Spoke 中创建了一个虚拟机,并在 Azure DNS 区域中添加了“A”记录,但是,我无法解析 Azure 中的 DNS 地址。

我有一个具有以下角色的 Azure 防火墙

# Create a Azure Firewall Network Rule for DNS
resource "azurerm_firewall_network_rule_collection" "fw-net-dns" {
  name                = "azure-firewall-dns-rule"
  azure_firewall_name = azurerm_firewall.azufw.name
  resource_group_name = azurerm_resource_group.ipz12-dat-np-connection-rg.name
  priority            = 102
  action              = "Allow"

  rule {
    name = "DNS"
    source_addresses = [
      "*",
    ]
    destination_ports = ["53"]
    destination_addresses = [
      "*",
    ]
    protocols = ["TCP","UDP"]
  }
}

我有一个包含以下路由的路由表

resource "azurerm_route_table" "azurt" {
  name                          = "AzfwRouteTable"
  resource_group_name           = azurerm_resource_group.ipz12-dat-np-connection-rg.name
  location                      = azurerm_resource_group.ipz12-dat-np-connection-rg.location
  disable_bgp_route_propagation = false

  route {
    name                   = "AzgwRoute"
    address_prefix         = "10.2.3.0/24" // CIDR of 2nd SPOKE
    next_hop_type          = "VirtualNetworkGateway"
  }  

  route {
    name                   = "Internet"
    address_prefix         = "0.0.0.0/0"
    next_hop_type          = "VirtualAppliance"
    next_hop_in_ip_address = azurerm_firewall.azufw.ip_configuration.0.private_ip_address
  }  

  tags = {
    environment = "Staging"
    owner       = "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="74271b19111b1a1134171b1a001b071b5a171b19" rel="noreferrer noopener nofollow">[email protected]</a>"
    costcenter  = "IT"
  }

  depends_on = [
    azurerm_resource_group.ipz12-dat-np-connection-rg
  ]
}

它与子网关联

resource "azurerm_subnet_route_table_association" "virtual_machine_subnet_route_table_assc" {
  subnet_id      = azurerm_subnet.virtual_machine_subnet.id
  route_table_id = azurerm_route_table.azurt.id

  depends_on = [
    azurerm_route_table.azurt,
    azurerm_subnet.virtual_machine_subnet
  ]
}

我在上述子网中有一个虚拟机

resource "azurerm_network_interface" "virtual_machine_nic" {
  name                = "virtal-machine-nic"
  location            = azurerm_resource_group.ipz12-dat-np-applications-rg.location
  resource_group_name = azurerm_resource_group.ipz12-dat-np-applications-rg.name

  ip_configuration {
    name                          = "internal"
    subnet_id                     = data.azurerm_subnet.virtual_machine_subnet.id
    private_ip_address_allocation = "Dynamic"
  }

  depends_on = [
    azurerm_resource_group.ipz12-dat-np-applications-rg
  ]  
}

resource "azurerm_windows_virtual_machine" "virtual_machine" {
  name                = "virtual-machine"
  resource_group_name = azurerm_resource_group.ipz12-dat-np-applications-rg.name
  location            = azurerm_resource_group.ipz12-dat-np-applications-rg.location
  size                = "Standard_B1ms"
  admin_username      = "...."
  admin_password      = "...."
  network_interface_ids = [
    azurerm_network_interface.virtual_machine_nic.id
  ]

  os_disk {
    caching              = "ReadWrite"
    storage_account_type = "Standard_LRS"
  }

  source_image_reference {
    publisher = "MicrosoftWindowsDesktop"
    offer     = "Windows-10"
    sku       = "21h1-pro"
    version   = "latest"
  }

  depends_on = [
    azurerm_network_interface.virtual_machine_nic
  ]    
}

我创建了一个 Azure DNS 区域

resource "azurerm_dns_zone" "dns_zone" {
  name                = "learnpluralsight.com"
  resource_group_name = azurerm_resource_group.ipz12-dat-np-connection-rg.name
  
  depends_on = [
    azurerm_resource_group.ipz12-dat-np-connection-rg
  ]  
}

并添加了“A”记录

enter image description here

但我无法解析 FQDN

enter image description here

最佳答案

我尝试在我的环境中重现相同的内容,但我收到相同的请求超时

enter image description here

要解决此问题,您需要添加反向查找区域并为DNS服务器创建PTR记录名称和 IP。

enter image description here

在反向查找区域 -> 右键单击​​选择新区域

enter image description here

enter image description here

单击下一步作为主要区域 -> 选中存储区域框 -> 下一步 -> 单击第二个选项所有 dns 服务器...域中 -> IPv4 反向查找 -> 下一步

在这里,您应该将您的 IP 地址添加为 150.171.10 第一个三个八位字节 -> 单击下一步 -> 选择仅允许安全动态 -> 下一步 -> 完成

enter image description here

一旦您刷新,您的默认记录就会被添加,右键单击并创建指针 (PTR),如下所示,输入您的 IP 地址150.171.10.35并提供您的主机名,您的 PTR 将成功添加

enter image description here

当我运行 nslookup 服务器时,它运行成功,没有请求超时。

enter image description here

<小时/>

如果这仍然持续在您的搜索框中 -> 网络和互联网 -> 以太网 -> 右键单击​​ -> 属性 -> 互联网协议(protocol)版本 提供 DNS 服务器,如下所示.

仍然出现任何问题,请尝试:

首选 DNS 服务器为 8.8.8.8 备用 DNS 服务器为 8.8.4.4 或
首选 DNS 服务器为 8.8.8.8 备用 DNS 服务器作为您的 IP

引用:dns request timeout (spiceworks.com)

enter image description here

检查您是否已将 IPv6 设置为自动获取 DNS 服务器,否则取消选中。

enter image description here

关于azure - 无法解析 Azure 中的 DNS 地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74147230/

相关文章:

azure - Pod 终止后,Azure AD Pod 身份会发生什么情况

azure - 使用 Azure 数据库备份,允许同时进行多少次还原?

c - 您希望应用程序接受传入的网络连接吗?

php - Symfony2 保护所有子域

azure - 提取 Azure DNS 查询日志以进行进一步分析的最佳方法是什么

azure - 从logicapp调用Azure函数时出现BadRequest

networking - 如何允许分段数据包通过防火墙(ipv4/v6)?

指向 Azure CDN 终结点的 Azure DNS 根域

Azure 私有(private) DNS 配置不适用于 P2S VPN

rest - 使用 Symantec 的 Azure PaaS 恶意软件防护