Results 1 to 11 of 11
-
02-21-2007, 11:41 AM #1WHT Addict
- Join Date
- Apr 2006
- Posts
- 113
Check whether port is open or not ?
How do I check whether certain ports (like 25, 53, etc.) are open on my server or not ? If it is not open how do I open the port ?
It is a CentOS server with no Control Panel
-
02-21-2007, 11:46 AM #2Web Hosting Master
- Join Date
- Apr 2003
- Location
- Los Angeles, CA
- Posts
- 820
1) Check if anyone is listening on the server:
# netstat -ln | grep 25
2) If it's a TCP port, you can try to connect to it.
# telnet SERVER_ADDRESS 25
Try it locally and remotely, in case there is a firewall and/or iptables in front of it blocking access.Pings <1 ms, Unlimited Transfer, Lowest Price: http://localhost/
-
02-21-2007, 12:22 PM #3Junior Guru Wannabe
- Join Date
- Mar 2006
- Location
- tikkabilla
- Posts
- 51
netstat -anp | grep LISTEN
will list what ports are listening (open)http://parked.net -100% Google Adsense Revenue | http://viphotels.co.uk - Worldwide VIP Hotels
-
02-21-2007, 12:40 PM #4WHT Addict
- Join Date
- Apr 2006
- Posts
- 113
It showed:
netstat -ln | grep 25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
I am able to telnet locally, but its not connecting from remote (my PC). I am able to telnet to other servers on port 25.
@ruptbot:
netstat -anp | grep LISTEN
tcp 0 0 IP:80 0.0.0.0:* LISTEN 24367/httpd
tcp 0 0 IP:53 0.0.0.0:* LISTEN 5467/named
tcp 0 0 IP:53 0.0.0.0:* LISTEN 5467/named
tcp 0 0 IP:53 0.0.0.0:* LISTEN 5467/named
tcp 0 0 IP:53 0.0.0.0:* LISTEN 5467/named
tcp 0 0 IP:53 0.0.0.0:* LISTEN 5467/named
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 5467/named
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 24163/sendmail: acc
tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 5467/named
tcp 0 0 :::22 :::* LISTEN 2693/sshd
tcp 0 0 ::1:953 :::* LISTEN 5467/named
unix 2 [ ACC ] STREAM LISTENING 6213514 2787/0 /tmp/ssh-cCwHfU2787/agent.2787
unix 2 [ ACC ] STREAM LISTENING 6013 2744/gpm /dev/gpmctl
unix 2 [ ACC ] STREAM LISTENING 6052 2762/dbus-daemon-1 /var/run/dbus/system_bus_socket
(I have replaced the real IP with "IP" in the result)
So I am not able to access port 25 and port 53 from remote location. Any clues ?
-
02-21-2007, 01:01 PM #5
do a "iptables -F" and try. If it is a success, let us know the output of iptables -L -n | grep 25
-
02-21-2007, 01:05 PM #6
Oops. I just noticed you are running sendmail. So the reason can be that sendmail is not listening to public IP address. Please try to do a --> grep Addr /etc/mail/sendmail.mc <-- and let us see the output. If it only localhost or 127.0.0.1, remove that Addr=127.0.0.1 and restart sendmail.
But again it is showing 0.0.0.0:25..hmm..
-
02-21-2007, 01:21 PM #7WHT Addict
- Join Date
- Apr 2006
- Posts
- 113
this is what it says...
grep Addr /etc/mail/sendmail.mc
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
dnl DAEMON_OPTIONS(`port=smtp,Addr=::1, Name=MTA-v6, Family=inet6')dnl
-
02-21-2007, 01:26 PM #8WHT Addict
- Join Date
- Apr 2006
- Posts
- 113
I removed Addr=127.0.0.1, from the first line, restarted sendmail, but no luck yet
shall I add it back ?
-
02-21-2007, 02:27 PM #9
No, you may not. What about a telnet public_ipaddress 25 from the server itself ? Also any output on iptables -L -n | grep 25
-
02-21-2007, 02:41 PM #10WHT Addict
- Join Date
- Apr 2006
- Posts
- 113
Yes, I am able to telnet to public IP 25 from the server.
iptables -L -n | grep 25
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255
ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353
Thats the result
-
02-22-2007, 09:06 AM #11Web Hosting Master
- Join Date
- Oct 2004
- Location
- Kerala, India
- Posts
- 4,771
Stop firewall in the server and try telnet from outside.
service iptables stopDavid | www.cliffsupport.com
Affordable Server Management Solutions sales AT cliffsupport DOT com
CliffWebManager | Access WHM from iPhone and Android