LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   need to open port number 7 on debian linux (https://www.linuxquestions.org/questions/linux-general-1/need-to-open-port-number-7-on-debian-linux-878854/)

gadhave.vikas 05-04-2011 04:38 PM

need to open port number 7 on debian linux
 
Hi Techies,

I have system with debian linux installed. i got to know that debian doesent have IPTABLES firewall installed in built. i found the shoerwall firewall installed on system. now i wanted to open port no.7 for application comunication purpose please let me know if any one knows.

also one more thing.. if i type command iptables --list i can see list of rules installed on ssytem....confuse which firewall application installed on the system please advice.......

Rgds,
vikas

corp769 05-04-2011 04:44 PM

Hello,

If you can run iptables --list then iptables is installed. You could use shorewall to open the port, or you can edit /etc/sysconfig/iptables manually and add a rule to open port 7 on your system. See here for more documentation on iptables and adding rules: http://www.linuxhomenetworking.com/w...Using_iptables
ALso, see here about adding rules in shorewall: http://www.shorewall.net/FAQ.htm#faq51

Also, the following rule will open port 7, TCP:
Code:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 7 -j ACCEPT
Hope that helps,

Josh

gadhave.vikas 05-04-2011 09:35 PM

need to open port number 7 on debian linux
 
Thx josh,

As you have stated that the i can use manually /etc/sysconfig/iptables but there on system I failed to find the sysconfig directory in etc.
I have check with find command iptabes file pls find the below output.
find / -name iptables
/sbin/iptables
/usr/share/doc/iptables
/usr/share/lintian/overrides/iptables
/usr/share/iptables

Also I have to use UDP protocol instead of TCP. (pls suggest the rule as per)
What you have given website about shoerwall that is not usable for me as I have go through with the site already. But my problem is if I consider website shoerwall there are lots of dependency to open port which I cannot full fill because I don’t know in which manner the configuration of shoerwall firewall is done at the time of initial installation.
Also I tried to restart the iptables but unable to find out the way to restart in debian linux.
Tried,
/etc/init.d/ip….. ----no IP table at here
Service iptables restart/start/stop ---- no success
/sbin/iptables start/stop/restart -----no success
Last query,
If I configure the iptables rule if shoerwall firewall is there …. Can that rule take effect…..

Please sugesst…

corp769 05-04-2011 10:04 PM

One thing I noticed... you spelled Service, and not service, note the capital S. Linux is case sensitive; I just want to rule that out. Also check out this reference: http://www.cyberciti.biz/tips/how-to...-services.html

Also look here at this thread: http://www.linuxquestions.org/questi...tables-334836/

Cheers,

Josh

repo 05-06-2011 10:06 AM

Quote:

i found the shoerwall firewall installed on system. now i wanted to open port no.7 for application comunication purpose please let me know if any one knows.
Take a look at the FAQ
http://www.shorewall.net/FAQ.htm

Kind regards

gadhave.vikas 05-09-2011 05:25 AM

Hi ,


( Sorry for delay )

there are lots of troubles coming in my way.

Here is what i did yet:

1) I have added following entry in the rules file of shorewall :

#ACTION SOURCE DESTINATION PROTO DEST PORT(S)
ACCEPT net $FW udp 7

and restarted shorewall (/etc/init.d/shorewall restart)

but unfortunately it did not work . I tried 8-10 times then i got confused . SO I have stopped a shorewall service (/etc/ini.d/shorewall stop ) and then tried to telnet server on port 7 but that also did not work.

so i checked with any other firewall found iptable service does not exist . ( ps -ef | grep iptables -> no output) but after doing iptalbes --list it gives set of rules assigned to this syste.

and I am trying to add rules to the iptables list but it is not accepting my rules .
iptables -A INPUT -d serverIP -p udp --dport 7 -j ACCEPT

Linux version is : Debian 2.6.26-2-amd64

Please let me know what should i do and where am i going wrong ?


Thanks

repo 05-09-2011 06:07 AM

What doesn't work?
error messages?
Do you have a service listening on port 7?

Kind regards

Rakesh Kurutkar 05-09-2011 08:42 AM

currently there is no service running on the port 7.
i checked it with netstat -tulpn | grep 7 but didnot get any service runningon port 7.


I have tried to add rule using iptables with below command:
iptables -A INPUT -d serverIP -p udp --dport 7 -j ACCEPT
but when i did iptables --list it is now showing me currently added rule .

I tried iptables-save but after that also it is not showing me the newly added rule .


Not getting any error as such.


for checking port 7 is open or not , I am doing telnet from different server of the same network " #telnet <server ip> 7 " but it is not working , do you know any other way to check this ?

gadhave.vikas 05-09-2011 10:55 AM

hye team,

information

Rakesh is from my team.......so consider his comments also

Rgds,
Vikas

Wim Sturkenboom 05-09-2011 11:27 AM

'telnet' is a tcp protocol, not a udp protocol. So you can't check using telnet.

If there is nothing listening on port 7, how do you now that it does not work?

gadhave.vikas 05-10-2011 05:26 AM

Hey,

I agree with you but newly added rules should reflect in iptables --list output.

i have one doubt is there possibilities of problem because of both fire wall are active...(sheorwall and iptables) ?

what will be the other ways to check the port is listening or not ( we have tried netstat -tulpn | grep prot number) but no success.

please suggest .

chrism01 05-11-2011 01:12 AM

There are 2 things to check on whether a port is 'open' and/or being used

1. netstat will tell you if a service is listening on port 7

2. iptables -nvL will show you if you have a rule that relates to port 7 ie even if there is a service there, can you get to it from the outside...

Wim Sturkenboom 05-11-2011 01:47 AM

Quote:

Originally Posted by gadhave.vikas (Post 4351882)
I agree with you but newly added rules should reflect in iptables --list output.

Point taken; not sure if you checked it.

Quote:

Originally Posted by gadhave.vikas (Post 4351882)
Hey,
I have one doubt is there possibilities of problem because of both fire wall are active...(sheorwall and iptables) ?

Shorewall is no firewall, but a front-end to iptables.

gadhave.vikas 05-11-2011 10:39 AM

need to open port number 7 on debian linux
 
Thanks Chrism01,

I check with provided command by you.
I able to see the rule with command "iptables -nvL" as below.
0 0 ACCEPT udp -- * * 0.0.0.0/0 (IP address) udp dpt:7

but when i tried to do the telnet System IP ADDRESS 7

i get nothing....

how can i check if it is working fine?

Rgds,
vikas

Wim Sturkenboom 05-11-2011 10:44 AM

You need to have something listening on that port. So write a little udp echo server and client (examples available on the net; maybe something from here.

And as said, telnet is a tcp protocol (not an udp protocol) so you can not use it.


All times are GMT -5. The time now is 03:42 AM.