IPTables giving me issues...
I googled for how to enable remote connections and updated my IPTables.
However, now my site is having a hard time refreshing, I run CodeIgniter and on every 5th to 6th refresh, I get can't establish database connection.
I have a novice understanding of IPTables and I'm just not sure where I screwed this one up.
iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT tcp – anywhere anywhere tcp dpt:ssh
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:http
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:mysql
Chain FORWARD (policy DROP)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
for those who know CodeIgniter
Unable to connect to your database server using the provided settings.
Filename: core/Loader.php
Line Number: 346
Thanks,
3 Replies
iptables-save
netstat -plant | grep 3306
iptables -L isn't very useful, as it omits some info, and makes other things more effort to understand what is actually going on
@dwfreed:
Could you provide the output of the following commands?
iptables-save netstat -plant | grep 3306
iptables -L isn't very useful, as it omits some info, and makes other things more effort to understand what is actually going on
I use a Editor for php programming and the refreshes seem less likely to happen after I make some code changes and click save, rather then just hitting refresh on the browser.
So I'll make a code change, click save, hit refresh about 6 times then it works, if I don't mess with the editor, and just pound refresh it works ever time.
Generated by iptables-save v1.4.7 on Sun Apr 8 19:07:32 2012
*security
:INPUT ACCEPT [36656:3526692]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [39079:11623693]
COMMIT
Completed on Sun Apr 8 19:07:32 2012
Generated by iptables-save v1.4.7 on Sun Apr 8 19:07:32 2012
*raw
:OUTPUT ACCEPT [39080:11623849]
COMMIT
Completed on Sun Apr 8 19:07:32 2012
Generated by iptables-save v1.4.7 on Sun Apr 8 19:07:32 2012
*nat
:INPUT ACCEPT [2024:106608]
:OUTPUT ACCEPT [9621:677265]
COMMIT
Completed on Sun Apr 8 19:07:32 2012
Generated by iptables-save v1.4.7 on Sun Apr 8 19:07:32 2012
*mangle
:INPUT ACCEPT [36669:3527649]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [39086:11624897]
COMMIT
Completed on Sun Apr 8 19:07:32 2012
Generated by iptables-save v1.4.7 on Sun Apr 8 19:07:32 2012
*filter
:INPUT DROP [13:957]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [39088:11625193]
-A INPUT -p tcp -m tcp –dport 22 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
COMMIT
Completed on Sun Apr 8 19:07:32 2012
@zobrak:
@dwfreed:Could you provide the output of the following commands?
iptables-save netstat -plant | grep 3306
iptables -L isn't very useful, as it omits some info, and makes other things more effort to understand what is actually going on
I use a Editor for php programming and the refreshes seem less likely to happen after I make some code changes and click save, rather then just hitting refresh on the browser.
So I'll make a code change, click save, hit refresh about 6 times then it works, if I don't mess with the editor, and just pound refresh it works ever time.
SYSTEM 2
Generated by iptables-save v1.4.7 on Sun Apr 8 19:07:32 2012
*security
:INPUT ACCEPT [36656:3526692]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [39079:11623693]
COMMIT
Completed on Sun Apr 8 19:07:32 2012
Generated by iptables-save v1.4.7 on Sun Apr 8 19:07:32 2012
*raw
:P REROUTING ACCEPT [36669:3527649]:OUTPUT ACCEPT [39080:11623849]
COMMIT
Completed on Sun Apr 8 19:07:32 2012
Generated by iptables-save v1.4.7 on Sun Apr 8 19:07:32 2012
*nat
:P REROUTING ACCEPT [2033:107397]:INPUT ACCEPT [2024:106608]
:OUTPUT ACCEPT [9621:677265]
:P OSTROUTING ACCEPT [9621:677265]COMMIT
Completed on Sun Apr 8 19:07:32 2012
Generated by iptables-save v1.4.7 on Sun Apr 8 19:07:32 2012
*mangle
:P REROUTING ACCEPT [36669:3527649]:INPUT ACCEPT [36669:3527649]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [39086:11624897]
:P OSTROUTING ACCEPT [39086:11624897]COMMIT
Completed on Sun Apr 8 19:07:32 2012
Generated by iptables-save v1.4.7 on Sun Apr 8 19:07:32 2012
*filter
:INPUT DROP [13:957]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [39088:11625193]
-A INPUT -p tcp -m tcp –dport 22 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
COMMIT
Completed on Sun Apr 8 19:07:32 2012
–-----------------------------------------------------------------------------------------------------
Here is another Linode I have … running about the system that works.
I'm not sure what of those lines at the bottom I need for previous system to stop having so many errors.
SYSTEM 1
Generated by iptables-save v1.4.7 on Sun Apr 8 19:52:50 2012
*security
:INPUT ACCEPT [12826672:7758787170]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [10947027:2016195081]
COMMIT
Completed on Sun Apr 8 19:52:50 2012
Generated by iptables-save v1.4.7 on Sun Apr 8 19:52:50 2012
*raw
:OUTPUT ACCEPT [10947027:2016195081]
COMMIT
Completed on Sun Apr 8 19:52:50 2012
Generated by iptables-save v1.4.7 on Sun Apr 8 19:52:50 2012
*nat
:INPUT ACCEPT [268140:15459913]
:OUTPUT ACCEPT [1091234:74705149]
COMMIT
Completed on Sun Apr 8 19:52:50 2012
Generated by iptables-save v1.4.7 on Sun Apr 8 19:52:50 2012
*mangle
:INPUT ACCEPT [12853817:7760185297]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [10947027:2016195081]
COMMIT
Completed on Sun Apr 8 19:52:50 2012
Generated by iptables-save v1.4.7 on Sun Apr 8 19:52:50 2012
*filter
:INPUT DROP [14622:732886]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [7751339:1320739070]
-A INPUT -p tcp -m tcp –dport 22 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT
COMMIT