Não é possível acessar o tomcat no servidor linux remoto

1

Eu tenho um servidor linux remoto em 192.168.168.1 (máscara de sub-rede / 24) que tem o tomcat instalado e funcionando. Eu sei que está sendo executado porque quando eu SSH para ele e fazer "wget localhost: 8080" eu recebo:

Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:8080... connected.
HTTP request sent, awaiting response... 200
Length: unspecified [text/html]
Saving to: ‘index.html.1’

    [ <=>                                   ] 11,230      --.-K/s   in 0s

2018-07-05 15:37:21 (184 MB/s) - ‘index.html.1’ saved [11230]

Minha máquina windows local está na mesma rede com um endereço ip de 192.168.168.2, e quando eu abro um navegador e digito "192.168.168.1:8080" na barra de url, ele me diz depois de um tempo que o a conexão expirou.

Eu posso pingar o servidor linux da minha máquina Windows sem problemas.

Eu também editei meu iptables para permitir conexões de entrada da porta 8080; aqui está o resultado de "sudo iptables -L -v":

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination 
    0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp dpt:webcache
    0     0 ACCEPT     udp  --  virbr0 any     anywhere             anywhere             udp dpt:domain
    0     0 ACCEPT     tcp  --  virbr0 any     anywhere             anywhere             tcp dpt:domain
    0     0 ACCEPT     udp  --  virbr0 any     anywhere             anywhere             udp dpt:bootps
    0     0 ACCEPT     tcp  --  virbr0 any     anywhere             anywhere             tcp dpt:bootps
17974   11M ACCEPT     all  --  any    any     anywhere             anywhere             ctstate RELATED,ESTABLISHED
   14   863 ACCEPT     all  --  lo     any     anywhere             anywhere    
 288K   30M INPUT_direct  all  --  any    any     anywhere             anywhere 
 288K   30M INPUT_ZONES_SOURCE  all  --  any    any     anywhere             anywhere
 288K   30M INPUT_ZONES  all  --  any    any     anywhere             anywhere  
    0     0 DROP       all  --  any    any     anywhere             anywhere             ctstate INVALID
 288K   30M REJECT     all  --  any    any     anywhere             anywhere             reject-with icmp-host-prohibited
    0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere             state NEW tcp dpt:webcache
    0     0 ACCEPT     tcp  --  any    any     anywhere             anywhere             state NEW tcp dpt:http

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination 
    0     0 ACCEPT     all  --  any    virbr0  anywhere             192.168.122.0/24     ctstate RELATED,ESTABLISHED
    0     0 ACCEPT     all  --  virbr0 any     192.168.122.0/24     anywhere    
    0     0 ACCEPT     all  --  virbr0 virbr0  anywhere             anywhere    
    0     0 REJECT     all  --  any    virbr0  anywhere             anywhere             reject-with icmp-port-unreachable
    0     0 REJECT     all  --  virbr0 any     anywhere             anywhere             reject-with icmp-port-unreachable
    0     0 ACCEPT     all  --  any    any     anywhere             anywhere             ctstate RELATED,ESTABLISHED
    0     0 ACCEPT     all  --  lo     any     anywhere             anywhere    
    0     0 FORWARD_direct  all  --  any    any     anywhere             anywhere
    0     0 FORWARD_IN_ZONES_SOURCE  all  --  any    any     anywhere             anywhere
    0     0 FORWARD_IN_ZONES  all  --  any    any     anywhere             anywhere
    0     0 FORWARD_OUT_ZONES_SOURCE  all  --  any    any     anywhere             anywhere
    0     0 FORWARD_OUT_ZONES  all  --  any    any     anywhere             anywhere
    0     0 DROP       all  --  any    any     anywhere             anywhere             ctstate INVALID
    0     0 REJECT     all  --  any    any     anywhere             anywhere             reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT 73 packets, 7176 bytes)
 pkts bytes target     prot opt in     out     source               destination 
    0     0 ACCEPT     udp  --  any    virbr0  anywhere             anywhere             udp dpt:bootpc
12493 1460K OUTPUT_direct  all  --  any    any     anywhere             anywhere

Chain FORWARD_IN_ZONES (1 references)
 pkts bytes target     prot opt in     out     source               destination 
    0     0 FWDI_public  all  --  ens32  any     anywhere             anywhere            [goto]
    0     0 FWDI_public  all  --  +      any     anywhere             anywhere            [goto]

Chain FORWARD_IN_ZONES_SOURCE (1 references)
 pkts bytes target     prot opt in     out     source               destination 

Chain FORWARD_OUT_ZONES (1 references)
 pkts bytes target     prot opt in     out     source               destination 
    0     0 FWDO_public  all  --  any    ens32   anywhere             anywhere            [goto]
    0     0 FWDO_public  all  --  any    +       anywhere             anywhere            [goto]

Chain FORWARD_OUT_ZONES_SOURCE (1 references)
 pkts bytes target     prot opt in     out     source               destination 

Chain FORWARD_direct (1 references)
 pkts bytes target     prot opt in     out     source               destination 

Chain FWDI_public (2 references)
 pkts bytes target     prot opt in     out     source               destination 
    0     0 FWDI_public_log  all  --  any    any     anywhere             anywhere
    0     0 FWDI_public_deny  all  --  any    any     anywhere             anywhere
    0     0 FWDI_public_allow  all  --  any    any     anywhere             anywhere
    0     0 ACCEPT     icmp --  any    any     anywhere             anywhere    

Chain FWDI_public_allow (1 references)
 pkts bytes target     prot opt in     out     source               destination 

Chain FWDI_public_deny (1 references)
 pkts bytes target     prot opt in     out     source               destination 

Chain FWDI_public_log (1 references)
 pkts bytes target     prot opt in     out     source               destination 

Chain FWDO_public (2 references)
 pkts bytes target     prot opt in     out     source               destination 
    0     0 FWDO_public_log  all  --  any    any     anywhere             anywhere
    0     0 FWDO_public_deny  all  --  any    any     anywhere             anywhere
    0     0 FWDO_public_allow  all  --  any    any     anywhere             anywhere

Chain FWDO_public_allow (1 references)
 pkts bytes target     prot opt in     out     source               destination 

Chain FWDO_public_deny (1 references)
 pkts bytes target     prot opt in     out     source               destination 

Chain FWDO_public_log (1 references)
 pkts bytes target     prot opt in     out     source               destination 

Chain INPUT_ZONES (1 references)
 pkts bytes target     prot opt in     out     source               destination 
 288K   30M IN_public  all  --  ens32  any     anywhere             anywhere            [goto]
    9  1863 IN_public  all  --  +      any     anywhere             anywhere            [goto]

Chain INPUT_ZONES_SOURCE (1 references)
 pkts bytes target     prot opt in     out     source               destination 

Chain INPUT_direct (1 references)
 pkts bytes target     prot opt in     out     source               destination 

Chain IN_public (2 references)
 pkts bytes target     prot opt in     out     source               destination 
 288K   30M IN_public_log  all  --  any    any     anywhere             anywhere
 288K   30M IN_public_deny  all  --  any    any     anywhere             anywhere
 288K   30M IN_public_allow  all  --  any    any     anywhere             anywhere
    9   504 ACCEPT     icmp --  any    any     anywhere             anywhere    

Chain IN_public_allow (1 references)
 pkts bytes target     prot opt in     out     source               destination 
    6   312 ACCEPT     tcp  --  any    any     anywhere             anywhere             tcp dpt:ssh ctstate NEW

Chain IN_public_deny (1 references)
 pkts bytes target     prot opt in     out     source               destination 

Chain IN_public_log (1 references)
 pkts bytes target     prot opt in     out     source               destination 

Chain OUTPUT_direct (1 references)
 pkts bytes target     prot opt in     out     source               destination

Existe algo que eu preciso configurar em relação ao servidor tomcat / linux para que eu possa chamar o tomcat da minha máquina local?

    
por Don Abrams 06.07.2018 / 01:42

1 resposta

1

Talvez o tomcat esteja ouvindo apenas conexões de um determinado ip, provavelmente o localhost. Você pode executar netstat -lntu e obterá algo assim na quinta coluna:

        *:22
127.0.0.1:80

O primeiro indica que ele está escutando conexões de qualquer IP e o segundo apenas da máquina local (o próprio servidor). Se o tomcat estiver atendendo somente no host local, você deverá configurar o IP no arquivo tomcat/conf/server.xml para 0.0.0.0 . Assim:

<Connector 
  port="8080"
  address="0.0.0.0"
  ...
/>

Desculpe por postar uma resposta para algo que pode não ser a solução. Eu gostaria de comentar se pudesse.

    
por 06.07.2018 / 01:55

Tags