Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

iptables block opened ports

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
khaled_j_hussein
Posts: 7
Joined: 2023-02-20 07:37

iptables block opened ports

#1 Post by khaled_j_hussein »

Hi,

I have a server running Debian 11 and I installed CSF firewall which use iptables, I setup new server using Debian 112 and this new server need to connect to Debain 11 on ports 22 and 3306
I opened these ports on Debian 11 and check the output of iptales -L -n, the IP and ports are allowed but the connection still blocked

i checked the tcpdump on destination server Debian 11 and see the trffice reach but no response send to the source IP

any idea how to investigate this

Note: I face the same issue before and restart the server solved it, but this server is DB production server and the restart need a lot of arrangement and work

Thanks in advance

User avatar
mrnordio2
Posts: 27
Joined: 2023-03-29 14:53
Has thanked: 1 time
Been thanked: 6 times

Re: iptables block opened ports

#2 Post by mrnordio2 »

Hello khaled_j_hussein,

It sounds like you're facing a classic networking challenge with iptables and CSF on your Debian servers.
Since you've already confirmed that the required ports (22 for SSH and 3306 for MySQL) are open and the traffic is reaching the Debian 11 server, yet there's no response, let's look into a few possibilities.

Firewall Rules Order: In iptables, the order of the rules is crucial. Make sure that the ALLOW rules for ports 22 and 3306 are placed before any DROP or REJECT rules. This can sometimes be overlooked.

Check CSF Configuration: Since CSF manages iptables, ensure that the CSF configuration is not overriding your manual iptables rules. Look into /etc/csf/csf.conf and verify that these ports are allowed in the TCP_IN and TCP_OUT settings.

Verify Interface and Binding: Check if the services on Debian 11 (SSH and MySQL) are bound to the correct network interface. They should be listening on all interfaces or specifically on the interface that the Debian 112 server is connecting to.

Check Connection States: You might want to check the connection states in your iptables rules. Sometimes, rules are set to allow only ESTABLISHED and RELATED connections, which might interfere with initial connection setups.

Additional Firewalls or Security Groups: If your servers are hosted on a cloud platform or behind additional firewalls, ensure that these also have the necessary ports open.

Logs and Diagnostics: Check the logs for both iptables (/var/log/messages or /var/log/kern.log) and CSF for any clues. Running iptables -vL can give more verbose output which might be helpful.

Temporary Rules for Troubleshooting: As a last resort and for troubleshooting only, you might temporarily add explicit ACCEPT rules for the source IP at the top of your iptables ruleset to see if it resolves the issue. Remember to remove these after testing, especially if they are overly permissive.

Since restarting the server isn't an ideal solution in a production environment, these steps should help you narrow down the issue without needing a restart. Always ensure to take backups of your current firewall configuration before making changes.

Hope this helps, and let me know if you need further assistance!
In a world of 1s and 0s, I am the exceptional exception. Linux isn't just my platform; it's my playground.

Post Reply