ver validar servidor puertos puerto para ocupados comando abrir abiertos postgresql ubuntu port

postgresql - validar - Puerto abierto en Ubuntu



ver puertos abiertos linux netstat (3)

Edite /etc/postgresql/<version>/main/postgresql.conf y configure las listen_addresses de listen_addresses a su interfaz de salida o todas. Reinicie postgresql: sudo service postgresql restart .

Entonces estoy usando AWS usando EC2 y estoy tratando de abrir un puerto para Postgresql. En AWS ya lo tengo abierto:

TCP Port (Service) Source Action 0 - 65535 sg-92aadda2 (default) Delete 22 (SSH) 0.0.0.0/0 Delete 80 (HTTP) 0.0.0.0/0 Delete 5432 0.0.0.0/0 Delete

Cuando hago netstat parece que el puerto está escuchando:

# netstat -an | grep 5432 tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN

Cuando hago un nmap localhost obtengo lo siguiente:

Nmap scan report for localhost (127.0.0.1) Host is up (0.000010s latency). Not shown: 997 closed ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 5432/tcp open postgresql

Y aquí es donde comienza la diversión. Cuando hago un nmap desde un host alternativo obtengo lo siguiente:

PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 5432/tcp closed postgresql

También miré mis iptables para ver si me estaba perdiendo algo, pero las iptables se ven vacías (lo que debería significar que realmente no están haciendo mucho)

$ iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere REJECT all -- anywhere 127.0.0.0/8 reject-with icmp-port-unreachable ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere tcp dpt:http ACCEPT tcp -- anywhere anywhere tcp dpt:https ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh ACCEPT tcp -- anywhere anywhere tcp dpt:postgresql ACCEPT icmp -- anywhere anywhere LOG all -- anywhere anywhere limit: avg 5/min burst 5 LOG level debug prefix "iptables denied: " DROP all -- anywhere anywhere Chain FORWARD (policy ACCEPT) target prot opt source destination DROP all -- anywhere anywhere Chain OUTPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere

¿Me estoy perdiendo algo porque parece que no puedo averiguar cómo acceder a la IP? Cada vez que intento me sale el siguiente error:

Is the server running on host "xx.xx.xx.xx" and accepting TCP/IP connections on port 5432?

¿Cómo lo hago para que pueda abrir el puerto para que los servidores externos tengan acceso a él? Gracias de antemano =) Déjame saber si necesitas datos adicionales.

EDITAR : como se pregunta a continuación, probé telnetting y pude telnet al localhost, pero cuando intento desde el exterior obtengo:

$ telnet xx.xx.xx.xx 5432 Trying xx.xx.xx.xx... telnet: Unable to connect to remote host: Connection refused

Además, verifiqué dos veces y pude telnet a ssh:

$ telnet xx.xx.xx.xx 22 Trying xx.xx.xx.xx... Connected to xx.xx.xx.xx. Escape character is ''^]''. SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1


Me funciona el último método (thks Julio):

Editar: postgresql.conf

sudo nano /etc/postgresql/9.3/main/postgresql.conf

Habilitar o añadir:

listen_addresses = ''*''

Reinicie el motor de base de datos:

sudo service postgresql restart

Además, puedes consultar el archivo: pg_hba.conf

sudo nano /etc/postgresql/9.3/main/pg_hba.conf

Y añada su red o dirección de host:

host all all 192.168.1.0/24 md5


Si ha editado postgresql.conf y main / pg_hba.conf y aún tiene un problema, intente sudo ufw permita que 5432 / tcp desbloquee el puerto psql