This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

WPAD Howto

How to provide Proxy Settings to Clients (OS Independent)
-- feel free to extend or comment --

Situation:
LAN:  192.168.178.0/24
MS Windows 2003 SBS on 192.168.178.100
Services: WINS, DNS, DHCP, IIS
Clients: Windows XP, Vista, Linux
Astaro (v7 but shouldn't matter): 192.168.178.3
Proxy Services: 192.168.178.3:8080

on the SBS Server:

WINS: add a new static mapping with following details:
 Computer:wpad, type:unique, IP:192.168.178.100 
 Computer:wpad., type:unique, IP:192.168.178.100  -suggested by MS but seems to work without

DNS: add a new Class A Host in your DNS Zone with following details:
 Computer:wpad, type:unique, IP:192.168.178.100 
 not needed: Computer:wpad., type:unique, IP:192.168.178.100 -suggested by MS but seems to work without

DHCP: set a new predefined Option with following details:
 Name:wpad
 Data Type:string
 Code:252
 Value:http://wpad/wpad.dat
 (afterwards set this new option in your server or scope options)

IIS: in your IIS Properties add a new mime type with following details:
 Extension:.dat
 MIME Type:application/octet-stream
 In your Default Web Site Properties add the following identifications:
 IP Address:192.168.178.100
 TCP Port:80
 Host Header Value:wpad
and
 IP Address:192.168.178.100
 TCP Port:80
 Host Header Value:wpad.

Windows Explorer: add a file called wpad.dat in your default web site's root folder (by MS default that is c:\inetpub\wwwroot)

example for wpad.dat:
function FindProxyForURL(url)

{
// Proxy if PC is on local LAN
if (isInNet(myIpAddress(), "192.168.178.0", "255.255.255.0"))
return "PROXY 192.168.178.3:8080";
else
return "DIRECT";
}



Before this works:
- the IIS has to be restarted
- DNS Cache has to be cleared (DNS Server)
- ipconfig /flushdns on the clients

Note: make sure you change the above IP addresses to your local network settings and your browsers proxy settings are set to auto-detect proxy settings for this network


This thread was automatically locked due to age.
Parents
  • ...for MS Clients just use the GPO and you do not have to config each client.
  • where am I configuring each client?
    ipconfig /flushdns  just saves a reboot, and will not be required if you've got new clients or can wait for the next reboot (which would be also required for the machine targeted gpo)

    this is why I didn't go for gpo:
    - not all clients are domain members (don't wanna join domain for a proxy gpo)
    - need for a gpo setting for each browser (IE is fine, how about Firefox, Opera, Safari, oops not even MS OS)
    - not OS independent
    - Laptops (sometimes in LAN, mostly external)

    That's why I tried something 'Server Based', 'target independent'

    Anyway, thx for your comments
  • It figures I would find this thread the day after I figure it out on my own. [;)]

    But I have to say, this works great with our non-MS clients, which the number of has really taken off over the last few years.
  • The WINS server is optional and probably redundant given you are using DNS to resolve wpad host.

    You can actually do the whole lot in DNS since by default most clients will search for a wpad by default if "Auto detect proxy settings" is set in the client.  Unsure if firefox supports this but IE definately does.

    Here is another example of the actual WPAD file.
    (With proxy skips for HTTPS and some local hosts and other protocols)


    function FindProxyForURL(url, host)
    {
    var proxy_yes = "PROXY 192.168.3.1:8080; DIRECT";
    var proxy_no = "DIRECT";
    // Proxy if PC is on local LAN - doesn't work with Konqueror!
    // So this test is for Internet Explorer and compatible only

    //if (isInNet(myIpAddress(), "192.168.0.0", "255.255.252.0") || isInNet(myIpAddress(), "192.168.0.0", "255.255.252.0")) 
    // {
    if (
    url.substring(0, 6) == "https:"
    || url.substring(0, 16) == "http://localhost"
    || url.substring(0, 16) == "http://intranet."
    || url.substring(0, 11) == "http://mm00"
    || url.substring(0, 14) == "http://issues."
    || url.substring(0, 11) == "http://csg."
    || url.substring(0, 14) == "http://vm-mm00"
    || url.substring(0, 14) == "http://192.168"
    || url.substring(0, 16) == "http://203.11.69"
    || url.substring(0, 4) == "ftp:"
    || url.substring(0, 7) == "gopher:"
    )
    {
    return proxy_no;
    }
    else
    {
    return proxy_yes;
    }

    //}
    }
Reply
  • The WINS server is optional and probably redundant given you are using DNS to resolve wpad host.

    You can actually do the whole lot in DNS since by default most clients will search for a wpad by default if "Auto detect proxy settings" is set in the client.  Unsure if firefox supports this but IE definately does.

    Here is another example of the actual WPAD file.
    (With proxy skips for HTTPS and some local hosts and other protocols)


    function FindProxyForURL(url, host)
    {
    var proxy_yes = "PROXY 192.168.3.1:8080; DIRECT";
    var proxy_no = "DIRECT";
    // Proxy if PC is on local LAN - doesn't work with Konqueror!
    // So this test is for Internet Explorer and compatible only

    //if (isInNet(myIpAddress(), "192.168.0.0", "255.255.252.0") || isInNet(myIpAddress(), "192.168.0.0", "255.255.252.0")) 
    // {
    if (
    url.substring(0, 6) == "https:"
    || url.substring(0, 16) == "http://localhost"
    || url.substring(0, 16) == "http://intranet."
    || url.substring(0, 11) == "http://mm00"
    || url.substring(0, 14) == "http://issues."
    || url.substring(0, 11) == "http://csg."
    || url.substring(0, 14) == "http://vm-mm00"
    || url.substring(0, 14) == "http://192.168"
    || url.substring(0, 16) == "http://203.11.69"
    || url.substring(0, 4) == "ftp:"
    || url.substring(0, 7) == "gopher:"
    )
    {
    return proxy_no;
    }
    else
    {
    return proxy_yes;
    }

    //}
    }
Children