Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-25-2012, 09:28 AM   #1
LQ Newbie
Registered: Aug 2010
Posts: 9

Rep: Reputation: 0
Perl - Check incoming ports from inside


I want to be able to check whether a particular port is open from outside world to a particular machine. But i wish to do this test from the same machine. For example i want to check if port 80 is open to a host called and perform this check from

The problem here is that the machine will only have certain incoming and outgoing ports open. And i want to run a perl script on that machine to determine if the firewall rules created are working fine. Outgoing can be checked easily but how do i check incoming ports ?

I was thinking to spoof the src port to the required incoming port and then send a packet out to one of the allowed outgoing addresses. Then create a socket that is already listening on the incoming port. When the host replies it will come to my spoofed port where i would have one sock instance waiting to accept.

If thats possible ! Because the reply will not be the initial sync packet ?

Any ideas how else to achieve this?

Old 02-25-2012, 12:27 PM   #2
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
AFAIK, you'll need some form of proxy to do this correctly.

It's easy to verify 1) an allow rule in a firewall ruleset; 2) a listening TCP socket. But the problem is a scan from a host to itself is more or less meaningless. (I don't think spoofing IPs is going to be a good test.)

I recommend either setting up a simple (external) scan host, or making use of a service like GRC's Shields Up.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use linksys BB router to multiply ports available inside another network dr_skids Linux - Networking 2 08-12-2008 10:58 AM
perl inside a shell script baidym Linux - Newbie 2 05-05-2008 07:42 PM
Network traffic -- monitor my incoming and outgoing ports bskrakes Linux - Networking 5 04-02-2008 09:44 AM
check incoming or outgoing packets ilnli Programming 1 07-24-2007 04:08 PM
Vim Spell Check Inside Tags? Optimistic Linux - Software 1 04-15-2005 03:36 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:24 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration