<?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>Daz's bits and bobs &#187; transparent proxy</title>
	<atom:link href="http://sigtar.com/tag/transparent-proxy/feed/" rel="self" type="application/rss+xml" />
	<link>http://sigtar.com</link>
	<description>…bytes bits</description>
	<lastBuildDate>Mon, 26 Jul 2010 07:25:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Opensolaris &#8211; configuring squid as a transparent proxy</title>
		<link>http://sigtar.com/2009/04/22/opensolaris-configuring-squid-as-transparent-proxy/</link>
		<comments>http://sigtar.com/2009/04/22/opensolaris-configuring-squid-as-transparent-proxy/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 19:04:13 +0000</pubDate>
		<dc:creator>Daz</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[OpenSolaris]]></category>
		<category><![CDATA[ipf]]></category>
		<category><![CDATA[ipfilter]]></category>
		<category><![CDATA[ipnat]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[transparent proxy]]></category>

		<guid isPermaLink="false">http://sigtar.com/?p=541</guid>
		<description><![CDATA[I used to have a virtual machine that acted as a transparent proxy, but as of late thought i&#8217;d move squid onto my host box (opensolaris). This way hopefully increasing the amount of free ram available to the host while also taking advantage of ZFS etc&#8230;
So this is a very brief guide on how to [...]


Related posts:<ol><li><a href='http://sigtar.com/2009/09/06/opensolaris-samba-and-network-browsing/' rel='bookmark' title='Permanent Link: Opensolaris &#8211; Samba and Network browsing'>Opensolaris &#8211; Samba and Network browsing</a> <small>If you&#8217;ve setup samba (rather than the builtin cifs/smb) chances...</small></li>
</ol>

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I used to have a virtual machine that acted as a transparent proxy, but as of late thought i&#8217;d move squid onto my host box (opensolaris). This way hopefully increasing the amount of free ram available to the host while also taking advantage of ZFS etc&#8230;</p>
<p>So this is a very brief guide on how to configure your opensolaris 2008.11 box as a transparent proxy. Essentially meaning if you set the solaris box as the default gateway all web traffic will be cached as it goes through it before it goes onto your dls router or outside connection.</p>
<p>At this point i&#8217;m assuming that your opensolaris box can access the web without issue. The config i have loaded on my box points DNS and the default route straight to my dsl router. If you have having problems getting to the web it may be the DNS problem discussed here : <a href="http://sigtar.com/2009/02/11/opensolaris-manual-network-config-issue/">http://sigtar.com/2009/02/11/opensolaris-manual-network-config-issue/</a></p>
<p>First step is to enable IP forwarding;</p>
<p><strong>svcadm enable ipv4-forwarding</strong></p>
<p>Then install the squid package though package manager &#8211; search for &#8220;squid&#8221; and install</p>
<p>Configure squid via <strong>/etc/squid/squid.conf </strong>file. Find the <strong>http_port </strong>setting and add &#8220;transparent&#8221; to the required line like so&#8230;</p>
<p><em>http_port 3128 transparent</em></p>
<p>Find the network acl and add your subnet to the required line. My subnet is 192.168.4.0/24 so it should look like this. (note: you can have multiple subnets so i have two in the following example). You may need to uncomment the line&#8230;</p>
<p><em>acl our_networks src 192.168.4.0/24 192.168.2.0/24</em></p>
<p><em>http_access allow our_networks</em></p>
<p><em><span style="font-style: normal;">Update : i had some problems with web traffic slowing down and stalling eventually over time so i have made an additional update to the <strong>/etc/squid/squid.conf</strong> file&#8230;</span><br />
</em></p>
<p><em>httpd_accel_no_pmtu_disc on</em></p>
<p>Run <strong><span>/usr/squid/sbin/squid</span> -z</strong> to create the swap directories.</p>
<p>The default disk cache size in squid as of writing is 100MB, i usually increase mine to 30GB since disk is cheap). I also move my disk cache to a faster disk array and also increase the maximum cached object size to 1000 MB &#8211; but probably isn&#8217;t required for the small load that i would generate. Here are some of the additional changes i make (optional);</p>
<p><em>refresh_pattern . 0 80% 10080 reload-into-ims</em><br />
<em>maximum_object_size 1000 MB</em></p>
<p>I have made another post that details increasing your hit ratio here : <a href="http://sigtar.com/2009/06/10/squid-optimizing-cache-hits/" target="_blank">http://sigtar.com/2009/06/10/squid-optimizing-cache-hits/</a></p>
<p>Run <strong>/usr/squid/sbin/squid</strong></p>
<p>Check for any issues in the cache log located at <strong>/var/squid/logs/cache.log</strong></p>
<p>You should test your proxy at the default port of 3128 first. i.e. setup the proxy details in Internet Explorer / FireFox to point to your solaris box <em>ipaddress</em>:3128</p>
<p>Next you need to redirect traffic hitting the solaris box on port 80 to 3128 (the transparent port forwarding) like so&#8230;</p>
<p>First enable the ipfilter service&#8230;    (no iptables in solaris)</p>
<p><strong>svcadm enable ipfilter</strong></p>
<p>create a file called <strong>/etc/ipf/ipnat.conf</strong>, and place this rule in it;  (this file should be auto loaded at startup)</p>
<p><strong>rdr e1000g1 0.0.0.0/0 port 80 -&gt; 127.0.0.1 port 3128</strong></p>
<p>This redirects my nic (e1000g1) any network port 80 to the local loopback port 3128. To load this rule type;  (clears current rules and loads file)</p>
<p><strong>ipnat -Cf /etc/ipf/ipnat.conf</strong></p>
<p>to check if its working and loaded type <strong>ipnat -l </strong></p>
<p>Browse some websites from your web client, and check the squid logs that all http requests are hitting the cache. default log location is <strong>/var/squid/logs/access.log</strong></p>
<p>Set your DHCP to point to your solaris box as the default gateway. Done. In most cases your dsl router if it has DHCP will not allow you to change your default gateway. If this is the case you will need to setup your own DHCP server and define the opensolaris box as the default gateway. The DHCP scope can point the clients to the dsl router for DNS, only the default gateway needs to be changed.</p>
<p>Set squid to autostart at boot via SMF manifest;</p>
<p><strong>svcadm enable svc:/network/http:squid</strong></p>
<p>Done</p>


<p>Related posts:<ol><li><a href='http://sigtar.com/2009/09/06/opensolaris-samba-and-network-browsing/' rel='bookmark' title='Permanent Link: Opensolaris &#8211; Samba and Network browsing'>Opensolaris &#8211; Samba and Network browsing</a> <small>If you&#8217;ve setup samba (rather than the builtin cifs/smb) chances...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://sigtar.com/2009/04/22/opensolaris-configuring-squid-as-transparent-proxy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>squid &#8211; your transparent proxy friend</title>
		<link>http://sigtar.com/2009/04/10/squid-your-transparent-proxy-friend/</link>
		<comments>http://sigtar.com/2009/04/10/squid-your-transparent-proxy-friend/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 19:46:20 +0000</pubDate>
		<dc:creator>Daz</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[3128]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[transparent]]></category>
		<category><![CDATA[transparent proxy]]></category>

		<guid isPermaLink="false">http://sigtar.com/?p=524</guid>
		<description><![CDATA[Still my favourite light and fast web proxy is Squid. Its very easy to setup and get running on almost all flavours of linux. You can find it here http://www.squid-cache.org/ but will probably find it in your local package manager&#8230;
This is for more my own reference&#8230; as i don&#8217;t think too many people have the need [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Still my favourite light and fast web proxy is Squid. Its very easy to setup and get running on almost all flavours of linux. You can find it here http://www.squid-cache.org/ but will probably find it in your local package manager&#8230;</p>
<p><strong><span style="font-weight: normal;">This is for more my own reference&#8230; as i don&#8217;t think too many people have the need for a transparent proxy. You only need one NIC configured on your VM / machine as its most probably on the same subnet as your dsl etc&#8230; </span></strong></p>
<p><strong><span style="font-weight: normal;">1. Setup squid working as a proxy first!</span></strong></p>
<p><strong><span style="font-weight: normal;">Set the default gateway on the NIC to your router. I also added a default route 0.0.0.0 sub 0.0.0.0 to the router also just in case the default route didn&#8217;t work. But seemed to! </span></strong></p>
<p><strong><span style="font-weight: normal;">Setup DNS! remember you should be able to resolve a name to an IP without issues (can cause most of the problems) Point your default DNS to your router (most have built in DNS forwarders), else you can just use your ISP&#8217;s DNS&#8217;s </span></strong></p>
<p><strong><span style="font-weight: normal;">2. Change the squid.config to have the necessary changes to act as a </span><span class="posthilit"><span style="font-weight: normal;"><span style="font-weight: normal;">transparent</span></span></span><span style="font-weight: normal;"><span style="font-weight: normal;"> proxy;</span></span></strong></p>
<p><span style="font-weight: normal;"><span style="font-weight: normal;"><strong>nano /etc/squid/squid.conf</strong></span></span></p>
<div><em>http_port 3128 transparent</em></div>
<div><em><br />
</em></div>
<div><strong> </strong></div>
<div><strong><span style="font-weight: normal;">3. Put this into the startup script; (usually in rc.d under etc) rc.local</span></strong></div>
<div><strong><span style="font-weight: normal;"><br />
</span></strong></div>
<div><strong>iptables -t nat -A PREROUTING -i eth0 -p tcp &#8211;dport 80 -j REDIRECT &#8211;to-port 3128</strong></div>
<p><strong><span style="font-weight: normal;">This redirects standard tcp requests to 3128 (squid&#8217;s port)&#8230; </span><span class="posthilit"><span style="font-weight: normal;"><span style="font-weight: normal;">transparent</span></span></span><span style="font-weight: normal;"><span style="font-weight: normal;"> to user</span></span></strong></p>
<p><strong><span style="font-weight: normal;">4. Ensure that IP forwarding is ENABLED;</span></strong></p>
<p><strong><span style="font-weight: normal;">change ip_forward from 0 to 1 (usually a txt file somewhere with 0 in it), do a search and you will find it&#8230; most probably in the ipv4 directory. This way all 443 (https and other apps) can forward to the web without issue&#8230; </span></strong></p>
<p><strong>echo 1 &gt; /proc/sys/net/ipv4/ip_forward</strong></p>
<p><strong> </strong></p>
<p><strong><span style="font-weight: normal;"> Should be it&#8230;. else good luck! </span></strong></p>
<p><strong><span style="font-weight: normal;">Update</span><span style="font-weight: normal;">: I have done an updated post about configuring open solaris as a transparent proxy here : <a href="http://sigtar.com/2009/04/22/opensolaris-configuring-squid-as-transparent-proxy/">http://sigtar.com/2009/04/22/opensolaris-configuring-squid-as-transparent-proxy/</a></span></strong></p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://sigtar.com/2009/04/10/squid-your-transparent-proxy-friend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
