Firewall – How to check if a port is open on Red Hat Linux/CentOS

firewallportredhat

I've written a program that is suppose to implement SLP (rfc2608) and I'm having trouble testing it. I'm not sure if the port is closed or there is something out there dropping my multicast datagrams. Is there a command I can run from a redhat terminal to tell me if a port is open on that box?

I've seen some posts on simply telneting to the port, etc…, but that only works for TCP ports, right? I've also read that there are sites that can test this sort of thing from the outside. But I really don't want to do that since I'm not interested in a full port scan, the box is on a private network, and even if it wasn't, I don't want it to look like a security incident is going on. I simply want to query and see if port 427 is open.

Best Answer

Hmm. Multicast, so telnet isn't going to work.

You can run tcpdump, I think, to see if traffic is getting to your server. Run something like this on your server:

tcpdump -i eth0 port 427 and see if anything shows up.

If nothing does, there's some sort of block elsewhere.

Check your local firewall with something like iptables -L -n to make sure the INPUT chain permits your traffic.

To further diagnose, you may need to start running traceroutes from your laptop, specifying the protocol and port (otherwise, it'll default to ICMP).