Ativar porta TCP

1. Ativar porta TCP

Perfil removido
removido

(usa Nenhuma)

Enviado em 01/05/2015 - 23:11h

Olá,

Preciso "ouvir" a porta 5005, esta assim:

tcp6 0 0 :::5005 :::* OUÇA

Qual comando pra ativar?

Agradeço ajuda


  


2. Re: Ativar porta TCP

Perfil removido
removido

(usa Nenhuma)

Enviado em 01/05/2015 - 23:33h

Ola, poderia explicar melhor isto?

Este ouvir é capturar os pacotes que passarem por ela ou quer ativar um serviço nesta porta?

Se quiser capturar os pacotes, pode usar o tcpdump ou wireshark:
http://www.vivaolinux.com.br/dica/tcpdump-Monitorando-conexoes

Aqui ele mostra como capturar com o tcpdump e abrir no wireshark para facilitar a analise.
https://under-linux.org/entry.php?b=2969

*O ativar soa estranho, pois para ativar algo nela, teria que executar algum programa ou serviço que a utilize e você teria que de antemão saber qual é, a menos que ele ja esteja rodando e precisa abrir uma porta no firewall, mas ai não corresponde com o que passou.
------------------------------------------------------
¿? -> keyboard Error: No Keyboard Present, PRESS F1 to continue.



3. Re: Ativar porta TCP

Perfil removido
removido

(usa Nenhuma)

Enviado em 01/05/2015 - 23:50h

Então é que tenho um app Android e um servidor e esta acontecendo uma falha de comunicação.
Preciso da porta 5005 aberta, por isso a pergunta, usei o comando netstat -nputl para ver as portas.

Então entendi que a porta 5005 não esta ativada pq aparece:

tcp6 0 0 :::5005 :::* OUÇA

Esta certo o comando abaixo?

iptables -A INPUT -p tcp --dport 5005 -j ACCEPT


http://www.hardware.com.br/dicas/firewall-ubuntu.html


4. Re: Ativar porta TCP

Perfil removido
removido

(usa Nenhuma)

Enviado em 01/05/2015 - 23:56h

zeli escreveu:

Então é que tenho um app Android e um servidor e esta acontecendo uma falha de comunicação.
Preciso da porta 5005 aberta, por isso a pergunta, usei o comando netstat -nputl para ver as portas.

Então entendi que a porta 5005 não esta ativada pq aparece:

tcp6 0 0 :::5005 :::* OUÇA

Esta certo o comando abaixo?

iptables -A INPUT -p tcp --dport 5005 -j ACCEPT


http://www.hardware.com.br/dicas/firewall-ubuntu.html


Esta, mas você tem um firewall ativo?

consegue conexão local nesta porta com o telnet?

Que serviço/programa esta rodando nesta porta(Não esta na lista de serviços "conhecidos")?

------------------------------------------------------
¿? -> keyboard Error: No Keyboard Present, PRESS F1 to continue.



5. Re: Ativar porta TCP

Perfil removido
removido

(usa Nenhuma)

Enviado em 02/05/2015 - 00:04h


Pra ver se o firewall esta ativo é só digitar: iptables -L?

Se for aparentemente esta ativado, aparece uma lista, mas não consigo ter certeza se são regras.

Sobre o telnet, como faz o teste no ubuntu?



6. Re: Ativar porta TCP

Perfil removido
removido

(usa Nenhuma)

Enviado em 02/05/2015 - 00:24h

zeli escreveu:


Pra ver se o firewall esta ativo é só digitar: iptables -L?

Se for aparentemente esta ativado, aparece uma lista, mas não consigo ter certeza se são regras.

Sobre o telnet, como faz o teste no ubuntu?


Igual no windows telnet <IP ou nome-da-maquina> <porta>:

Como esta na própria maquina:

telnet localhost 5005


Coso não tenha o telnet instalado:


sudo apt-get update; sudo apt-get install telnet


*QUe programa esta testando? O que exatamente não esta funcionado?


Na duvida, poste o resultado do

 sudo  iptables -L  

------------------------------------------------------
¿? -> keyboard Error: No Keyboard Present, PRESS F1 to continue.



7. Re: Ativar porta TCP

Perfil removido
removido

(usa Nenhuma)

Enviado em 02/05/2015 - 00:30h


ah desculpa telnet, seria util se tivesse outro pc na rede né?

Quando as portas que estão sendo usadas pelo comando netstat -nt não aparece nenhuma vez a porta 5005


8. Re: Ativar porta TCP

Perfil removido
removido

(usa Nenhuma)

Enviado em 02/05/2015 - 00:37h

É um sistema de localização gps.
O servidor não esta recebendo a comunicação do dispositivo movel, por padrão é usada a porta 5005, provavelmente por causa da porta não estar aberta não esta acontecendo a comunicação




9. Re: Ativar porta TCP

Perfil removido
removido

(usa Nenhuma)

Enviado em 02/05/2015 - 00:59h

zeli escreveu:


ah desculpa telnet, seria util se tivesse outro pc na rede né?

Quando as portas que estão sendo usadas pelo comando netstat -nt não aparece nenhuma vez a porta 5005

Seria sim, mas existindo conexão local ja identificara ao menos se ele esta funcionando:

tente:
Verificar se o programa esta rodando:

no terminal como root:

ps aux | grep nome-processo
netstat -lnutp <--- Para ter certeza que ele não esta rodando ouvindo outra porta
netstat -lnutp | grep 5005
telnet localhost 5005


*Outra coisa é saber qual é o software, se ele não tem algum arquivo de log.

*Qual o nome do programa?


------------------------------------------------------
¿? -> keyboard Error: No Keyboard Present, PRESS F1 to continue.



10. Re: Ativar porta TCP

Perfil removido
removido

(usa Nenhuma)

Enviado em 02/05/2015 - 02:00h

O nome do programa é Traccar www.traccar.org

Resultado para o primeiro comando

"ps aux | grep traccar" aparece:

root      1211  0.0  0.0  11420  1280 ?        Sl   00:12   0:02 /opt/traccar/bin/./wrapper /opt/traccar/bin/../conf/wrapper.conf wrapper.syslog.ident=traccar wrapper.pidfile=/opt/traccar/bin/./traccar.pid wrapper.name=traccar wrapper.displayname=traccar wrapper.daemonize=TRUE wrapper.statusfile=/opt/traccar/bin/./traccar.status wrapper.java.statusfile=/opt/traccar/bin/./traccar.java.status wrapper.script.version=3.5.26
root 1227 0.8 5.2 789596 108588 ? Sl 00:12 0:28 /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java -Djava.library.path=../lib -classpath ../lib/wrapper.jar:../tracker-server.jar -Dwrapper.key=_loDMPznbCjp4Sk9 -Dwrapper.port=32000 -Dwrapper.disable_console_input=TRUE -Dwrapper.pid=1211 -Dwrapper.version=3.5.26 -Dwrapper.native_library=wrapper -Dwrapper.arch=x86 -Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp org.traccar.Main /opt/traccar/conf/traccar.cfg
root 5413 0.0 0.0 4700 828 pts/0 S+ 01:11 0:00 grep --color=auto traccar


para netstat -lnutp traccar não aparece nenhuma vez, embora que esta rodando normal, só não esta fazendo a comunicação.

netstat -lnutp | grep 5005 resultado:

tcp6       0      0 :::5005                 :::*                    OUÇA       
1227/java


resultado para telnet localhost 5005
Trying ::1...
Connected to localhost.
Escape character is '^]'.




11. Re: Ativar porta TCP

Perfil removido
removido

(usa Nenhuma)

Enviado em 03/05/2015 - 14:13h

Pelo retorno do telnet, ele esta aceitando a conexão.

Para saber sobre o firewall (Supondo que esta com o Ubuntu):


ufw status

Se estiver ativo, desabilite(Para teste) com:

ufw disable


Para ver se tem alguma regra do iptables (Por padrão não tem), onde tera uma saída como a abaixo(Se tiver algo diferente, poste):

iptables -L

Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination




Caso tenha algo e queira limpar para testar:

iptables -F




*Mais sobre o UFW:
http://wiki.ubuntu-br.org/UFW

------------------------------------------------------
¿? -> keyboard Error: No Keyboard Present, PRESS F1 to continue.



12. Re: Ativar porta TCP

Perfil removido
removido

(usa Nenhuma)

Enviado em 03/05/2015 - 20:30h

Comando iptables -L
XXX.XXX.XXX.XXX -> alterei ips que apareciam


iptables v1.4.21: can't initialize iptables table `filter': Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.
gisele@gisele-computador:~$ su
Senha:
root@gisele-computador:/home/gisele# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ufw-before-logging-input all -- anywhere anywhere
ufw-before-input all -- anywhere anywhere
ufw-after-input all -- anywhere anywhere
ufw-after-logging-input all -- anywhere anywhere
ufw-reject-input all -- anywhere anywhere
ufw-track-input all -- anywhere anywhere

Chain FORWARD (policy DROP)
target prot opt source destination
ufw-before-logging-forward all -- anywhere anywhere
ufw-before-forward all -- anywhere anywhere
ufw-after-forward all -- anywhere anywhere
ufw-after-logging-forward all -- anywhere anywhere
ufw-reject-forward all -- anywhere anywhere
ufw-track-forward all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ufw-before-logging-output all -- anywhere anywhere
ufw-before-output all -- anywhere anywhere
ufw-after-output all -- anywhere anywhere
ufw-after-logging-output all -- anywhere anywhere
ufw-reject-output all -- anywhere anywhere
ufw-track-output all -- anywhere anywhere

Chain ufw-after-forward (1 references)
target prot opt source destination

Chain ufw-after-input (1 references)
target prot opt source destination
ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:netbios-ns
ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:netbios-dgm
ufw-skip-to-policy-input tcp -- anywhere anywhere tcp dpt:netbios-ssn
ufw-skip-to-policy-input tcp -- anywhere anywhere tcp dpt:microsoft-ds
ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:bootps
ufw-skip-to-policy-input udp -- anywhere anywhere udp dpt:bootpc
ufw-skip-to-policy-input all -- anywhere anywhere ADDRTYPE match dst-type BROADCAST

Chain ufw-after-logging-forward (1 references)
target prot opt source destination
LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-after-logging-input (1 references)
target prot opt source destination
LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-after-logging-output (1 references)
target prot opt source destination

Chain ufw-after-output (1 references)
target prot opt source destination

Chain ufw-before-forward (1 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere icmp destination-unreachable
ACCEPT icmp -- anywhere anywhere icmp source-quench
ACCEPT icmp -- anywhere anywhere icmp time-exceeded
ACCEPT icmp -- anywhere anywhere icmp parameter-problem
ACCEPT icmp -- anywhere anywhere icmp echo-request
ufw-user-forward all -- anywhere anywhere

Chain ufw-before-input (1 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ufw-logging-deny all -- anywhere anywhere ctstate INVALID
DROP all -- anywhere anywhere ctstate INVALID
ACCEPT icmp -- anywhere anywhere icmp destination-unreachable
ACCEPT icmp -- anywhere anywhere icmp source-quench
ACCEPT icmp -- anywhere anywhere icmp time-exceeded
ACCEPT icmp -- anywhere anywhere icmp parameter-problem
ACCEPT icmp -- anywhere anywhere icmp echo-request
ACCEPT udp -- anywhere anywhere udp spt:bootps dpt:bootpc
ufw-not-local all -- anywhere anywhere
ACCEPT udp -- anywhere XXX.XXX.XXX.XXX udp dpt:mdns
ACCEPT udp -- anywhere XXX.XXX.XXX.XXX udp dpt:1900
ufw-user-input all -- anywhere anywhere

Chain ufw-before-logging-forward (1 references)
target prot opt source destination

Chain ufw-before-logging-input (1 references)
target prot opt source destination

Chain ufw-before-logging-output (1 references)
target prot opt source destination

Chain ufw-before-output (1 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
ufw-user-output all -- anywhere anywhere

Chain ufw-logging-allow (0 references)
target prot opt source destination
LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW ALLOW] "

Chain ufw-logging-deny (2 references)
target prot opt source destination
RETURN all -- anywhere anywhere ctstate INVALID limit: avg 3/min burst 10
LOG all -- anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "

Chain ufw-not-local (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere ADDRTYPE match dst-type LOCAL
RETURN all -- anywhere anywhere ADDRTYPE match dst-type MULTICAST
RETURN all -- anywhere anywhere ADDRTYPE match dst-type BROADCAST
ufw-logging-deny all -- anywhere anywhere limit: avg 3/min burst 10
DROP all -- anywhere anywhere

Chain ufw-reject-forward (1 references)
target prot opt source destination

Chain ufw-reject-input (1 references)
target prot opt source destination

Chain ufw-reject-output (1 references)
target prot opt source destination

Chain ufw-skip-to-policy-forward (0 references)
target prot opt source destination
DROP all -- anywhere anywhere

Chain ufw-skip-to-policy-input (7 references)
target prot opt source destination
DROP all -- anywhere anywhere

Chain ufw-skip-to-policy-output (0 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere

Chain ufw-track-forward (1 references)
target prot opt source destination

Chain ufw-track-input (1 references)
target prot opt source destination

Chain ufw-track-output (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere ctstate NEW
ACCEPT udp -- anywhere anywhere ctstate NEW

Chain ufw-user-forward (1 references)
target prot opt source destination

Chain ufw-user-input (1 references)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:webmin
ACCEPT udp -- anywhere anywhere udp dpt:10000

Chain ufw-user-limit (0 references)
target prot opt source destination
LOG all -- anywhere anywhere limit: avg 3/min burst 5 LOG level warning prefix "[UFW LIMIT BLOCK] "
REJECT all -- anywhere anywhere reject-with icmp-port-unreachable

Chain ufw-user-limit-accept (0 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere

Chain ufw-user-logging-forward (0 references)
target prot opt source destination

Chain ufw-user-logging-input (0 references)
target prot opt source destination

Chain ufw-user-logging-output (0 references)
target prot opt source destination

Chain ufw-user-output (1 references)
target prot opt source destination









Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts