LinuxQuestions.org
Help answer threads with 0 replies.
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-20-2012, 01:37 AM   #1
snooze1
Member
 
Registered: Sep 2011
Posts: 34

Rep: Reputation: Disabled
opening ports


i am trying to open a UDP port on Centos 5.7 with iptables.

for some reason "iptables -A INPUT -p udp --dport 7777 -j ACCEPT" isn't working.

any suggestions?
 
Old 01-20-2012, 03:17 AM   #2
aazkan
Member
 
Registered: Jan 2008
Posts: 72

Rep: Reputation: 5
Hi

CentOSes up to CentOS 6 uses the RH-Firewall-1-INPUT chain. It goes like this

Code:
-A RH-Firewall-1-INPUT -p udp -m udp --dport 7777 -j ACCEPT
If you have a service or daemon already running on udp port 7777 try connecting to it with nmap or nc like so

Code:
nmap -nv -sU -p 7777 localhost
or

Code:
nc -nvvv -u localhost 7777
Hope this helps.
Regards,

Last edited by aazkan; 01-20-2012 at 03:18 AM. Reason: code tag gets displayed instead
 
Old 01-20-2012, 04:32 AM   #3
snooze1
Member
 
Registered: Sep 2011
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by aazkan View Post
Hi

CentOSes up to CentOS 6 uses the RH-Firewall-1-INPUT chain. It goes like this

Code:
-A RH-Firewall-1-INPUT -p udp -m udp --dport 7777 -j ACCEPT
If you have a service or daemon already running on udp port 7777 try connecting to it with nmap or nc like so

Code:
nmap -nv -sU -p 7777 localhost
or

Code:
nc -nvvv -u localhost 7777
Hope this helps.
Regards,
And do I add that in /etc/sysconfig/iptables?
 
Old 01-20-2012, 05:35 AM   #4
aazkan
Member
 
Registered: Jan 2008
Posts: 72

Rep: Reputation: 5
Yes. Edit /etc/sysconfig/iptables

or if your cli driven (who isn't), as root, type

Code:
iptables -I RH-Firewall-1-INPUT -p --dport 7777 -j ACCEPT
review it like so

Code:
iptables -L -nv |grep 7777
the nmap or nc test can be use as well.
 
Old 01-20-2012, 05:44 AM   #5
snooze1
Member
 
Registered: Sep 2011
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by aazkan View Post
Yes. Edit /etc/sysconfig/iptables

or if your cli driven (who isn't), as root, type

Code:
iptables -I RH-Firewall-1-INPUT -p --dport 7777 -j ACCEPT
review it like so

Code:
iptables -L -nv |grep 7777
the nmap or nc test can be use as well.
Somehow the port is opened now and I can see the server running fine, but when I try and do it with another server running on 9948 UDP adding "-A RH-Firewall-1-INPUT -p udp -m udp --dport 9948 -j ACCEPT" to the file doesn't work.

Also,

Code:
# iptables -I RH-Firewall-1-INPUT -p --dport 9948 -j ACCEPT
iptables v1.3.5: unknown protocol `--dport' specified
Try `iptables -h' or 'iptables --help' for more information.
 
Old 01-20-2012, 06:06 AM   #6
aazkan
Member
 
Registered: Jan 2008
Posts: 72

Rep: Reputation: 5
From you iptables output/example, your're missing

-p udp

Give it another try?
 
Old 01-20-2012, 07:01 AM   #7
snooze1
Member
 
Registered: Sep 2011
Posts: 34

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by aazkan View Post
From you iptables output/example, your're missing

-p udp

Give it another try?
First of all, derp..

Code:
#  iptables -I RH-Firewall-1-INPUT -p udp --dport 9948 -j ACCEPT
iptables: No chain/target/match by that name
 
Old 01-20-2012, 07:21 PM   #8
aazkan
Member
 
Registered: Jan 2008
Posts: 72

Rep: Reputation: 5
Then it means there is no such chain. Have a look in your iptables what chains does it use?
 
Old 01-25-2012, 06:23 PM   #9
aazkan
Member
 
Registered: Jan 2008
Posts: 72

Rep: Reputation: 5
Hi snooze1,

Thought i chech up with you if you figured out your iptables problem?

tegards,
 
  


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
Problem opening ports - ports appear open, but do not work. computer_freak_8 Linux - Software 10 09-20-2008 09:39 PM
Opening ports? skumaryermal Linux - Newbie 1 09-28-2006 01:36 PM
Opening Ports Astral_Nomad Mandriva 4 12-09-2005 12:17 PM
opening ports I think jleipert Linux - Security 7 09-04-2005 09:14 AM
Opening Ports george3k Linux - Newbie 7 02-16-2003 01:59 PM

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

All times are GMT -5. The time now is 08:51 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