Solved

iptables 3306 rules not saving

Posted on 2014-09-04
9
460 Views
Last Modified: 2014-09-06
I am inserting the rule property :: saving :: restarting and the rule is not committed. I am doing the following:

Step 1:

iptables -A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT

Step 2:

service iptables save

Step 3:

service iptables restart

Step 4:

I simply rebooted the machine.

When I do:

iptables --list-rules
I don't see the rule committed and I cannot connect from the outside.

Note:
I saw a complex version of this rule: iptables -I INPUT -i eth0 -p tcp -s 1.1.1.2 -d 1.1.1.1 --destination-port 3306 -j ACCEPT
0
Comment
Question by:Starquest321
  • 5
  • 4
9 Comments
 

Author Comment

by:Starquest321
ID: 40305169
Running a CENT OS 7 Box
0
 

Author Comment

by:Starquest321
ID: 40305175
Note: When I tried to use the setup system-config I got the following error:

ERROR: FirewallD is active, please use firewall-cmd.
0
 
LVL 62

Expert Comment

by:gheist
ID: 40305701
iptables/system-config-firewall-tui are now replaced by firewalld.
to get old behaviour disable and stop firewalld (chkconfig firewalld off ; service firewalld stop)
enable and start ip(6)tables
0
Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 

Author Comment

by:Starquest321
ID: 40305744
so how do I use the firewalld - is that easier?
0
 

Author Comment

by:Starquest321
ID: 40305749
What are the exact commands to enable iptables?
0
 
LVL 62

Expert Comment

by:gheist
ID: 40305808
firewalld is managed by firewall-config (both have manual pages)

iptables:
yum install system-config-firewall-tui
now run system-config-firewall-tui and allow at least SSH protocol (press once OK, it saves config, but fails, then cancel to exit, without this you lose remote access to system)
chkconfig iptables on ; service iptables start
chkconfig ip6tables on ; service ip6tables start

(between the lines you will learn something about how RHEL7 is different from RHEL6)
0
 
LVL 62

Accepted Solution

by:
gheist earned 500 total points
ID: 40305856
0
 

Author Comment

by:Starquest321
ID: 40306011
when I install iptables -- does that mean I am turning off firewalld?
0
 
LVL 62

Expert Comment

by:gheist
ID: 40306030
No, you have to explicitly switch it off and stop
Then configure rule for SSH (http, ... etc to allow extant service)
And then start and enable iptables
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Hello EE, Today we will learn how to send all your network traffic through Tor which is useful to get around censorship and being tracked all together to a certain degree. This article assumes you will be using Linux, have a minimal knowledge of …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question