1

I have created Red Hat VM in Microsoft Azure and able to connect via ssh.

I have started Java server in VM with port 8081 and it started successfully. But I am not able view it in browser. Its doesn't get loaded.

I have tried the following and but all doesn't get loaded:-

host:80
host:8080
host:8081

I have added Inbound security rule in Network security Group and associated subnet to it. Still I am not able view my server in browser.

I have followed this document for inbound security rule

Here is my inbound ruleenter image description here

netstat -tuplen

(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name 
tcp 0 0 127.0.0.1:29131 0.0.0.0:* LISTEN 0 20864 - 
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 0 13894 - 
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 18132 - 
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 994 19499 - 
tcp6 0 0 :::111 :::* LISTEN 0 13893 - 
tcp6 0 0 :::8081 :::* LISTEN 1000 28721 3212/java 
tcp6 0 0 :::22 :::* LISTEN 0 18143 - 
tcp6 0 0 :::9080 :::* LISTEN 1000 28547 3212/java 
udp 0 0 0.0.0.0:68 0.0.0.0:* 0 16585 - 
udp 0 0 0.0.0.0:111 0.0.0.0:* 0 23825 - 
udp 0 0 127.0.0.1:323 0.0.0.0:* 995 15601 - 
udp 0 0 0.0.0.0:45876 0.0.0.0:* 0 16574 - 
udp 0 0 0.0.0.0:893 0.0.0.0:* 0 23826 - 
udp6 0 0 :::57126 :::* 0 16575 - 
udp6 0 0 :::111 :::* 0 23827 - 
udp6 0 0 ::1:323 :::* 995 15602 - 
udp6 0 0 :::893 :::* 0 23828 - 

ss -tln

State Recv-Q Send-Q Local Address:Port Peer Address:Port 
LISTEN 0 10 127.0.0.1:29131 *:* 
LISTEN 0 128 *:111 *:* 
LISTEN 0 128 *:22 *:* 
LISTEN 0 128 127.0.0.1:27017 *:* 
LISTEN 0 128 :::111 :::* 
LISTEN 0 50 :::8081 :::* 
LISTEN 0 128 :::22 :::* 
LISTEN 0 50 :::9080 :::* 
Galet
  • 5,853
  • 21
  • 82
  • 148

1 Answers1

2

According to your screenshot, I notice that your service is listening on tcp6. Based on my knowledge, if the port only provides ipv6 service, you could not use IPv4 address to access.

I notice that you use jetty container, jetty use IPv6 by default. You could allow jetty force to use IPv4. There is a good answer about this.

Community
  • 1
  • 1
Shui shengbao
  • 18,746
  • 3
  • 27
  • 45
  • Hi, maybe you could try to test by using localhost. `telnet 127.0.0.1 8081` – Shui shengbao Dec 23 '16 at 05:37
  • I am able to get response when I hit curl http://localhost:8081 in my VM. I believe Opening port is problem. – Galet Dec 23 '16 at 05:41
  • According to your screenshot, I notice that your service is listening on tcp6. Based on my knowledge, if the port only provides ipv6 service, you could not use ipv4 IP to access. `localhost` is a ipv4 address. – Shui shengbao Dec 23 '16 at 05:48
  • What should I change in Inbound Security Rule to make it to work ? – Galet Dec 23 '16 at 05:51
  • You not need to modify NSG rules. For now, the public IPv6 addresses cannot be assigned to a VM. They can only be assigned to a load balancer. I will update my answer. – Shui shengbao Dec 23 '16 at 05:55
  • Let us chat http://chat.stackoverflow.com/rooms/131322/discussion-between-walter-msft-and-karan – Galet Dec 23 '16 at 09:42
  • I have followed the below steps and able to view the running Java server in browser. But when Azure VM has stopped, Java server is stopped. When I start VM and then Java Server, I am not able to view my running Java server in browser. sudo yum install iptables-services sudo iptables -I INPUT -p tcp --dport 8081 -j ACCEPT sudo iptables -I INPUT -p tcp --dport 22 -j ACCEPT sudo service iptables save When I add again policy in iptables, I am able to view my running Java server in browser. Why should I add my policy everytime when I restart, policy is already present in iptables ? – Galet Dec 27 '16 at 05:27
  • Do you save iptables rules? `/sbin/service iptables save` – Shui shengbao Dec 27 '16 at 05:31
  • iptables rules will lose if you don't save them. – Shui shengbao Dec 27 '16 at 05:33
  • Both commands are doing same thing. Refer below sudo service iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ] sudo sudo service iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ] I will restart VM and check again. – Galet Dec 27 '16 at 05:36