<?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>Lindesk &#187; Tutorials</title>
	<atom:link href="http://lindesk.com/category/networking/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://lindesk.com</link>
	<description>Linux - on the Desktop</description>
	<lastBuildDate>Tue, 19 Jan 2010 05:54:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Internet Connection Sharing using iptables</title>
		<link>http://lindesk.com/2007/04/internet-connection-sharing-using-iptables/</link>
		<comments>http://lindesk.com/2007/04/internet-connection-sharing-using-iptables/#comments</comments>
		<pubDate>Mon, 16 Apr 2007 11:08:27 +0000</pubDate>
		<dc:creator>BinnyVA</dc:creator>
				<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://lindesk.com/2007/04/internet-connection-sharing-using-iptables/</guid>
		<description><![CDATA[It is very easy to setup an internet connection sharing in Linux system using iptables. This method can be used to share an internet connection from a Linux system(I used Fedora Core 6, but it should work on other distributions that support iptables). Another method of doing this is using a proxy server like squid. [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://lindesk.com/wp-content/uploads/2007/04/network.png' alt='Networking' class="intro" align="right" /></p>
<p class="intro">It is very easy to setup an internet connection sharing in Linux system using iptables. This method can be used to share an internet connection from a Linux system(I used Fedora Core 6, but it should work on other distributions that support iptables). Another method of doing this is using a proxy server like squid.</p>
<h2>Enable IP forwarding</h2>
<p>Run as root</p>
<p><code>sysctl -w net.ipv4.ip_forward=1</code></p>
<p>To enable it in system startup, edit the file <code>/etc/sysctl.conf</code> and set</p>
<p><code>net.ipv4.ip_forward = 1</code></p>
<h2>iptables</h2>
<p>Run command as root</p>
<pre><code>iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
service iptables save</code></pre>
<h2>Configuration</h2>
<p>The configuration should be like this</p>
<h3>Router</h3>
<p>Connected to the internet provider<br />
IP : 192.168.1.1</p>
<h3>Internet Connected System</h3>
<h4>eth0 (LAN Card 1)</h4>
<p>Connected to router</p>
<ul>
<li>IP : 192.168.1.10</li>
<li>Netmask : 255.255.255.0</li>
<li>Gateway : 192.168.1.1 (IP of the router)</li>
</ul>
<h4>eth1 (LAN Card 2)</h4>
<p>Connected to the other system</p>
<ul>
<li>IP : 192.168.0.20 (Not the same network as the first card)</li>
<li>Netmask : 255.255.255.0</li>
<li>Gateway : 192.168.1.1 (IP of the router)</li>
</ul>
<h3>Second System</h3>
<h4>LAN Card connected to the first system</h4>
<ul>
<li>IP : 192.168.0.30</li>
<li>Netmask : 255.255.255.0</li>
<li>Gateway : 192.168.0.20 (IP of the second Card in the first system)</li>
</ul>
<h2>Disclaimer</h2>
<p>Linux networks is not a subject I am an expert on. So take my advice with a pinch of salt. The above procedure worked for me. <abbr title="Your Mileage May Vary">YMMV</abbr>.</p>
<h2>Status</h2>
<p>Some results of various commands are shown here. Check to see if it matches the result on your system.</p>
<pre><code class="cli"># <strong>iptables -t nat -L POSTROUTING</strong>
Chain POSTROUTING (policy ACCEPT)
target     prot opt source               destination
MASQUERADE  all  --  anywhere             anywhere
</code></pre>
<pre><code class="cli"># <strong>cat /proc/sys/net/ipv4/ip_forward</strong>
1</code></pre>
<pre><code class="cli"># <strong>iptables -L</strong>
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://lindesk.com/2007/04/internet-connection-sharing-using-iptables/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
	</channel>
</rss>

