<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>logIt &#187; autodiscovery</title>
	<atom:link href="https://lakm.us/logit/tag/autodiscovery/feed/" rel="self" type="application/rss+xml" />
	<link>https://lakm.us/logit</link>
	<description>Log Around The Clock</description>
	<lastBuildDate>Sat, 06 Jun 2015 14:17:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>How DHCP/DNS Server Works in Web Proxy Autodiscovery Protocol (WPAD) for Today&#8217;s Browsers</title>
		<link>https://lakm.us/logit/2013/05/how-dhcp-dns-server-works-web-proxy-autodiscovery-protocol-wpad-today-major-browsers/</link>
		<comments>https://lakm.us/logit/2013/05/how-dhcp-dns-server-works-web-proxy-autodiscovery-protocol-wpad-today-major-browsers/#comments</comments>
		<pubDate>Wed, 15 May 2013 07:22:42 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[autodiscovery]]></category>
		<category><![CDATA[DHCP]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[MikroTik]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=665</guid>
		<description><![CDATA[Web Proxy Autodiscovery Protocol (WPAD) protocol draft expired in 1999, but today&#8217;s major browsers are still supporting it as will be shown later. Two types of DHCP server are tested to describe how WPAD behaves prior to/after starting up the internet browser. To be clear, uploaded packet captures are shared in CloudShark. DNS and domain [...]]]></description>
				<content:encoded><![CDATA[<p>Web Proxy Autodiscovery Protocol <a href="http://tools.ietf.org/html/draft-ietf-wrec-wpad-01" title="Web Proxy Auto-Discovery Protocol" target="_blank">(WPAD) protocol draft</a> expired in 1999, but today&#8217;s major browsers are still supporting it as will be shown later. Two types of DHCP server are tested to describe how WPAD behaves prior to/after starting up the internet browser. To be clear, uploaded packet captures are shared in <a href="http://www.cloudshark.org/" title="CloudShark" target="_blank">CloudShark</a>. DNS and domain resolution is a must for the WPAD to work when MS Windows Internet Options configured to &#8220;<a href="http://https://github.com/bandono/proxyConf/blob/v1.1/www/images/winxp-internet-properties-02-lan-settings.png" title="proxyConf Github: screenshot of Windows Internet Options proxy setting" target="_blank">Automatically detect settings</a>&#8221; (for <a href="http://en.wikipedia.org/wiki/Internet_Explorer_6">IE 6 in Windows XP desktop</a>, <a href="http://en.wikipedia.org/wiki/Internet_Explorer_8" target="_blank">IE 8 in Windows 7 desktop</a>, and <a href="https://www.google.com/intl/en/chrome/browser/" title="Chrome Browser - Google" target="_blank">Google Chrome</a>) or Firefox to &#8220;<a href="https://github.com/bandono/proxyConf/blob/v1.1/www/images/firefox-03-auto-proxy-config-url.png" title="proxyConf Github: screenshot of Firefox proxy setting" target="_blank">Auto-detect proxy settings for this network</a>&#8220;. As simplest DNS setting should work, this post will not cover its configuration. </p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="Low level view of WPAD interactions involving DHCP, DNS, and HTTP servers in packet capture (shared in CloudShark)" src="../../../../images/proxy-wpad-dhcp-dns-packet-capture-cloudshark.png" title="Low level view of WPAD interactions involving DHCP, DNS, and HTTP servers in packet capture (shared in CloudShark)" width="390" height="328" /><p class="wp-caption-text">Low level view of WPAD interactions involving DHCP, DNS, and HTTP servers in packet capture (shared in CloudShark)</p></div>
<p>In DHCP discovery-offer-request-acknowledgement cycle, WPAD information is given in option 252 (check <a href="http://tools.ietf.org/html/draft-ietf-wrec-wpad-01#section-4.4.1" target="_blank">section 4.4.1 of the draft</a>). I used <a href="http://packages.ubuntu.com/precise/dhcp3-server" target="_blank"><code>dhcpd3-server</code> package</a> in Ubuntu and setup <code>/ip dhcp-server option add code=252 ...</code> in <a href="http://www.mikrotik.com/download/CHANGELOG_5" target="_blank">Mikrotik 5.20</a> for example variations. For both, trailing &#8220;<code>\n</code>&#8221; are added to <code>wpad.dat</code> URL value as most howtos recommend.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #ff0000;">&quot;http://wpad.some-company.net/wpad.dat<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span></pre></div></div>

<p>In the above example value, <code>wpad.dat</code> is hosted in <a href="http://packages.ubuntu.com/precise/apache2" target="_blank">Apache2 HTTP server</a> resolvable by the DNS to the actual host IP of <code>wpad.some-company.net</code>. When the client use all DHCP offered items, it gets domain name (option 15) <code>some-company.net</code> besides other things e.g.  router (option 3), DNS (option 6), etc. In a case where the client use its own DNS (only use IP from DHCP), <strong>WPAD likely won&#8217;t work</strong> unless it is able to resolve the example <code>some-company.net</code> or <code>wpad.some-company.net</code>. Following the tail of <code>/var/log/apache2/access.log</code>, successful <code>wpad.dat</code> request will appear as</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">192.168.40.75 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span>01<span style="color: #000000; font-weight: bold;">/</span>May<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2013</span>:<span style="color: #000000;">21</span>:<span style="color: #000000;">51</span>:<span style="color: #000000;">15</span> +0700<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /wpad.dat HTTP/1.1&quot;</span> <span style="color: #000000;">200</span> <span style="color: #000000;">1070</span> <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;-&quot;</span></pre></div></div>

<p><span id="more-665"></span><br />
In the above tail, I enabled a Windows 7&#8242;s network adapter (from previously disabled) and it would soon try to HTTP <code>GET</code> the <code>wpad.dat</code> even when no browser opened yet.</p>
<p>From testing with Windows XP, Windows 7, and Ubuntu (with different browsers mostly), <code>DHCP Inform</code>&#8216;s WPAD behavior can be seen with Windows 7 test by analyzing the packet going out after some time since the initial DHCP stream (check <a href="http://www.cloudshark.org/captures/1dc9e4cb8ca1" title="WPAD packet capture: Windows 7 client with ISC DHCP server running in Ubuntu 12.04" target="_blank">the packet capture</a> for 7 seconds after <code>DHCP Discover</code>). It asked for WPAD in one of the <code>Parameter Request List Item</code> (apply the filter <code>bootp.option.request_list_item == 252</code> for a closer look), but received no answer.</p>
<p>I failed to reproduce other samples of <code>DHCP Inform</code> packet asking for WPAD. Hence, for the rest, it&#8217;s the browser who is doing the <code>GET</code> to <code>http://wpad.some-company.net/wpad.dat</code> with DHCP only supplied domain name instead of complete WPAD (check <a href="http://www.cloudshark.org/captures/5d73416a18d5" target="_blank">another packet capture</a>, this time for <a href="http://packages.ubuntu.com/precise/firefox" target="_blank">Ubuntu with Firefox 20</a>). The <code>GET</code> attempt isn&#8217;t actually one shot attempt. When it fails to find the <code>wpad.dat</code> in <code>http://wpad.some-company.net/wpad.dat</code>, it should iteratively try to find within the higher domain e.g. <code>http://some-company.net/wpad.dat</code>.</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="Getting proxy setting (WPAD) from DHCP or directly by browser iterative decision" src="../../../../images/proxy-wpad-dhcp-browser-iteration-decision-illustration.png" title="Getting proxy setting (WPAD) from DHCP or directly by browser iterative decision" width="292" height="193" /><p class="wp-caption-text">Getting proxy setting (WPAD) from DHCP or directly by browser iterative decision</p></div>
<p>DHCP server configuration used, <code>wpad.dat</code> file example (I simply use symbolic link to <code>proxy.pac</code>), and Apache2 <code>VirtualHost</code> config are available in <a href="https://github.com/bandono/proxyConf/tree/v1.1" target="_blank">my github, an attempt to integrate Squid3 cache with WPAD, PAC, and DHCP</a>.</p>
<p><a id="History" href="#History" rel="bookmark" title="History"><br />
<h4>History</h4>
<p></a></p>
<p>For trailing character in WPAD value mentioned earlier, I once configured option 252 value with &#8220;<code>wpad.dat\?</code>&#8220;, &#8220;<code>proxy.pa</code>&#8220;, and some other likely wrong variations. I also configured the browser in Windows XP and 7 with these variations of wrong values before getting the browser to use proxy auto-discovery again. Somehow it kept the wrong <code>GET</code> with trailing character resulting in 404 (page not found):</p>
<ol>
<li>Firefox</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">192.168.40.78 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">30</span><span style="color: #000000; font-weight: bold;">/</span>Apr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2013</span>:<span style="color: #000000;">16</span>:<span style="color: #000000;">20</span>:<span style="color: #000000;">39</span> +0700<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /wpad.dat/ HTTP/1.1&quot;</span> <span style="color: #000000;">404</span> <span style="color: #000000;">478</span> <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/4.0 (compatible; MSIE 6.0; Win32)&quot;</span></pre></div></div>

<li>IE 6</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">192.168.40.78 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">30</span><span style="color: #000000; font-weight: bold;">/</span>Apr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2013</span>:<span style="color: #000000;">16</span>:<span style="color: #000000;">28</span>:07 +0700<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /wpad.dat/ HTTP/1.1&quot;</span> <span style="color: #000000;">404</span> <span style="color: #000000;">478</span> <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;Mozilla/4.0 (compatible; MSIE 6.0; Win32)&quot;</span></pre></div></div>

<li>IE 8</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">192.168.40.77 - - <span style="color: #7a0874; font-weight: bold;">&#91;</span>01<span style="color: #000000; font-weight: bold;">/</span>May<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2013</span>:<span style="color: #000000;">20</span>:07:<span style="color: #000000;">24</span> +0700<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #ff0000;">&quot;GET /wpad.dat/? HTTP/1.1&quot;</span> <span style="color: #000000;">404</span> <span style="color: #000000;">534</span> <span style="color: #ff0000;">&quot;-&quot;</span> <span style="color: #ff0000;">&quot;-&quot;</span></pre></div></div>

</ol>
<p>I was able to force it to <code>GET</code> the correct WPAD value by adding new network adapter which received different IP lease from DHCP server. Afterwards, connecting with the old adapter will also keep correct behavior.</p>
<p>I still don&#8217;t know how they keep the previously incorrect behavior. <strong>In short we can&#8217;t rely on WPAD alone</strong>, but there is probability that some portions of the network clients will find the proxy this way, automatically without technical assistance.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2013/05/how-dhcp-dns-server-works-web-proxy-autodiscovery-protocol-wpad-today-major-browsers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
