<?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>Keyur &#187; Keyur</title>
	<atom:link href="http://keyur.co.in/blog/author/keyuradmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://keyur.co.in</link>
	<description>Just another blog...</description>
	<lastBuildDate>Sun, 28 Apr 2013 07:21:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.41</generator>
	<item>
		<title>Varnish X-Forwarded-for Public IP not visible</title>
		<link>http://keyur.co.in/blog/varnish-x-forwarded-for-public-ip-not-visible/</link>
		<comments>http://keyur.co.in/blog/varnish-x-forwarded-for-public-ip-not-visible/#comments</comments>
		<pubDate>Fri, 26 Apr 2013 03:04:22 +0000</pubDate>
		<dc:creator><![CDATA[Keyur]]></dc:creator>
				<category><![CDATA[Varnish]]></category>

		<guid isPermaLink="false">http://keyur.co.in/?p=70</guid>
		<description><![CDATA[This post describes under which scenario you may not see X- Forwarded-for public IP in your Varnish / Apache logs and How to resolve the same. If you have a website doing Country detection based on IP address then it may &#8230; <a href="http://keyur.co.in/blog/varnish-x-forwarded-for-public-ip-not-visible/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>This post describes under which scenario you may not see X- Forwarded-for public IP in your Varnish / Apache logs and How to resolve the same.</p>
<p>If you have a website doing Country detection based on IP address then it may stop working if correct IP address is not available.</p>
<p>By default Varnish will remove several headers, this does not affect unless you have specific scenario.</p>
<p>I came across an issue where varnish was not sending Intermediary proxy IP or Public IP in a particular case.</p>
<p><span style="text-decoration: underline;"><strong>Scenario :</strong></span></p>
<ul>
<li>Some Hotel / Company has squid proxy configured and all traffic for Internet is routed via Squid.</li>
<li>User accessing my  website first hits the Load Balancer then Varnish &amp; then Apache</li>
<li>Apache is configured with mod_geoip. The code on my site does the Country redirection based on the IP address</li>
</ul>
<p><span style="text-decoration: underline;"><strong>Problem :</strong></span></p>
<ul>
<li>User (Behind that squid proxy) accessing my website follows this path :</li>
</ul>
<blockquote><p>Load Balancer -&gt; VARNISH -&gt; Apache</p></blockquote>
<p>Here apache gets only Internal IP (LAN IP of user) &amp; Load Balancer Internal IP as X-forwarded-for and Hence the IP based redirection FAILS!</p>
<p><span style="text-decoration: underline;"><strong>Solution :</strong></span></p>
<p>Credit goes to Mithrandir @ Varnish IRC Channel, Thanks!</p>
<p>Below mentioned changes were required to resolve the issue.</p>
<ul>
<li>At the start of the default.vcl add :</li>
</ul>
<blockquote>
<p style="text-align: left;"><strong>import std;</strong></p>
<p style="text-align: left;">
</blockquote>
<ul>
<li>Below     &#8220;<em>if (req.http.x-forwarded-for)</em>&#8221; add :</li>
</ul>
<blockquote><p><strong>std.collect(req.http.x-forwarded-for);</strong></p></blockquote>
<ul>
<li>Do varnish configtest &amp; reload. This should start showing the Public IP.</li>
</ul>
<div></div>
<ul>
<li>Below is the explanation from the documentation of <strong>vmod_std</strong> :</li>
</ul>
<blockquote><p>collect</p>
<p>Prototype<br />
collect(HEADER header)</p>
<p>Return value<br />
Void</p>
<p>Description<br />
Collapses the header, joining the headers into one.</p>
<p>Example<br />
std.collect(req.http.cookie); This will collapse several Cookie:<br />
headers into one, long cookie header.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://keyur.co.in/blog/varnish-x-forwarded-for-public-ip-not-visible/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Limit bandwidth usage with lftp</title>
		<link>http://keyur.co.in/blog/limit-bandwidth-usage-with-lftp/</link>
		<comments>http://keyur.co.in/blog/limit-bandwidth-usage-with-lftp/#comments</comments>
		<pubDate>Mon, 04 Jun 2012 06:35:36 +0000</pubDate>
		<dc:creator><![CDATA[Keyur]]></dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[bandwidth]]></category>
		<category><![CDATA[lftp]]></category>
		<category><![CDATA[network]]></category>

		<guid isPermaLink="false">http://keyur.co.in/?p=1</guid>
		<description><![CDATA[This post describes how you can limit the bandwidth usage during data transfer using lftp (File transfer program) For those who don&#8217;t know what lftp is, You can check it out over here : http://lftp.yar.ru/lftp-man.html For any data transfer between local &#8230; <a href="http://keyur.co.in/blog/limit-bandwidth-usage-with-lftp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>This post describes how you can limit the bandwidth usage during data transfer using lftp (File transfer program)</p>
<p>For those who don&#8217;t know what lftp is, You can check it out over here : <a href="http://lftp.yar.ru/lftp-man.html">http://lftp.yar.ru/lftp-man.html</a></p>
<p>For any data transfer between local servers (physically located at same location), one should make a practice to check with Network team whether both the server are connected to same switch or they are connected to two different switches. If they are connected between two different switches then make sure to rate limit the data transfer throughput during ftp. This is to ensure that bandwidth is not choked during data transfer and other Server/Applications do not suffer due to data transfer</p>
<p>Mostly every office has 1Gig network, If data transfer is done between servers connected to two different switches with uplink of 1G without bandwidth throttling then you may endup using entire bandwidth available resulting network issues and packet loss for other servers and applications.</p>
<p>To avoid this issue you should throttle bandwidth usage during data transfer. For Eg. You can throttle bandwidth usage to 40 Megabytes/Sec. To apply this limit using lftp follow below mentioned steps.</p>
<p>#<strong> vim /etc/lftp.conf</strong></p>
<p>Append a line as below :</p>
<p><strong>set <a>net:limit-total-rate</a> 41943040:0</strong></p>
<ul>
<li> This will limit the data transfer to 40 Megabytes/Sec. Of-course this has to be done before the transfer starts.</li>
<li>As you notice <strong>41943040:0</strong> . The value before &#8220;<strong>:</strong>&#8221; is for download. i.e., GET (Mirror in lftp) for pulling data from other server. If you have to push the data i.e., PUT (Mirror -R in lftp) then change it to <strong>0:</strong><strong>41943040</strong></li>
<li> If transfer is happening between two servers connected to same switch then no need to rate limit the transfer.</li>
</ul>
<p>Caution : Simultaneous ftp transfer on same servers should not be done. If you wanna do it anyways then adjust the above mentioned limits accordingly to distribute the load between two connections.</p>
]]></content:encoded>
			<wfw:commentRss>http://keyur.co.in/blog/limit-bandwidth-usage-with-lftp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
