How can find out what ports are open in my system
Hi all,
I'm quite new to linux and I would really appreciate your help with the following: I'm using BitTorrent for downloads, but it is extremely slow in my Linux box. I found some threads where they mentioned that some ports need to be opened to improve the performance especially when there are multiple downloads. My questions are, how can I find out what ports are open in my linux box? and how can I open certain ports? Many thanks in advance for your help. Linuxlainen |
Well if you are talking about bittorrent you will want to see if your firewall is blocking your specific ports. Do you have a firewall turned on? It would help to know your distro type. on the command line you can type "/sbin/iptables -L" to show the rules. Certain distros come with a GUI application where you can view it in a more readable form. Also, do you have a router that you use to connect to the internet with? I've read it helps to forward the ports (6881-6889 i believe) to your computer running BT.
There is also a command "netstat -pant" that will show the open ports, but it does not consider the firewall. So it can show an open port but a firewall can still be blocking it. |
yeah, you need to check your firewall rules... let us know if you are behind a dedicated router or if this is a directly connected box... either way, the key is the firewall rules... checking to see if your ports are "open" won't work, because ports appear as closed when not in use...
so basically, the first thing you wanna do is tell us if you're behind a router... if not, then post the output of the command benjithegreat98 posted... or better yet, make it a little more thorough: Code:
iptables -L -n -v |
I'm using Mandriva 2006. I think the firewall I have is Interactive Firewall as I keep on getting warning pop up messages from it about being port scanned :mad:
As for my connection to the internet, my linux box is connected through ADSL Router, which I have not changed any of its configurations. I have applied the command iptables -L and here is what I got: PHP Code:
So, how am I supposed to proceed now? Thank you so much for your help Linuxlainen |
it would have been much easier to comprehend your rules if you would have added the -n and -v...
having said that, what kinda stuff are you doing on this box?? :confused: i'm trying to understand why you'd have such complicated rules... either way, this command would open the ports you need: Code:
iptables -I INPUT -p TCP -i $WAN_IFACE --dport 6881:6889 -j ACCEPT |
Unfortuneatley I don't know Mandriva so well, but basically you need to go through the menu on the task bar and look for the firewall config program because you do have the firewall running. It's probably called Interactive Firewall. If you can't find it try posting in the Mandriva forum on how to get to it.
Once you are in you need to find where you can allow ports 6881-6889. They might refer to them as exceptions. Then apply your changes. Next you need to get into your DSL Router. Open up a webbrowser and go to the address of your gateway. Many times it is 192.168.1.1 or 192.168.100.1. If you need help figuring that out let us know. If you've never set a password in there it is probably 'admin' for both the username and password. Once you are in you should look for a way to do "Port Forwarding". If it doesn't call it that it might refer to it as "applications". That varies from router to router. Once there you need to Forward ports 6881-6889 to your ip address. If you need help finding out your IP address let us know on that too. Let us know if you run into anything. Good luck! |
Looking through the firewall output you sent, it occurs to me that you might want to look for a program called "Shorewall"
It looks like shorewall is the program that generated the firewall rules which would explain why they are as complex as they are. If you can't find it go to the command line and type 'shorewall' if that doesn't work try '/sbin/shorewall' and '/usr/sbin/shorewall' |
Thank you all for your help,
I have done the port forwarding on my router and it seems to be working fine. However the command Code:
iptables -I INPUT -p TCP -i $WAN_IFACE --dport 6881:6889 -j ACCEPT Quote:
Quote:
Quote:
|
for the iptables command do this:
Code:
iptables -I INPUT -p TCP -i eth0 --dport 6881:6889 -j ACCEPT You can put that in a script that will start up with Mandriva (/etc/rc.d/rc.local is one such file) or you can find the program in the menu that will let you add the ports to your configuration. I would look for that if you can. Or another thing you can do is find the shorewall configuration file and edit that, but that will take a skill level that may be a little over you so I wouldn't recommend it. |
Thanks a lot benjithegreat98. My BitTorrent speed jumped from 3kb/s to 180kb/s. This is just GREATE.
One last thing, I have applied the command you gave to open the port and I also found the SW where I can configure my firewall (it is under system configuration --> Security --> Setup personal firewall...), how can I know that these ports are open after I reboot the system? What is the command that would list the open ports? Many thanks again Linuxlainen |
If you put the ports 6881-6889 to be open in the 'setup personal firewall' and save it, then it should be applied even when you reboot. I don't have Mandriva so unfortunately I can't walk you through how to do that.....
The command to list the open ports is iptables -L -n -v. I would just reboot and see if it is still listed in the 'personal firewall' program. 180kb/s? I'm jealous :) I never get that fast. |
All times are GMT -5. The time now is 03:33 AM. |