Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So, I have these rules set in iptables:

# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp dpts:6850:6999
ACCEPT     udp  --  anywhere             anywhere             udp dpts:6850:6999
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:6881

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Although, the ports are not open :/ here is a telnet attempt:

# telnet localhost 6999
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

Any idea why this is happening? Do I need to reboot or do someone to make the changes permanent? Last time I rebooted the rules disappeared from iptables :/

share|improve this question
    
Show the output of netstat -ntlp | grep 6999. –  Ansgar Wiechers Sep 2 '12 at 18:08
    
It does not output anything –  King Sep 2 '12 at 18:13
    
Then you have no process listening on port 6999/tcp, which in turn causes the TCP/IP stack to reject the connection attempt. This behavior is by design. –  Ansgar Wiechers Sep 2 '12 at 18:18
    
oh, I am running multiple rTorrent daemons, which should use ports 6881 to 6999 for listening for bitorrent traffic, but it too says the ports are closed, any idea what I need to do? –  King Sep 2 '12 at 18:23
    
Try connecting to a port that actually does have something listening on it and see what result you get then. –  Ansgar Wiechers Sep 2 '12 at 18:36

1 Answer 1

up vote 0 down vote accepted

I have found the problem after all this time :P as I said I was running multiple daemons trying to listen on port 6881, well obviously, only one daemon can listen on that port. So all I had to do was assign a different port to each daemon. :P

share|improve this answer
    
I'm quite scared that nobody seemed to have noticed that your iptables policies aren't actually doing anything. No matter what port you use, connections will be allowed. –  gparent Nov 13 '12 at 16:47
    
Oh and the reason for this is that your default policy is ACCEPT, and none of your other rules within each chain deny anything. –  gparent Nov 13 '12 at 16:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.