[SOLVED] Have messed up my iptables? Get me to correct it !
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Have messed up my iptables? Get me to correct it !
I have messed up my iptables searching in Google to make ftp work on my Server. Clients get connected but unable to browse the directories nor do anything. It says ftp>Entering Passive mode and putting the message No route to host, when they hit the command "ls". I think I have messed up the iptables, many items are doubled.
I have found another way to get ftp working by enabling ip_conntrack_ftp which was not there earlier in iptables-config.
Please help me restore to the correct iptables so as to enable ftp, http and ssh.
I am using RHEL 5.4 Server X86_X64 version. I have attached the iptables file to this.
You messed up things so far that you're not using the chain you think you are using (INPUT -> RH-Firewall-1-INPUT) and you don't seem to grasp basics like -m state (shouldn't have NEW and ESTABLISHED in one line) and since your filter table default chains all have an "ACCEPT" policy there shouldn't be a need for that much rules. Should look something like this but you should test it (like restore backup rule set after say five minutes):
Code:
# Generated by iptables-save v1.3.5 on Fri Jul 5 12:35:05 2013
*filter
:INPUT ACCEPT [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [270:43714]
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp -m multiport --dports 20:22,80 -m state --state NEW -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1024:65535 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m icmp -p icmp --icmp-type any -j ACCEPT
-A INPUT -m udp -p udp -d 224.0.0.251 --dport 5353 -j ACCEPT
-A INPUT -j LOG --log-prefix "REJECTED "
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A OUTPUT -o lo -j ACCEPT
COMMIT
# Completed on Fri Jul 5 12:35:05 2013
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.