DNS redirect in Windows
I probably need something small (dnsmasq) for Windows
I will go with simple Hosts edition, and with open-source tool: hostsedit I really don’t need anything else.
Simple and manual
Tool to edit hosts file directly: http://www.holistech.co.uk/sw/hostsedit/hostsedit.html :: command line windows hosts file editor
Hosts Commander http://code.google.com/p/hostscmd/ :: hostscmd - Useful command-line tool for manipulating hosts file (C#, .NET 3.5/Mono 2.8+, Windows/Linux) - Google Project Hosting
Netsh built-in command to redirect DNS to virtual machine http://www.petri.co.il/configure_tcp_ip_from_cmd.htm :: Configure TCP/IP from the Command Prompt
You could set Windows DNS settings with: netsh interface ip set dns name=“Local Area Connection” source=static addr=192.168.0.X
DNS Jumper - Switching DNS servers with GUI Dns Jumper
The actual location of hosts file is defined by the following Registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath Value should be: %SystemRoot%\System32\drivers\etc.
pDNS Wildcard and questionmark support for hosts file http://www.studiomaraton.com/bzivkovic/ :: Index of /bzivkovic http://www.studiomaraton.com/bzivkovic/readme-pdns.txt ::
The problem is it can’t be deamonized (that is solvable), and needs a restart to reload hosts file (also solvable). But it’s poorly written.
Shitty: made in PHP and then packed with http://upx.sourceforge.net/
Acrylic DNS Proxy And has Acrylic HOSTS file with wildcard support. And it’s open source. http://mayakron.altervista.org/support/browse.php?path=Acrylic&name=Home :: mayakron’s deep
Very nicely written, but needs service restart on every change in hosts file. And, this hosts file is not the same as in Windows but another one (supporting wild-cards). But, it can be symlinked.
Dual DHCP DNS Server Very good one. http://sourceforge.net/projects/dhcp-dns-server/ :: Dual DHCP DNS Server | Free software downloads at SourceForge.net
Again, this one is also ignoring hosts file entries.
FastCache (freeware) http://www.analogx.com/contents/download/Network/fc/Freeware.htm :: Network Downloads : FastCache /// AnalogX
The big and old one http://tftpd32.jounin.net/#Top :: TFTPD32 : an opensource IPv6 ready TFTP server/service for windows : TFTP server
Mangling Hosts file
AngryHosts (not free) http://angryhosts.com/features/ :: Features angryhosts Accepts wildcards.
http://www.abelhadigital.com/hostsman :: HostsMan - abelhadigital.com
DNS forwarder for Windows / Dnsmasq for Windows. It’s really not needed
just a note. The best one is Acrylic. It’s lightweight and runs as a service. Install with:
wget http://sourceforge.net/projects/acrylic/files/latest/download -O acrylic.exe start /wait acrylic.exe /S /D=%ProgramFiles%\DNSProxy && echo DNS Proxy installed.
Set couple of variables:
set DNSPROXY_INSTALL_ROOT=C:\Program Files\DNSProxy ree -m DNSPROXY_INSTALL_ROOT "%DNSPROXY_INSTALL_ROOT%" set DNSPROXY_HOSTS=%DNSPROXY_INSTALL_ROOT%\AcrylicHosts.txt ree -m DNSPROXY_HOSTS "%DNSPROXY_HOSTS%"
By default, Acrylic uses OpenDNS servers, but I prefer Google’s ones. So, change that:
sed -i.bak -e "s/^\(PrimaryServerAddress\)=.*$/\1=188.8.131.52/g" ^ -e "s/^\(SecondaryServerAddress\)=.*$/\1=184.108.40.206/g" ^ "%DNSPROXY_INSTALL_ROOT%\AcrylicConfiguration.ini"
Set our proxy as default DNS server for our machine. This will find the first interface named like this, and set DNS as it should be:
netsh interface ip set dns "Local Area Connection" static 127.0.0.1 netsh interface ip set dns "Wireless Network Connection" static 127.0.0.1
Creating a symlink to system hosts file is definitely not working:
ren "%DNSPROXY_INSTALL_ROOT%\AcrylicHosts.txt" AcrylicHosts.original.txt mklink /H "%DNSPROXY_INSTALL_ROOT%\AcrylicHosts.txt" "%SystemRoot%\System32\drivers\etc\hosts"
Restart DNS service:
net stop AcrylicController & net start AcrylicController
Vagrant TODO: First in Ruby create lines like for hosts file (with VM UUID). Then compare if anything changed. If it is, obviously change that in file AcrylicHosts.txt, and restart service.
I can precompile Acrylic with Delphi 10 Lite. I wrote an email to author, but if he doesn’t do anything, I prepared everything to make a patch.