configuration iptables

General support questions
Post Reply
aolloh
Posts: 1
Joined: 2019/07/11 15:36:20

configuration iptables

Post by aolloh » 2019/07/11 15:54:47

Hello,

This is the error i have when trying to access my server

Session stopped
- Press <return> to exit tab
- Press R to restart session
- Press S to save terminal output to file

Network error: Connection timed out

I have set iptables and restart it

this is the entry in my /etc/sysconfig/iptables
-A INPUT -p tcp -i enp3s0f1 --dport 22 -j ACCEPT
-A INPUT -i enp3s0f1 -j DROP

The default ssh port is set to 22 in the sshd_config file on the server

Thank in advance

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: configuration iptables

Post by TrevorH » 2019/07/11 16:02:12

The default firewall in CentOS 7 is firewalld and does not use /etc/sysconfig/iptables. If you have disabled firewalld and installed iptables-services and set it to start on boot then that file will be used. Your copy of the file, if it contains only what you posted, is not correct. It should look more like this:

Code: Select all

# Generated by iptables-save v1.4.21 on Thu Jul 11 16:57:50 2019
*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Thu Jul 11 16:57:50 2019
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply