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.