<?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>Debian Tutorials &#187; iptables</title>
	<atom:link href="http://www.debiantutorials.com/tag/iptables/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.debiantutorials.com</link>
	<description>Copy/Paste tutorials for Debian Linux</description>
	<lastBuildDate>Wed, 08 Sep 2010 08:36:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Prevent brute force attacks using fail2ban</title>
		<link>http://www.debiantutorials.com/prevent-brute-force-attacks-using-fail2ban/</link>
		<comments>http://www.debiantutorials.com/prevent-brute-force-attacks-using-fail2ban/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 22:38:04 +0000</pubDate>
		<dc:creator>aip</dc:creator>
				<category><![CDATA[Lenny]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[fail2ban]]></category>
		<category><![CDATA[iptables]]></category>

		<guid isPermaLink="false">http://www.debiantutorials.net/?p=329</guid>
		<description><![CDATA[fail2ban monitors log files such as /var/log/auth.log and /var/log/apache/access.log and temporarily or persistently bans failure-prone addresses by updating existing firewall rules. Currently, by default, fail2ban supports ssh/apache/vsftpd but configuration can be easily extended for monitoring any other ASCII file.
1. Install fail2ban
apt-get install fail2ban

2. Test by connecting via ssh and making three incorrect password attempts. By [...]]]></description>
			<content:encoded><![CDATA[<p>fail2ban monitors log files such as /var/log/auth.log and /var/log/apache/access.log and temporarily or persistently bans failure-prone addresses by updating existing firewall rules. Currently, by default, fail2ban supports ssh/apache/vsftpd but configuration can be easily extended for monitoring any other ASCII file.</p>
<p>1. Install fail2ban</p>
<p><code>apt-get install fail2ban<br />
</code><span id="more-329"></span></p>
<p>2. Test by connecting via ssh and making three incorrect password attempts. By default fail2ban blocks the IP address for 10 minutes.</p>
<p>You can tail the fail2ban log file to monitor actions:</p>
<p><code>tail -f /var/log/fail2ban.log<br />
</code></p>
<p>Sample results</p>
<p><code>2010-06-21 22:27:58,953 fail2ban.jail   : INFO   Jail 'ssh' started<br />
2010-06-21 22:29:36,430 fail2ban.actions: WARNING [ssh] Ban 192.168.1.18<br />
</code></p>
<p>3. (optional) Specify a list of IP addresses ignored by fail2ban. This can be useful to avoid getting locked out (pico /etc/fail2ban/jail.conf)</p>
<p><code>ignoreip = 127.0.0.1 192.168.1.0/24<br />
</code></p>
<p><em>Modify the ignoreip property and type a list of IP addresses or networks seperated by a space.</em></p>
<p>4. Restart fail2ban (only required if you modified the ignoreip property)</p>
<p><code>/etc/init.d/fail2ban restart<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.debiantutorials.com/prevent-brute-force-attacks-using-fail2ban/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installing and configuring PPTP VPN server on lenny</title>
		<link>http://www.debiantutorials.com/installing-and-configuring-pptp-vpn-server-on-lenny/</link>
		<comments>http://www.debiantutorials.com/installing-and-configuring-pptp-vpn-server-on-lenny/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 22:21:36 +0000</pubDate>
		<dc:creator>aip</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Lenny]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[pptp]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://www.debiantutorials.net/installing-and-configuring-pptp-vpn-server-on-lenny/</guid>
		<description><![CDATA[If you would like to setup a Virtual Private Network (VPN) for Windows clients, PPTP is a great choice. It's easy to set up on the server and you don't need any additional software for the Windows clients to connect.
1. Install the required packages
apt-get install pptpd

2. Configure the IP range assigned to clients (pico /etc/pptpd.conf)
localip [...]]]></description>
			<content:encoded><![CDATA[<p>If you would like to setup a Virtual Private Network (VPN) for Windows clients, PPTP is a great choice. It's easy to set up on the server and you don't need any additional software for the Windows clients to connect.</p>
<p>1. Install the required packages</p>
<p><code>apt-get install pptpd<br />
</code><span id="more-237"></span></p>
<p>2. Configure the IP range assigned to clients (pico /etc/pptpd.conf)</p>
<p><code>localip 192.168.1.2<br />
remoteip 192.168.1.10-20<br />
</code></p>
<p><em>Using this config the clients are assigned any IP address between and including 192.168.1.10 and 192.168.1.20.</em></p>
<p>3. Restart the PPTP daemon</p>
<p><code>/etc/init.d/pptpd restart<br />
</code></p>
<p>4. Create a user allowed to connect (pico /etc/ppp/chap-secrets)</p>
<p><code>user1 pptpd secretpassword *<br />
</code></p>
<p><em>Passwords are not encrypted. This allows the a user with the username: user1 and the password: secretpassword to login from any ip address.</em></p>
<p>5. Enable IP forward at startup to allow the VPN clients to connect to the server's local network. (pico /etc/sysctl.conf)</p>
<p><code>net.ipv4.ip_forward=1<br />
</codE></p>
<p>Also run this command to activate the IP forward instantly:</p>
<p><code>echo 1 > /proc/sys/net/ipv4/ip_forward<br />
</code></p>
<p>6. Create a routing rule to allow the VPN clients to route network traffic through the server.</p>
<p><code>iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE<br />
</code></p>
<p>Read this tutorial to learn how to create iptables rules on startup:<br />
<a href="http://www.debiantutorials.net/loading-iptables-rules-on-startup/">Loading iptables rules on startup</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.debiantutorials.com/installing-and-configuring-pptp-vpn-server-on-lenny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Port forwarding with iptables</title>
		<link>http://www.debiantutorials.com/port-forwarding-with-iptables/</link>
		<comments>http://www.debiantutorials.com/port-forwarding-with-iptables/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 23:46:03 +0000</pubDate>
		<dc:creator>aip</dc:creator>
				<category><![CDATA[Lenny]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[etch]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[routing]]></category>

		<guid isPermaLink="false">http://www.debiantutorials.net/?p=122</guid>
		<description><![CDATA[In this tutorial we'll set up a simple port forwarding (NAT) using iptables.
1. Enable ip forward
echo "1" > /proc/sys/net/ipv4/ip_forward

2. Append routing rules to the nat table
iptables -t nat -A PREROUTING -p tcp -s 0/0 -d {local_ip} --dport {local_port} -j DNAT --to {destination_ip}:{destination_port}
iptables -t nat -A POSTROUTING -o eth0 -d {destination_ip} -j SNAT --to-source {local_ip}


{local_ip}: A [...]]]></description>
			<content:encoded><![CDATA[<p>In this tutorial we'll set up a simple port forwarding (NAT) using iptables.</p>
<p>1. Enable ip forward</p>
<p><code>echo "1" > /proc/sys/net/ipv4/ip_forward<br />
</code><span id="more-122"></span></p>
<p>2. Append routing rules to the nat table</p>
<p><code>iptables -t nat -A PREROUTING -p tcp -s 0/0 -d {local_ip} --dport {local_port} -j DNAT --to {destination_ip}:{destination_port}<br />
iptables -t nat -A POSTROUTING -o eth0 -d {destination_ip} -j SNAT --to-source {local_ip}<br />
</code></p>
<ul>
<li>{local_ip}: A ip address mapped on the local system</li>
<li>{local_port}: The port you would like to listen on</li>
<li>{destination_ip}: Destination ip address</li>
<li>{destination_port}: Destination port</li>
</ul>
<p>3. Now you can access http://{local_ip}:{local_port} and would actually be getting response from http://{destination_ip}:{destination_port}</p>
<p><strong>A working example</strong></p>
<p>If the ip address of your system is 32.64.128.200 and you import the following rules, you would be able to connect to http://32.64.128.200:8080 and actually see the Google search engine because 216.239.59.105:80 is one of Google's web servers.</p>
<p><code>iptables -t nat -A PREROUTING -p tcp -s 0/0 -d 32.64.128.200 --dport 8080 -j DNAT --to 216.239.59.105:80<br />
iptables -t nat -A POSTROUTING -o eth0 -d 216.239.59.105 -j SNAT --to-source 32.64.128.200<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.debiantutorials.com/port-forwarding-with-iptables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Loading iptables rules on startup</title>
		<link>http://www.debiantutorials.com/loading-iptables-rules-on-startup/</link>
		<comments>http://www.debiantutorials.com/loading-iptables-rules-on-startup/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 21:48:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Lenny]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[etch]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[lenny]]></category>

		<guid isPermaLink="false">http://debiantutorials.net/loading-iptables-rules-on-startup/</guid>
		<description><![CDATA[By default iptables is setup on Debian etch but there are no rules configured. In this tutorial we'll configure some rules and load them into iptables on startup.
1. Rules file
Create a new file that will contain a shell script to insert rules into iptables (pico /etc/firewall-rules.sh) and add this content as template:
#!/bin/sh
IPT="/sbin/iptables"
echo -n "Loading iptables [...]]]></description>
			<content:encoded><![CDATA[<p>By default iptables is setup on Debian etch but there are no rules configured. In this tutorial we'll configure some rules and load them into iptables on startup.</p>
<p><strong>1. Rules file</strong></p>
<p>Create a new file that will contain a shell script to insert rules into iptables (pico /etc/firewall-rules.sh) and add this content as template:</p>
<p><span id="more-19"></span><code>#!/bin/sh<br />
IPT="/sbin/iptables"</p>
<p>echo -n "Loading iptables rules..."<br />
</code><br />
# Flush old rules<br />
$IPT --flush<br />
$IPT --delete-chain</p>
<p># By default, drop everything except outgoing traffic<br />
$IPT -P INPUT DROP<br />
$IPT -P FORWARD DROP<br />
$IPT -P OUTPUT ACCEPT</p>
<p># Allow incoming and outgoing for loopback interfaces<br />
$IPT -A INPUT -i lo -j ACCEPT<br />
$IPT -A OUTPUT -o lo -j ACCEPT</p>
<p># ICMP rules<br />
$IPT -A INPUT -p icmp --icmp-type echo-reply -m state --state ESTABLISHED,RELATED -j ACCEPT<br />
$IPT -A INPUT -p icmp --icmp-type echo-request -m limit --limit 5/s -m state --state NEW -j ACCEPT<br />
$IPT -A INPUT -p icmp --icmp-type destination-unreachable -m state --state NEW -j ACCEPT<br />
$IPT -A INPUT -p icmp --icmp-type time-exceeded -m state --state NEW -j ACCEPT<br />
$IPT -A INPUT -p icmp --icmp-type timestamp-request -m state --state NEW -j ACCEPT<br />
$IPT -A INPUT -p icmp --icmp-type timestamp-reply -m state --state ESTABLISHED,RELATED -j ACCEPT</p>
<p># Block new connections without SYN<br />
$IPT -A INPUT -p tcp ! --syn -m state --state NEW -j DROP</p>
<p># Allow established connections:<br />
$IPT -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT</p>
<p># SSH<br />
$IPT -A INPUT -p tcp --dport 22 -m state --state NEW -j ACCEPT</p>
<p># HTTP<br />
$IPT -A INPUT -p tcp --dport 80 -m state --state NEW -j ACCEPT<br />
$IPT -A INPUT -p tcp --dport 443 -m state --state NEW -j ACCEPT</p>
<p># Block fragments and Xmas tree as well as SYN,FIN and SYN,RST<br />
$IPT -A INPUT -p ip -f -j DROP<br />
$IPT -A INPUT -p tcp --tcp-flags ALL ACK,RST,SYN,FIN -j DROP<br />
$IPT -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP<br />
$IPT -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP</p>
<p># Anti-spoofing rules<br />
$IPT -A INPUT -s 200.200.200.200 -j DROP<br />
$IPT -A INPUT -s 192.168.0.0/24 -j DROP<br />
$IPT -A INPUT -s 127.0.0.0/8 -j DROP</p>
<p>echo "rules loaded."<br />
You can customize this file as required, check the iptables manual for parameters and options.</p>
<p>Change the permissions to make the file executable by root:</p>
<p><code>chown root /etc/firewall-rules.sh<br />
chmod 700 /etc/firewall-rules.sh<br />
</code></p>
<p><strong>2. Load rules shell script on startup</strong></p>
<p>Add this line above the address line for your default network interface (pico /etc/network/interfaces):</p>
<p><code>pre-up /etc/firewall-rules.sh<br />
</code></p>
<p>Now, every time you start the network interfaces including restarting the system, iptables rules are reloaded.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.debiantutorials.com/loading-iptables-rules-on-startup/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
