To configure WPAD on a windows server you will need the following:
1. A proxy server – see create Ubuntu Squid Proxy
2. A web server that will host the WPAD file
3. A DHCP server that will assign the WPAD file to clients
In this post we’ll assume you have a proxy up and running. So we will need to create the WPAD.dat file first.
On your webserver (in this example we are using Windows Server 2008R2 with IIS enabled). You will need to create a WPAD.dat file.
A wpad file typically looks like this:
function FindProxyForURL(url,host)
{
// If URL has no dots in domain name, send direct (no proxy)
if (isPlainHostName(host))
return "DIRECT";
// If URL matches, send direct.
if (shExpMatch(url,"*.somedomain.com*") ||
shExpMatch(url,"*.google.com*"))
return "PROXY 192.168.0.195:3128";
// If IP address is internal or hostname resolves to internal IP, send direct.
var resolved_ip = dnsResolve(host);
if (isInNet(resolved_ip, "192.168.0.0", "255.0.0.0") ||
isInNet(resolved_ip, "127.0.0.0", "255.255.255.0"))
return "DIRECT";
else return "PROXY 192.168.0.195:3128";
}
I will have the file placed on the root of my web server: C:\inetpub\wwwroot
File Name: wpad.dat
URL: http://mywebserver.domain.local:80/wpad.dat
Once that is created and you can browse the URL and the file prompts to be downloaded then you can enable it on the DHCP server.
On your DHCP Server (in this example we are using Windows Server 2008R2) you will have to create a scope option 252 (“auto-proxy-config”) with a string value of http://mywebserver.domain.local:80/wpad.dat
To do this, in DHCP, right click ipv4 and select Set Predefined options.
Select DHCP Standard options
Then select add
The name should be: 252 WPAD
Data type: String
String value: URL: http://mywebserver.domain.local:80/wpad.dat (Will be the wpad URL)
Ok and apply.
Now you can enable it within your DHCP Scope.
Expand your scope, then go to scope options.
Right click scope option and select configure options.
Scroll down and select the new 252 WPAD option you created and enable it.
Select ok.
Now you can test it on your network. Restart your computer or ipconfig/renew to retrieve the new details.