I am facing a problem to open port 25 with iptables on my CentOS machine. I checked the connection by 'nmap' and 'telnet' but both failed.

The follow things I did to trying make this work:

iptables -I INPUT -p tcp --dport 25 -j ACCEPT

/sbin/service iptables save

/sbin/service iptables restart


# iptables -L -n
Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     tcp  --             tcp dpt:25 
ACCEPT     tcp  --             tcp dpt:32315 
ACCEPT     tcp  --             tcp dpt:80 
ACCEPT     tcp  --             tcp dpt:443 
ACCEPT     all  --             state RELATED,ESTABLISHED 
ACCEPT     tcp  --             tcp dpt:8443 
ACCEPT     all  --             
ACCEPT     tcp  --             tcp dpt:25 
ACCEPT     tcp  --             tcp dpt:465 

Chain FORWARD (policy DROP)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination      

# nmap localhost

Starting Nmap 5.51 ( http://nmap.org ) at 2014-02-08 01:46 CET
Nmap scan report for localhost (
Host is up (0.000015s latency).
Not shown: 996 closed ports
80/tcp   open  http
443/tcp  open  https
2222/tcp open  EtherNet/IP-1
8443/tcp open  https-alt

Nmap done: 1 IP address (1 host up) scanned in 0.16 seconds
  • 1
    How exactly do you know there is a problem? What are you doing that is failing? Are you trying to run a mail server, or what? If a mail server, then are you sure it is running? We need more details here. – Zoredache Feb 8 '14 at 1:18

The iptables rule is fine, but according to nmap's output I don't think that you have any service running in that port.

Confirm that by running the following command:

netstat -nltp | grep 25

If the output does not show anything in that port, be sure to start the appropriate service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.