Computing.Net > Forums > Linux > This ip table

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

This ip table

Reply to Message Icon

Name: matt2kjones
Date: August 4, 2002 at 15:23:04 Pacific
Comment:

ok i have been studying iptables, and i want to know if this iptable would close all ports apart from 80 and 21

thanx

iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP

iptables -A INPUT -i eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 80 -m state --state NEW,ESTABLISHED -j ACCEPT

iptables -A INPUT -i eth0 -p tcp --sport 21 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 21 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 21 -m state --state NEW,ESTABLISHED -j ACCEPT



Sponsored Link
Ads by Google

Response Number 1
Name: junky_toof
Date: August 4, 2002 at 15:53:26 Pacific
Reply:

You want a stateful filter for http(80)
and ftp(21==control)?

Why not something like:
iptables -A INPUT -d $myhost -p tcp --syn
--dport 80 state --state NEW -j ACCEPT
iptables -A INPUT -d $myhost -p tcp --syn
--dport 20:21 state --state NEW -j ACCEPT
iptables -A INPUT -s 0/0 -d $myhost state \
--state ESTABLISHED -j ACCEPT
iptables -A INPUT -s 0/0 -d $myhost state \
--state RELATED -j ACCEPT

Read again.


0
Reply to Message Icon

Related Posts

See More


RHL 7.3 / XP dual boot pr... Map drive in Win98 to Lin...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: This ip table

wher is ip tables www.computing.net/answers/linux/wher-is-ip-tables/24554.html

Priorizing Hosts using IP Masq www.computing.net/answers/linux/priorizing-hosts-using-ip-masq/17794.html

REDHAT 7.2, CANT TELNET TO IP ADDRESS www.computing.net/answers/linux/redhat-72-cant-telnet-to-ip-address/9642.html