LinuxQuestions.org
Visit Jeremy's Blog.
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 02-20-2011, 04:46 AM   #1
mmhs
Member
 
Registered: Oct 2010
Posts: 101

Rep: Reputation: 1
Add port in firewall


hey guys i have a simple question

how can i add a port number as a trust in firewall with command

i test iptables -A INPUT -p tcp --dport portnumber -j ACCEPT

but it cant help me

i want to add port from command same as gui
system ---->administration ---->security level and firewall --->add port

plz help me !!
 
Old 02-20-2011, 05:09 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
When appending ('-A') rules, you need to know what the rule list looks like and what the policy is. Say your last rule is a 'drop all' type, then appending your rule as you did will fail.

# show current rules and policy
iptables -Ln --line-numbers

You'll probably need to insert ('-I') your new rule at a specific line, there are plenty of tutorials available so I won't drag this out any further

cheers

Last edited by kbp; 02-20-2011 at 04:10 PM.
 
1 members found this post helpful.
Old 02-20-2011, 05:13 AM   #3
BoraxMan
Member
 
Registered: Apr 2010
Posts: 103

Rep: Reputation: 11
Quote:
Originally Posted by mmhs View Post
hey guys i have a simple question

how can i add a port number as a trust in firewall with command

i test iptables -A INPUT -p tcp --dport portnumber -j ACCEPT

but it cant help me

i want to add port from command same as gui
system ---->administration ---->security level and firewall --->add port

plz help me !!
Instead of using -A INPUT

use -I INPUT. THis inserts the rule at the top of the chail. You can also specify a position in the chain.

ie

iptables -I INPUT 3 -p tcp --dport 21 -j ACCEPT

But as to do it via GUI, it might help if you tell us what distribution you are running.
 
1 members found this post helpful.
Old 02-20-2011, 05:30 AM   #4
mmhs
Member
 
Registered: Oct 2010
Posts: 101

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by BoraxMan View Post
Instead of using -A INPUT

use -I INPUT. THis inserts the rule at the top of the chail. You can also specify a position in the chain.

ie

iptables -I INPUT 3 -p tcp --dport 21 -j ACCEPT

But as to do it via GUI, it might help if you tell us what distribution you are running.
thx man it help me

and i work with centos 5.5
 
  


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
Is there any way to add an exception for a port in the firewall setting, permanently? senrooy Linux - Kernel 6 03-03-2010 12:28 AM
If I forward a port in iptables, does the port have to be open on the firewall? qwertyjjj Linux - Server 4 08-06-2009 09:22 AM
What port should I add to firewall to allow ping from client? hsia Linux - Newbie 1 10-28-2008 06:07 AM
port 25 filtered despite firewall having port 25 open ille.pugil42 Linux - Security 8 03-09-2007 12:51 AM
firewall.rc.config says :"open port 8080" but nmap says port is closed saavik Linux - Security 2 02-14-2002 12:16 PM

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

All times are GMT -5. The time now is 05:20 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
Open Source Consulting | Domain Registration