Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Fedora I tried to access port 1521, so I opened the following port on my firewall:

$ sudo iptables -I INPUT -i eth0 -p tcp -m tcp --dport 1521 -j ACCEPT
$ sudo service iptables save

I then tried to telnet to my inner IP (the IP that the router gave me) and got connection refused:

$ telnet 1521

telnet: connect to address Connection refused

I then tried to telnet to my internet IP and didn't get any response:

$ telnet x.x.x.x 1521
Trying x.x.x.x...

As far as I can tell, I've opened my port on the router also, BTW, I also tried it with port 22 and got the same result.

share|improve this question
you may have better luck on Server Fault. – strugee Jul 28 '13 at 22:34
is there actually a listening socket on that port? netstat -tnl | grep :1521 – Wumpus Q. Wumbley Jul 28 '13 at 22:47
yes there is, oracle listener – nir Jul 29 '13 at 8:17

I would try something like this. I don't believe the -m switch can take the argument tcp.

Based on the state of the connection being "new":

$ iptables -A INPUT -m state --state NEW -p tcp --dport 1521 -j ACCEPT

Accept any connections on port 1521:

$ iptables -I INPUT -p tcp --dport 1521 -j ACCEPT

Also is there a daemon listening on this port 1521?

share|improve this answer
didnt helped. there is an oracle listener, i'm trying telnet and also tnsping. – nir Jul 29 '13 at 8:20
Can you telnet localhost 1521 on the actual host running Oracle? – slm Jul 29 '13 at 11:48
Yes I can, and also is good. but not the internet ip – nir Jul 29 '13 at 12:21
@nir - then your issue likely lies with the router. It doesn't appear to be forwarding traffic correctly to port 1521 on host What you have here is all you need to do to accept the traffic on port 1521 on the linux box's firewall. – slm Jul 29 '13 at 19:10
ok i'll continue digging, thanks anyway – nir Jul 29 '13 at 19:53

Your Answer


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.