Khan wrote:
Hello,
I am total beginner to Linux and I'm trying to learn iptables basics. I would like to learn how to close all ports but 80, 20, and that ports 22 and 10000 will be open only to my IP address.
How can I do that.
TNX!
first, a hint or two:
RTFM (man iptables, quite helpful actually, will explain what some of this actually does!)
http://www.netfilter.org has some very good simple guides to how this works.
http://www.tldp.org has some good howtos
now some ideas.
# set default policy on INPUT chain # ie, what to do with packets that don't match my rules iptables -P INPUT DROP # accept tcp packets for port 80 iptables -t filter -A INPUT -p tcp --dport 80 -j ACCEPT # accept tcp and udp packets for port 20 iptables -t filter -A INPUT -p tcp --dport 20 -j ACCEPT iptables -t filter -A INPUT -p udp --dport 20 -j ACCEPT
#accept packets from your ip address for port 22 (ssh is tcp so i have used that)
iptables -t filter -A INPUT -m tcp -p tcp --dport 22 -s your.ip.addr.here -j ACCEPT
# incidentally, it will also accept --dport ssh if you like
# accept inbound packets for port 10000 from your ip
iptables -t filter -A INPUT -p tcp --dport 10000 -s your.ip,addr,here -j ACCEPT
iptables -t filter -A INPUT -p udp --dport 10000 -s your.ip,addr,here -j ACCEPT
-- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list