Skip to content

Instantly share code, notes, and snippets.

@jvshahid
Created November 16, 2017 21:55
Show Gist options
  • Save jvshahid/09304d2ef50629e6531836de014a9254 to your computer and use it in GitHub Desktop.
Save jvshahid/09304d2ef50629e6531836de014a9254 to your computer and use it in GitHub Desktop.
debugging bosh dns on windows

problem

ping bbs.service.cf.internal times out (or any *.service.cf.internal)

work around

changing the listen address of the bosh-dns agent from 169.254.0.2 to 127.0.0.1. note that requires disabling consul

Notes

  • if you are doing this manually you will need to disable the bosh-dns-nameserver
  • do not use nslookup (it does not go through the normal dns resolution on windows)
  • instead use Resolve-DnsName -Name "bbs.service.cf.internal" or [System.Net.Dns]::GetHostAddresses("bbs.service.cf.internal")
  • this was tested using light-bosh-stemcell-1600.1.23-build.2-google-kvm-windows2016-go_agent.tgz from the greenhouse s3 bucket

some random commands

[System.Net.Dns]::GetHostAddresses("bbs.service.cf.internal")                                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                  
Resolve-DnsName -Name "bbs.service.cf.internal"                                                                                                                                                                                                                                   
                                                                                                                                                                                                                                                                                  
[array]$servers = @("10.0.0.1")                                                                                                                                                                                                                                                   
[array]$servers = @("10.0.0.1","169.254.0.2")                                                                                                                                                                                                                                     
[array]$servers = @("169.254.0.2")                                                                                                                                                                                                                                                
[array]$servers = @("127.0.0.1")                                                                                                                                                                                                                                                  
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses $servers                                                                                                                                                                                                     
                                                                                                                                                                                                                                                                                  
# set dns by index (1 is localhost)                                                                                                                                                                                                                                               
Set-DnsClientServerAddress -InterfaceIndex 1 -ServerAddresses $servers                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                  
# specify the servers to query                                                                                                                                                                                                                                                    
Resolve-DnsName -Name "bbs.service.cf.internal" -DnsOnly -Server $servers                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                                  
# enable and disable the dns cache service                                                                                                                                                                                                                                        
Get-Service Dnscache | Set-Service -StartupType automatic -PassThru | Start-Service                                                                                                                                                                                               
Get-Service Dnscache | Stop-Service -PassThru | Set-Service -StartupType disabled                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                  
# find out the listen address of bosh-dns                                                                                                                                                                                                                                         
NETSTAT.EXE -abno  | findstr ' 53' | findstr 'LIS'                                                                                                                                                                                                                                
NETSTAT.EXE -abno  | more                                                                                                                                                                                                                                                         
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment