• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login
Netgate Discussion Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
  • Register
  • Login

SOLVED: (WPAD) Export Proxy Config through DHCP

Scheduled Pinned Locked Moved DHCP and DNS
5 Posts 3 Posters 20.8k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y
    yoogie
    last edited by Mar 21, 2007, 2:57 PM Mar 16, 2007, 3:39 PM

    Hi,

    how can I export additional dhcp options? I want to export a Proxy PAC file through the webserver of Captive Portal. Is that possible?

    For those that are interested: http://www.ietf.org/proceedings/99nov/I-D/draft-ietf-wrec-wpad-01.txt

    Regards,
    Manuel

    1 Reply Last reply Reply Quote 0
    • D
      databeestje
      last edited by Mar 17, 2007, 6:59 PM

      use a wpad.domain.com hostname/webserver with a wpad.dat proxy pac

      Enforce it using AD Group Policies
      Click autodetect in the browser

      1 Reply Last reply Reply Quote 0
      • Y
        yoogie
        last edited by Mar 19, 2007, 7:07 AM

        Well, the problem is that I don't have admin rights on the maschine using the internet connection. So I wanted to set the option 252 in dhcp (auto-proxy-config) to the proxy.pac exported by captives lighttpd.

        Is it possible to set a custom option in dhcpd?

        1 Reply Last reply Reply Quote 0
        • H
          hoba
          last edited by Mar 19, 2007, 12:09 PM

          We currently don't support custom options besides the ones listed at services>dhcp server. Setting a prox is unfortunately not one of these options.

          1 Reply Last reply Reply Quote 0
          • Y
            yoogie
            last edited by Mar 21, 2007, 1:12 PM Mar 21, 2007, 8:44 AM

            Hi, I have integrated the automatic proxy configuration by myself. It is integrated in the gui. Feel free to adopt.

            The files to edit:

            • /usr/local/www/services_dhcp.php

            • /etc/inc/services.inc

            The modifications:

            /usr/local/www/services_dhcp.php

            
               $pconfig['failover_peerip'] = $config['dhcpd'][$if]['failover_peerip'];
               $pconfig['netmask'] = $config['dhcpd'][$if]['netmask'];
            +  $pconfig['wpad'] = $config['dhcpd'][$if]['wpad'];
            
               $ifcfg = $config['interfaces'][$if];
            
            -----
            
            		$config['dhcpd'][$if]['next-server'] = $_POST['nextserver'];
            		$config['dhcpd'][$if]['filename'] = $_POST['filename'];
            +		$config['dhcpd'][$if]['wpad'] = $_POST['wpad'];
            
            		write_config();
            
            		/* static arp configuration */
            		interfaces_staticarp_configure($if);
            
            -----
            
            				Leave blank to disable.  Enter the REAL address of the other machine.  Machines must be using CARP.
            
            +                      
            +                        Automatic Proxy URL
            +                        
            +                          
            +                          
            
            +                          This is the URL to the automatic proxy script.
            +			
            +                      
            
                                    Static ARP
            
            

            /etc/inc/services.inc

            
            one-lease-per-client true;
            deny duplicates;
            
            EOD;
            
            +	if (isset($dhcpifconf['wpad'])) {
            +		$dhcpdconf .= "option wpad-url code 252 = text;"."\n";
            +		$dhcpdconf .= "option wpad-url \"".$dhcpifconf['wpad']."\\n\";"."\n";
            +	}
            
            	$dhcpdifs = array();
            
            	/*    loop through and deterimine if we need to setup
            	 *    failover peer "bleh" entries
            
            

            With these slight modifications, there will be an extra field in the dhcp configuration where you can enter the URL to your proxy.pac. I have copied my proxy.pac to /usr/local/captiveportal/captiveportal-proxy.pac and have entered in the Automatic proxy field http://192.168.0.1:8000/captiveportal-proxy.pac.

            My proxy script looks like this:

            
            function FindProxyForURL(url, host)
            {
            if (
                 (isPlainHostName(host)) ||
                 (dnsDomainIs(host, ".dsl.local")) ||
                 (isInNet(host, "10.0.0.0", "255.0.0.0")) ||
                 (isInNet(host, "172.16.0.0", "255.240.0.0")) ||
                 (isInNet(host, "169.254.0.0", "255.255.0.0")) ||
                 (isInNet(host, "192.168.0.0", "255.255.0.0"))
               )
                 return "DIRECT";
            
             else
            
            if (
                 (isInNet(myIpAddress(), "192.168.0.0", "255.255.255.0"))
               )
                 return "PROXY 192.168.0.1:3128";
            }
            
            

            Cheers,
            Manuel

            1 Reply Last reply Reply Quote 0
            5 out of 5
            • First post
              5/5
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
              This community forum collects and processes your personal information.
              consent.not_received