Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 20 Oct 2014, 01:11
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to use iptables to open a port.
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message
legendofthor

Joined: 17 May 2007
Posts: 219
Location: Queensland Australia

PostPosted: Tue 11 Aug 2009, 20:08    Post subject:  How to use iptables to open a port.
Subject description: plus a launch script to open a port and start your programme
 

G'day,
Sometimes a programme is not able to run as the Linux firewall has restricted its access due port a closed port. Well here's a workaround that works for me.
This code will open port 2234 for you:

Code:
iptables -A INPUT -i eth1 -p tcp --sport 2234 -m state --state ESTABLISHED -j ACCEPT


If a programme requires a particular port to be opened, such as Nicotine, you can make a simple script that opens the port and executes the programme. Eg:

Code:
#!/bin/sh
iptables -A INPUT -i eth1 -p tcp --sport 2234 -m state --state ESTABLISHED -j ACCEPT
/usr/bin/nicotine


This will open port 2234 and run the Nicotine programme. This works for me.

Remember, that some programmes require multiple ports to be opened. Just add extra iptables lines and the required port.

Cheers
Martin

PS: Sometimes your programme still won't be able to access the internet - this may due to:
1. It requires extra ports to be opened or
2. Modem firewall is blocking.

Security does not appear compromised with this procedure - I went to ShieldUp! to test and it came back as stealthed.

_________________
Toowoomba Linux Users Group http://groups.google.com/group/toowoombalinux
Back to top
View user's profile Send private message 
legendofthor

Joined: 17 May 2007
Posts: 219
Location: Queensland Australia

PostPosted: Tue 11 Aug 2009, 20:15    Post subject:  

how to find out what programmes are accessing ports type in Terminal:

Code:
netstat -nlp


Thanks to trapster for this info.

To check if the port has opened from the first post type:

Code:
iptables -L


Cheers
Martin

_________________
Toowoomba Linux Users Group http://groups.google.com/group/toowoombalinux
Back to top
View user's profile Send private message 
fat.tuesday

Joined: 06 Mar 2011
Posts: 4

PostPosted: Sun 06 Mar 2011, 07:04    Post subject: nicotine install
Subject description: port 2234
 

when i type the code to open the port 2234:
#!/bin/sh
iptables -A INPUT -i eth1 -p tcp --sport 2234 -m state --state ESTABLISHED -j ACCEPT
/usr/bin/nicotine

i recieve this message:
Error: Symbol iptables is not defined in current scope (tmpfile):1:
Error: Symbol AINPUT is not defined in current scope (tmpfile):1:
Error: Symbol ieth1 is not defined in current scope (tmpfile):1:
Error: Symbol ptcp is not defined in current scope (tmpfile):1:
Error: Symbol sport2234 is not defined in current scope (tmpfile):1:
Error: Symbol mstate is not defined in current scope (tmpfile):1:
Error: Symbol stateESTABLISHED is not defined in current scope (tmpfile):1:
Error: Symbol jACCEPT is not defined in current scope (tmpfile):1:
(const int)0
*** Interpreter error recovered ***

what should i do?
could you reply to me in my email then i keep it if some friends need it i give it to him...thank in advance
Back to top
View user's profile Send private message 
fat.tuesday

Joined: 06 Mar 2011
Posts: 4

PostPosted: Sun 06 Mar 2011, 07:05    Post subject:  

my email:

fattuesdayfestival@gmail.com
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 11117
Location: Arizona USA

PostPosted: Sun 06 Mar 2011, 08:34    Post subject:  

Please don't do that, especially not in the How to section. The forum is not just for you to solve problems, it is also for other people to learn from the solution to your problems. If you want to send someone an email with the solution, send them a link to this thread in the forum. Smile
Back to top
View user's profile Send private message 
fat.tuesday

Joined: 06 Mar 2011
Posts: 4

PostPosted: Sun 06 Mar 2011, 08:52    Post subject:  

ok...but could you tell me how to do it then? cuz i'm using ubuntu 10.10 and maybe...don't know but if you know how to tell me
Back to top
View user's profile Send private message 
fat.tuesday

Joined: 06 Mar 2011
Posts: 4

PostPosted: Sun 06 Mar 2011, 09:03    Post subject:  

is it possible to config nicotine allowing the port 2234 to nicotine server only and use it safely?
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0526s ][ Queries: 11 (0.0032s) ][ GZIP on ]