Networking Forums

Networking Forums > Computer Networking > Linux Networking > Creating a filter with iptables

Reply
Thread Tools Display Modes

Creating a filter with iptables

 
 
Mark Hobley
Guest
Posts: n/a

 
      06-30-2008, 12:06 AM
I want to prohibit various internet hosts from accessing a range of
ports on one of my computers. I believe that iptables is the tool that I
need for this, but I am not familiar with software firewalling in the
Linux environment. I am wading through documentation, but it is heavy
going and I am struggling to decypher the manuals. I really need an
example script that matches my requirements.

I want to block access to a range of ports 7000 to 7999 and
individual port 8026 on my server from hosts on networks 213.55.64.0/19
and 81.169.160.0/19.

I do not want anything else altered at this time, and I want all
remaining traffic to that machine to be permitted.

I have installed the iptables package, but I have not yet created a
script to activate it.

The server is an IBM compatible (Pentium 120) computer running Debian
Etch.

Thanks in advance to anyone who can help.

Regards,

Mark.

--
Mark Hobley,
393 Quinton Road West,
Quinton, BIRMINGHAM.
B32 1QE.
 
Reply With Quote
 
 
 
 
pk
Guest
Posts: n/a

 
      06-30-2008, 11:52 AM
On Monday 30 June 2008 02:06, Mark Hobley wrote:

> I want to prohibit various internet hosts from accessing a range of
> ports on one of my computers. I believe that iptables is the tool that I
> need for this, but I am not familiar with software firewalling in the
> Linux environment. I am wading through documentation, but it is heavy
> going and I am struggling to decypher the manuals. I really need an
> example script that matches my requirements.


I *strongly* suggest you thoroughly read the documentation, rather than
trust someone else's scripts without understanding what those do. This
should be a good starting point:

http://iptables-tutorial.frozentux.n...-tutorial.html

> I want to block access to a range of ports 7000 to 7999 and
> individual port 8026 on my server from hosts on networks 213.55.64.0/19
> and 81.169.160.0/19.


You don't say if you want to block TCP or UDP ports.

iptables -A INPUT -s 213.55.64.0/19 -p tcp --dport 7000:7999 -j DROP
iptables -A INPUT -s 213.55.64.0/19 -p tcp --dport 8026 -j DROP
iptables -A INPUT -s 81.169.160.0/19 -p tcp --dport 7000:7999 -j DROP
iptables -A INPUT -s 81.169.160.0/19 -p tcp --dport 8026 -j DROP

Replace -p tcp with -p udp if you want to block UDP ports.

 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Call filter" and "Data filter", firewall clarification wanted please tinnews@isbd.co.uk Home Networking 2 04-15-2008 09:16 AM
What is Anti-Spam Filter.(thunderbird spam filter) zak07000 Broadband 0 03-27-2008 03:41 PM
Yet another question on iptables, firewall and, or net-filter Balwinder S \bsd\ Dheeman Linux Networking 6 11-18-2006 11:42 AM
"iptables mark with filter fw" vs "u32 match" =?ISO-8859-2?Q?Pawe=B3?= Staszewski Linux Networking 3 03-05-2005 09:23 PM
iptables "can't initialize iptables table `filter'" pete Linux Networking 1 10-10-2003 03:44 AM



1 2 3 4 5 6 7 8 9 10 11