Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

OUTPUTS:

# iptables -L -n
Chain INPUT (policy DROP)
target     prot opt source               destination         
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:25 
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:32315 
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:80 
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:443 
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED 
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:8443 
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:25 
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           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 (127.0.0.1)
Host is up (0.000015s latency).
Not shown: 996 closed ports
PORT     STATE SERVICE
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
share|improve this question
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 at 1:18

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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