LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 11-02-2009, 08:43 AM   #1
nagavinodh
Member
 
Registered: Aug 2009
Posts: 118

Rep: Reputation: 15
linux port


Hi,
how to find the listening port in linux.

how to restrict the port in linux
 
Old 11-02-2009, 08:46 AM   #2
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,549
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

How about a little more information?

What are you attempting?
 
Old 11-02-2009, 10:08 AM   #3
nagavinodh
Member
 
Registered: Aug 2009
Posts: 118

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by onebuck View Post
Hi,

How about a little more information?

What are you attempting?
how to find running port in red hat
 
Old 11-02-2009, 10:28 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 17,961

Rep: Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693Reputation: 3693
Quote:
Originally Posted by nagavinodh View Post
how to find running port in red hat
Running port for WHAT??? Every service listens on a different port. Look up the netstat command.
 
Old 11-02-2009, 07:15 PM   #5
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,549
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

Quote:
Originally Posted by nagavinodh View Post
how to find running port in red hat
Look at '/etc/services'.

 
Old 11-02-2009, 07:32 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
See also netstat http://linux.die.net/man/8/netstat and iptables http://linux.die.net/man/8/iptables
 
Old 11-02-2009, 11:27 PM   #7
niraj_india
LQ Newbie
 
Registered: Oct 2005
Location: delhi
Posts: 5

Rep: Reputation: 0
Thumbs down port listening

# netstat --listen


niraj kumar sinha
RHCE(Redhat Certified Engineer)
linux administrator
 
Old 11-02-2009, 11:33 PM   #8
niraj_india
LQ Newbie
 
Registered: Oct 2005
Location: delhi
Posts: 5

Rep: Reputation: 0
Thumbs down restrict the port in linux

$IPTABLES -A INPUT -p TCP -s 11.22.33.44 --dport 25 -j ACCEPT

niraj kumar sinha
RHCE(Redhat Certified Engineer)
linux administrator
 
Old 11-03-2009, 12:31 AM   #9
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
That iptables rules will not make sense if the default policy is set to ACCEPT which is by default. And OP is asking about restricting the port and not opening.
It should be DROP or REJECT depending on your requirements. Also please give more information on this. Else it looks like a homework.
 
Old 11-04-2009, 11:18 PM   #10
niraj_india
LQ Newbie
 
Registered: Oct 2005
Location: delhi
Posts: 5

Rep: Reputation: 0
Thumbs down port drop

IPTABLES -A INPUT -p TCP -s 11.22.33.44 --dport 25 -j DROP
IPTABLES -A INPUT -p UDP -s 11.22.33.44 --dport 25 -j DROP
 
  


Reply


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
C under Linux -Trying to write two port server and 2 port client application NancyT Linux - Server 3 04-17-2009 03:05 AM
linux serial port to router console port connection? frankie_fix Linux - General 3 02-26-2007 10:32 PM
Using serial port card(PCMCIA) with IPAQ running Linux, can't find ttyS0 port d2army Linux - Laptop and Netbook 0 11-12-2005 09:07 PM
--destination-ports port[,port[,port...]] KevinGuy Linux - Networking 1 03-16-2004 07:06 PM


All times are GMT -5. The time now is 06:37 AM.

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