How to open a port in ubuntu-server for local use?

Asked bynick dewilde

I want to test redis for python.

The test falls out with an error:

>>> import redis
>>> r = redis.Redis(host='localhost', port=6379, db=0)
>>> r.set('foo', 'bar')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/dist-packages/redis-2.2.4-py2.6.egg/redis/", line 556, in set
    return self.execute_command('SET', name, value)
  File "/usr/local/lib/python2.6/dist-packages/redis-2.2.4-py2.6.egg/redis/", line 254, in execute_command
  File "/usr/local/lib/python2.6/dist-packages/redis-2.2.4-py2.6.egg/redis/", line 242, in _execute_command
    self.connection.send(command, self)
  File "/usr/local/lib/python2.6/dist-packages/redis-2.2.4-py2.6.egg/redis/", line 54, in send
  File "/usr/local/lib/python2.6/dist-packages/redis-2.2.4-py2.6.egg/redis/", line 35, in connect
    raise ConnectionError(error_message)
redis.exceptions.ConnectionError: Error 111 connecting localhost:6379. Connection refused.

Intuitively, I understand that port 6379 should be opened, but I don’t know how to implement it.

Various manipulations with iptables that found on the forums did not help.

The micro-instans server itself on Amazon, there in the security-group this port is open to all ( by tcp / udp.


holly selph
& gt; redis.exceptions.ConnectionError: Error 111 connecting localhost: 6379. Connection refused.

there is nothing on port 6379 on this interface. iptables usually passes all packets through lo.
I use this option:
 iptables -A INPUT -i eth0 -p tcp --dport {PORT} -j ACCEPT
iptables -A INPUT -i eth0 -p tcp -m tcp --tcp-flags FIN,SYN,ACK SYN -j REJECT --reject-with icmp-port-unreachable
iptables -A FORWARD -o eth0 -p tcp -j DROP

 eth0 - interface.
Instead of the word {PORT} you write a port that is available for extr. At the same time, local ports (everything will work from localhost to localhost).
Using the example of Debian, type these lines in /etc/rc.local. If you have a connection via ssh or vnc - share the necessary ports! otherwise, when the rule is applied, you will close the access yourself :)
(!) The order of commands is important (at the beginning you open the port (s), and then you block everything).
did not work.
Some results achieved after screwing rinetd. - chase blackwood
log files at home? :: & quot; Internet retarder & quot; Is there such a browser plugin? :: Developer Tracking :: Firefox: tracking browser actions :: The script of the online auto parts store
Leave Repply forHow to open a port in ubuntu-server for local use?
Useful Links