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

Added a new network creation driver option (disable_gatewaydns) for t… #2021

Merged
merged 1 commit into from
Dec 13, 2017

Conversation

soccerGB
Copy link
Contributor

…he Windows driver

Signed-off-by: Cheng-mean Liu soccerl@microsoft.com

This new disable_gatewaydns option provides a way for a client to create a network instance without any gateway IP added into the DNS list for all of its endpoints.

Usage of disable_gatewaydns:
When set as true, the Windows network driver will skip the addition of the gateway IP into the DNS list.
When not specified, the default setting for disable_gatewaydns is false, that is, it will always add gateway IP into an endpoint's DNS list unless an endpoint was created specifically with an existing epOption.DisableDNS option.

Example usage:
docker network create -d nat --gateway 172.8.128.1 --subnet 172.8.128.0/20 -o com.docker.network.windowsshim.dnsservers=4.4.4.4,8.8.8.8 -o com.docker.network.windowsshim.disable_gatewaydns=true mynat

…he Windows driver

Signed-off-by: Cheng-mean Liu <soccerl@microsoft.com>
@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@460ac8f). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #2021   +/-   ##
=========================================
  Coverage          ?   38.85%           
=========================================
  Files             ?      137           
  Lines             ?    27374           
  Branches          ?        0           
=========================================
  Hits              ?    10637           
  Misses            ?    15439           
  Partials          ?     1298

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 460ac8f...884eaa0. Read the comment docs.

@msabansal
Copy link
Contributor

LGTM

@aserdean
Copy link

aserdean commented Dec 8, 2017

Thanks a lot for the patch!

It would be nice to mention this change require Windows version 1709 to work.

PS C:\> docker network create -d nat --gateway 172.8.128.1 --subnet 172.8.128.0/20 -o com.docker.network.windowsshim.dnsservers=4.4.4.4,8.8.8.8 -o com.docker.network.windowsshim.disable_gatewaydns=true mynat

PS C:\> docker run --network mynat microsoft/windowsservercore:1709 ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : dce0a7aa7c75
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : localdomain

Ethernet adapter vEthernet (Ethernet):

   Connection-specific DNS Suffix  . : localdomain
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #5
   Physical Address. . . . . . . . . : 00-15-5D-BA-33-0B
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::4c22:564:797d:206e%29(Preferred)
   IPv4 Address. . . . . . . . . . . : 172.8.130.38(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . : 172.8.128.1
   DNS Servers . . . . . . . . . . . : 4.4.4.4
                                       8.8.8.8
   NetBIOS over Tcpip. . . . . . . . : Disabled

PS C:\> docker run --network mynat --dns 8.8.4.4 --dns-search github.com microsoft/windowsservercore:1709 ipconfig /all

Windows IP Configuration

   Host Name . . . . . . . . . . . . : ef87f28a77b9
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Hybrid
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No
   DNS Suffix Search List. . . . . . : github.com

Ethernet adapter vEthernet (Ethernet):

   Connection-specific DNS Suffix  . : localdomain
   Description . . . . . . . . . . . : Hyper-V Virtual Ethernet Adapter #5
   Physical Address. . . . . . . . . : 00-15-5D-BA-30-68
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   Link-local IPv6 Address . . . . . : fe80::7dc7:584c:d593:40fd%29(Preferred)
   IPv4 Address. . . . . . . . . . . : 172.8.141.101(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . : 172.8.128.1
   DNS Servers . . . . . . . . . . . : 8.8.4.4
   NetBIOS over Tcpip. . . . . . . . : Disabled

This fully fixes: moby/moby#30260 , docker/for-win#397 .

Tested-by: Alin Gabriel Serdean aserdean@cloudbasesolutions.com

LGTM

cc @mavenugo

@fcrisciani
Copy link

LGTM

@fcrisciani fcrisciani merged commit 808500d into moby:master Dec 13, 2017
fcrisciani pushed a commit to fcrisciani/docker that referenced this pull request Dec 14, 2017
Windows fixes:
moby/libnetwork#1916
moby/libnetwork#2014
moby/libnetwork#2021

Fix for veth leak on daemon crash
Cleanup networkDB logic for node management

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
@philipwolfe
Copy link

Thanks for this great option!

In Visual Studio, I was not able to set this option in the docker-compose msbuild property <DockerComposeUpArguments>-o com.docker.network.windowsshim.disable_gatewaydns=true</DockerComposeUpArguments>.
But I was able to add it directly in the docker-compose yaml.

version: '3.4'

networks:
  app_net:
    driver_opts:
      com.docker.network.windowsshim.disable_gatewaydns: "true"

Works like a charm and saves me from having to reorder my DNS with the powershell
set-dnsclientserveraddress -interfaceindex xx -serveraddresses ("192.168.0.xx","192.168.0.xx","172.23.0.xx")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants