Search code examples
reactjscentos7create-react-app

Can't access create-app-react app via local network


I have a problem accessing default react page from browser. React app is started on VM, that attached to Host OS via bridged network.

Network settings on VM (CentOS 7)

2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:ef:79:7b brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.18/24 brd 192.168.2.255 scope global noprefixroute dynamic ens33
       valid_lft 19371sec preferred_lft 19371sec
    inet6 fe80::da52:a805:4b32:ca69/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

Network settings on Host OS (Windows 10)

   Description. . . . . . . . . . . . . : Intel(R) Dual Band Wireless-AC 7265
   MAC Address. . . . . . . . . : 7C-B0-C2-DF-7F-F5
   DHCP enabled. . . . . . . . . . . : Yes
   IPv4-address. . . . . . . . . . . . : 192.168.2.12(Primary)
   Network Mask. . . . . . . . . . : 255.255.255.0
   Default-gateway. . . . . . . . . : 192.168.2.1
   DHCP-server. . . . . . . . . . . : 192.168.2.1
   DNS-server. . . . . . . . . . . : 192.168.2.1
   NetBios TCP/IP. . . . . . . . : Enabled

I can ping VM address from host OS without problem (Russian letters, sorry)

C:\Users\vud>ping 192.168.2.18

    Обмен пакетами с 192.168.2.18 по с 32 байтами данных:
    Ответ от 192.168.2.18: число байт=32 время<1мс TTL=64
    Ответ от 192.168.2.18: число байт=32 время<1мс TTL=64
    Ответ от 192.168.2.18: число байт=32 время<1мс TTL=64

So I created a test frontend project on VM:

[vud@centos~] create-app-react frontend

From the frontend directory I'm starting command:

[vud@centos frontend]$ npm start

Which tells me that server started successfully:

Compiled successfully!

You can now view frontend in the browser.

  Local:            http://localhost:3000
  On Your Network:  http://192.168.2.18:3000

Note that the development build is not optimized.
To create a production build, use npm run build.

But I can't access it from the Windows 10's browser, getting a connection timeout

It is interesting, though, cause I can curl the page content from VM:

curl output

So, I also checked traffic on port 3000 with tcpdump while trying to access react page via browser from host OS:

[vud@centos frontend]$ sudo tcpdump -i ens33 host 192.168.2.12 and port 3000 
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on ens33, link-type EN10MB (Ethernet), capture size 262144 bytes
21:36:09.886531 IP 192.168.2.12.56517 > centos.hbci: Flags [S], seq 2766461791, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
21:36:10.137042 IP 192.168.2.12.56518 > centos.hbci: Flags [S], seq 4251361662, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
21:36:12.886743 IP 192.168.2.12.56517 > centos.hbci: Flags [S], seq 2766461791, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
21:36:13.137883 IP 192.168.2.12.56518 > centos.hbci: Flags [S], seq 4251361662, win 8192, options [mss 1460,nop,wscale 8,nop,nop,sackOK], length 0
21:36:18.887182 IP 192.168.2.12.56517 > centos.hbci: Flags [S], seq 2766461791, win 8192, options [mss 1460,nop,nop,sackOK], length 0
21:36:19.138951 IP 192.168.2.12.56518 > centos.hbci: Flags [S], seq 4251361662, win 8192, options [mss 1460,nop,nop,sackOK], length 0

SELINUX is disabled, btw

[vud@centos frontend]$ cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

For some reason VM host isn't accepting connection. Is there a way to navigate logs of embedded webserver? I'm using this app as a means to learn docker, so I am completely unfamiliar with react/js/npm.

P.S. I visited similar topics, but they ain't really gave me an answer.


Solution

  • Ok, disabling firewalld solved the problem

    systemctl stop firewalld