LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 01-26-2010, 05:41 AM   #1
sumanch
LQ Newbie
 
Registered: Jan 2010
Posts: 24

Rep: Reputation: 16
Enabling port 843


Hi ,
How Do I enable a port 843 in a Linux machine . I have written a server program that listens to port 843 and responds when requested . But Client socket request is not able to reach that port . socket.connect functions returns -1 with timeout . I have edited /etc/services to add that port . But this is not working . Please help me out . Thanks in advance .

regards
Suman
 
Old 01-26-2010, 05:48 AM   #2
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Hi Suman,

What distribution are you using? I suspect this answer will lay in a firewall and as the most common firewalling tool in linux tends to be iptables (that interacts with the kernel routing tables). Try the following two commands.

/etc/init.d/iptables status
iptables -nvL

If the two commands give the same output then copy and paste one set of results here and we should be able to better guide you what modifications. If iptables status says that iptables is on or active then copy and paste the results of "iptables -nvL" here.
 
Old 01-26-2010, 06:43 AM   #3
sumanch
LQ Newbie
 
Registered: Jan 2010
Posts: 24

Original Poster
Rep: Reputation: 16
Thanks for the reply . I am using ("MontaVista 3.4.3-25.0.143.0800417 2008-02-22" distribution . Though I could not execute "/etc/init.d/iptables status" , I have executed "iptables -nvL" . It gives the following output .

Chain INPUT (policy DROP 8828 packets, 834K bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- eth0 * 0.0.0.0/0 127.0.0.0/8
415K 42M ACCEPT all -- * * 0.0.0.0/0 127.0.0.0/8
0 0 ACCEPT all -- vlan4042 * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- vlan4043 * 0.0.0.0/0 0.0.0.0/0
163K 19M ACCEPT all -- vlan4044 * 0.0.0.0/0 0.0.0.0/0
44 17408 ACCEPT all -- vlan4047 * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
15320 968K samrules all -- * * 0.0.0.0/0 10.65.124.26

Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- * * 127.0.0.0/8 0.0.0.0/0

Chain OUTPUT (policy ACCEPT 552K packets, 214M bytes)
pkts bytes target prot opt in out source destination
0 0 DROP all -- * eth0 127.0.0.0/8 0.0.0.0/0

Chain samrules (1 references)
pkts bytes target prot opt in out source destination
15 820 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443
12675 722K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
2407 202K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:514
11 832 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
0 0 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
116 37587 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
 
Old 01-26-2010, 06:57 AM   #4
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
If this server is sitting on the 10.65.124.26 ip, then I believe the solution to this on is the following.

iptables -I samrules -p tcp --dport 843 -j ACCEPT

however I don't know much about the service, if it instead uses udp then the following would be the more correct line

iptables -I samrules -p udp --dport 843 -j ACCEPT

Please note this line is not a perm fix and will be lost on the next restart of iptables, the service is likely stored in /etc/init.d/ but under a different name, like firewall. I do not know the iptables save method preferred by the distribution you are using either.

Last edited by r3sistance; 01-26-2010 at 07:01 AM. Reason: ip
 
Old 01-26-2010, 07:07 AM   #5
sumanch
LQ Newbie
 
Registered: Jan 2010
Posts: 24

Original Poster
Rep: Reputation: 16
Thanks . It works . I appreciate your help .
 
Old 01-26-2010, 07:11 AM   #6
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
If this works and you are satisfied with it, could you go to the thread tools and click the "mark this thread as solved" link.

As I would point out however, this rule is only temporary and will be lost on an iptables restart (you can easily re-apply this but this manual method has a few drawbacks), so you may want to look into that yourself. However if you need further help here, feel free to ask for it and do not mark this thread as solved yet.

R3sistance
 
Old 01-26-2010, 07:18 AM   #7
sumanch
LQ Newbie
 
Registered: Jan 2010
Posts: 24

Original Poster
Rep: Reputation: 16
Hi ,
My problem is solved temporarily . But I am investigating for a permanent solution as you suggested . Lets keep the thread open .

regards
Suman
 
  


Reply



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
enabling port forward redirection from single external IP nikkac Linux - Security 2 10-04-2006 02:24 PM
IBM T43 Laptop, Infrared port enabling havok1977 Linux - Hardware 8 09-28-2006 11:55 AM
Fedora Core 5 enabling X11 port 6000 jrbrearley Linux - Software 1 07-22-2006 01:15 PM
--destination-ports port[,port[,port...]] KevinGuy Linux - Networking 1 03-16-2004 06:06 PM
enabling port 143 jay_gonzales Linux - Software 10 03-01-2004 04:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:17 PM.

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
Open Source Consulting | Domain Registration