Click Technology

Linux, Windows, Mac it's all good

iptables and Deluge..

September5

Deluge is a torrent client for Linux. It’s cool because, as well as being well laid out, it also does magnet links for downloads. From a command window, install it with this command..

sudo apt-get install deluge

Next, we need to adjust the ports used by Deluge. Go CTRL + p to open the ‘P’roperties page. Click Network.

Uncheck the “Use random ports” boxes in bot Incoming and Outgoing channels sections.

Enter a value range in the ports boxes. The port values here can be anything you like in the 50,000 to 64,000 value range. Let’s say we chose 55055 to 55065. Enter these two values in the From and To boxes for both incoming and outgoing port numbers.

Once that’s done, you need to configure your firewall. If you’re using iptables, you’ll need to open some ports to get it working. Here’s the comand list to get you working…

sudo iptables -A INPUT -p tcp -m tcp --dport 55055:55065 -m state --state NEW -j ACCEPT
sudo iptables -A INPUT -p udp -m udp --dport 55055:55065 -m state --state NEW -j ACCEPT
sudo iptables -A OUTPUT -p tcp -m tcp --sport 55055:55065 -m state --state NEW -j ACCEPT
sudo iptables -A OUTPUT -p udp -m udp --sport 55055:55065 -m state --state NEW -j ACCEPT

The commands above allow tcp and udp in and out to the port range chosen, as required. Once that’s done, Deluge should work perfectly.

Nice.

posted under Linux Tips | No Comments »

Flushing IPTABLES

April4

IPTABLES is the Linux firewall and it is, in short, great. The one only niggle is that sometimes you want to be able to just clear all the rules and have a nice clean firewall to fiddle with.

I found this script on the interweb and it works like a dream. To use it just do this..

1. Open a terminal window by opening the run command line with Alt + F2. Of course, if you’re using a GUI-less terminal, this doesn’t apply, just skip to step 2.

Once open, type

gnome-terminal

and click OK. There’s your terminal window.

2. Now, let’s install vim, one of the common editors in Linux. Issue the command

sudo apt-get install vim

Enter your normal login password and away you go, installing VIM in a second, job done.

3. Now let’s create the file with these commands..

cd
sudo vim fwflush

to create and edit the file. Once in VIM, just cut and paste the script below into the terminal window / command line.

#!/bin/sh
#
# rc.flush-iptables - Resets iptables to default values.
#
# Copyright (C) 2001  Oskar Andreasson <bluefluxATkoffeinDOTnet>
#
#
# Configurations
#
IPTABLES="/sbin/iptables"

#
# reset the default policies in the filter table.
#
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -P OUTPUT ACCEPT

#
# reset the default policies in the nat table.
#
$IPTABLES -t nat -P PREROUTING ACCEPT
$IPTABLES -t nat -P POSTROUTING ACCEPT
$IPTABLES -t nat -P OUTPUT ACCEPT

#
# reset the default policies in the mangle table.
#
$IPTABLES -t mangle -P PREROUTING ACCEPT
$IPTABLES -t mangle -P POSTROUTING ACCEPT
$IPTABLES -t mangle -P INPUT ACCEPT
$IPTABLES -t mangle -P OUTPUT ACCEPT
$IPTABLES -t mangle -P FORWARD ACCEPT

#
# flush all the rules in the filter and nat tables.
#
$IPTABLES -F
$IPTABLES -t nat -F
$IPTABLES -t mangle -F
#
# erase all chains that's not default in filter and nat table.
#
$IPTABLES -X
$IPTABLES -t nat -X
$IPTABLES -t mangle -X

Job done, now save it using the following key sequence in order

:wq

OK, that’s the file created and ready for use – we just need to make it excecutable. Do that by issuing the chmod command thus…

chmod u+x fwflush

4. Now run the script thus..

./fwflush

Now, if you issue the iptables command to show all the chains/rules, there are none but the defaults. Sweeeet!

sudo iptables -L
posted under Linux Tips | No Comments »

This is my website for short blog posts and interesting materials that are noteworthy or have some handy-tip value.