<?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; router</title>
	<atom:link href="https://lakm.us/logit/tag/router/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>Basic squid In A Gateway</title>
		<link>https://lakm.us/logit/2009/08/basic-squid-in-a-gateway/</link>
		<comments>https://lakm.us/logit/2009/08/basic-squid-in-a-gateway/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 08:26:59 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[General Linux]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[router]]></category>
		<category><![CDATA[squid]]></category>

		<guid isPermaLink="false">http://localhost/it/?p=73</guid>
		<description><![CDATA[This trial is done in a RedHat (RHEL 5.2) inside VirtualBox. The required squid package is using squid-3.0.STABLE13-1.el5.i386.rpm. Two interfaces is configured in this box as shown in the following NAT masquerading which build a simple router at 192.168.40.40 (eth1) : 1 2 3 4 5 6 7 8 WAN=wan0 LAN=eth1 IPTABLES=/sbin/iptables &#160; $IPTABLES --flush                         [...]]]></description>
				<content:encoded><![CDATA[<p>This trial is done in a RedHat (RHEL 5.2) inside VirtualBox. The required squid package is using <code>squid-3.0.STABLE13-1.el5.i386.rpm</code>. Two interfaces is configured in this box as shown in the following NAT masquerading which build a simple router at <code>192.168.40.40</code> (<code>eth1</code>) :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">WAN</span>=wan0
<span style="color: #007800;">LAN</span>=eth1
<span style="color: #007800;">IPTABLES</span>=<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>iptables
&nbsp;
<span style="color: #007800;">$IPTABLES</span> --flush                         <span style="color: #666666; font-style: italic;"># Flush all the rules in filter and nat tables</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">--table</span> nat <span style="color: #660033;">--flush</span>
<span style="color: #007800;">$IPTABLES</span> --delete-chain                  <span style="color: #666666; font-style: italic;"># Delete all chains that are not in default filter and nat table</span>
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">--table</span> nat <span style="color: #660033;">--delete-chain</span></pre></td></tr></table></div>

<p><strong>the real script is just two command line below</strong>:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">--table</span> nat <span style="color: #660033;">--append</span> POSTROUTING <span style="color: #660033;">--out-interface</span> <span style="color: #007800;">$WAN</span> <span style="color: #660033;">-j</span> MASQUERADE
<span style="color: #007800;">$IPTABLES</span> <span style="color: #660033;">--append</span> FORWARD <span style="color: #660033;">--in-interface</span> <span style="color: #007800;">$LAN</span> <span style="color: #660033;">-j</span> ACCEPT</pre></td></tr></table></div>

<p>Default route gateway is <code>wan0</code> and <code>/etc/resolv.conf</code> is edited with relevant DNS. Internet works perfectly and then after squid is installed, I use the following <code>/etc/squid.conf</code> :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">visible_hostname mithrandir
http_port <span style="color: #000000;">3128</span>
cache_dir ufs <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>spool<span style="color: #000000; font-weight: bold;">/</span>squid <span style="color: #000000;">1000</span> <span style="color: #000000;">16</span> <span style="color: #000000;">256</span>
cache_access_log <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>squid<span style="color: #000000; font-weight: bold;">/</span>access.log
acl intranet src 192.168.40.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span>
http_access allow intranet</pre></td></tr></table></div>

<p>It is pretty straightforward and simple, a listening proxy <code>192.168.40.40</code> in port <code>3128</code>. It is also a router to the internet, NAT, via <code>wan0</code>.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2009/08/basic-squid-in-a-gateway/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
