Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetworkHelper create new vnet with DNS setting can't resolve anything #656

Closed
netwmr01 opened this issue Apr 11, 2016 · 6 comments
Closed

Comments

@netwmr01
Copy link

public static VirtualNetwork createVirtualNetwork(
        NetworkResourceProviderClient networkResourceProviderClient, ResourceContext context)
        throws Exception {
    VirtualNetwork vnet = new VirtualNetwork(context.getLocation());
    String subnetName = context.getSubnetName();
    String vnetName = context.getVirtualNetworkName();

    // set AddressSpace
    AddressSpace asp = new AddressSpace();
    ArrayList<String> addrPrefixes = new ArrayList<String>(1);
    addrPrefixes.add("10.0.0.0/16");
    asp.setAddressPrefixes(addrPrefixes);
    vnet.setAddressSpace(asp);

    // set DhcpOptions
    DhcpOptions dop = new DhcpOptions();
    ArrayList<String> dnsServers = new ArrayList<String>(2);
    **dnsServers.add("10.1.1.1");**
    dop.setDnsServers(dnsServers);
    vnet.setDhcpOptions(dop);
@anuchandy
Copy link
Member

@netwmr01 are you saying you are able to configure the DNS server but it can't resolve queries?

To diagonise - are you able to see the DNS settings in the virtual network using any tool such as powershell?

  1. Install Azure Powershell tool
  2. Login to your subscription "Login-AzureRmAccount"
  3. Print the virtual network "Get-AzureRmVirtualNetwork -Name vnet-name -ResourceGroupName resource-group-name

@anuchandy
Copy link
Member

If the DNS settings are set in the server but still it fails to resolve then we need to check any additional configuration is required in the VNET.

@netwmr01
Copy link
Author

what I am trying to do is not creating a dns server.
NetworkHelper class is part of the azure sdk.
I want to use the Azure provided dns instead of using my own.

This VM is created using template base deployment method without me specifying any DNS when creating the VNet. I am expecting something like this
cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search ny2pc4ydp5lujkrwyfzkpy2ggf.bx.internal.cloudapp.net eastus.cloudapp.azure.com
nameserver 168.63.129.16

However, SDK VM using NetworkHelper class give me the following:
cat /etc/resolv.conf
; generated by /sbin/dhclient-script
search reddog.microsoft.com
nameserver 10.1.1.1

@anuchandy
Copy link
Member

@netwmr01 Ok, so what you are saying is:

Creating a VNet via NetworkHelper in the SDK sets nameserver as 10.1.1.1. This nameserver cannot resolve DNS queries. Basically, NetworkHelper should be fixed (possibly by not setting explicit DNS) so that created VNet behaves like the one created using template.

Are we on the same page?

@netwmr01
Copy link
Author

Looks like given it an empty arraylist will resolve this problem and make the VNET use azure provided DNS.

@jianghaolu
Copy link
Contributor

Closing as resolved.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants