This snippet describes a workaround which can help when you're having issues connecting to a particular resource.
This is of course a temporary work around, however, can certainly get you out of a muddle fast!
For example, if you're unable to get to the nuget host, this guide can help you resolve this (temporarily!)
You can confirm whether you're having DNS issues, if for example, other connectivity otherwise appears fine, and a particular URL or resource will not resolve.
ping nuget.someneatresource.com
Ping request could not find host nuget.someneatresource.com. Please check the name and try again.
- Turn it off and on again.... Both your system & router can always benefit from a restart
- Before touching your hosts file, try the following from your command prompt:-
# Release your IP Address
ipconfig /release
# Renew the IP Address
ipconfig /renew
# Flush your DNS Cache
ipconfig /flushdns
The steps in this snippet will of course help you to get to the resource, however, this is not a permanent fix and it would be sensible to investigate the issue further in case things worsen!
This snippet uses the example of being unable to access nuget.someneatresource.com
Ask a friend to check the IP address for the resource from a working system (particularly if it's behind a VPN)
ping nuget.someneatresource.com
# Pinging nuget.someneatresource.com [10.1.3.95] with 32 bytes of data:
# Reply from 10.1.3.95: bytes=32 time=23ms TTL=254
# Reply from 10.1.3.95: bytes=32 time=24ms TTL=254
From the above, we can see the resource is hosted on IP Address 10.1.3.95
- Open an elevated command prompt
- WIN + R
- Type 'notepad'
- Use CTRL + SHIFT + ENTER to launch notepad as an administrator
- Open your hosts file
- File >> Open >> Navigate to:
C:\Windows\System32\drivers\etc
- Change 'File Type' to 'All Files'
- Double click 'hosts' to edit the file
- Add the following line at the footer of your hosts file:-
10.1.3.95 nuget.someneatresource.com
- Save the file & clear your DNS Cache
ipconfig /flushdns
- Test the change has been a success by pinging the IP Address, you should now see responses from the resource
ping nuget.someneatresource.com
NOTE: Some windows systems prefer a tab between the IP address and the hostname!