Accessing a node.js http-server across LAN

Questions about networking.
In the Original Post please also include the output of inxi -FNzxx
User avatar
ilu
Posts: 2490
Joined: 09 Oct 2013 12:45

Re: Accessing a node.js http-server across LAN

Postby ilu » 12 Aug 2017 22:16

SolydXK is specialised on desktop not server usage but this should not be a distro-specific problem. I have absolutely no experience with node.js (and I don't know whether anybody else here has) and I have only very very limited networking experience so I can just guess:
1. Some server apps - f.e. apache - have problems with SolydXK's way of using tmpfs for dirs like /tmp - but since the server works locally that should not be a problem? You might have a look at /etc/fstab.
2. Server configuration: You probably have checked that and I can't advise on it anyway. Do you get positive results with "netstat -tulpn | grep <portnumber>"? Any logs on the server side? Verbose/debug mode?
3. You've disabled the firewall. After that smb, ssh and ftp services work for me. Can you log into your server via ssh?
4. You've ruled out the university network.
5. Have you ever tried to reach your server with another client? With a browser instead of your app? You could have a look at FFs or chromiums developer tools and check the server response/error page.

Maybe schoelje or grizzler can come up with something specific to this distro but if not, I think this problem is better suited for a forum like stackoverflow.com (but you'd need to provide code with the question).

User avatar
Arjen Balfoort
Site Admin
Posts: 9279
Joined: 26 Jan 2013 19:36
Location: Netherlands
Contact:

Re: Accessing a node.js http-server across LAN

Postby Arjen Balfoort » 13 Aug 2017 09:06

Don't forget to give the server a static IP (in the DHCP configuration of your router and in the server's /etc/hosts), forward the server's port in your router and open the port both ways for tcp/udp in the firewalls of your server and client.

Example with 192.168.0.125 as static IP and port 26000

Router
Add a reserved address (static IP) to the DHCP Server section. I used the currently assigned IP address for the MAC-address of my server.

Add a virtual server and use port 26000 for the static IP address with all protocols assigned.

Server
Here's my /etc/hosts:

Code: Select all

127.0.0.1       localhost
192.168.0.125   solydxk_server
# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
Reload the hostname and check:

Code: Select all

sudo /etc/init.d/hostname.sh start
hostname
hostname -f
ping solydxk_main
which should return "solydxk_server" and the given static IP.

Restart network and check:

Code: Select all

sudo service networking restart
sudo ifconfig
And search for this line:

Code: Select all

inet 192.168.0.125  netmask 255.255.255.0  broadcast 192.168.0.255
Server and Client
Open port 26000 (tcp/udp) both ways on your firewall.

This worked for my local Quake server :twisted:


SolydXK needs you!
Development | Testing | Translations

User avatar
ilu
Posts: 2490
Joined: 09 Oct 2013 12:45

Re: Accessing a node.js http-server across LAN

Postby ilu » 13 Aug 2017 12:34

I assumed that he made sure that his client is talking to the right server, because he could ping it. But why would a static IP solve the problem? The server should answer on any IP as long as it's the right one, shouldn't it? Ports need to be open though but 80/8080 should be. Specifically, I would not use anything beyond http standard ports because everything else will probably be closed in the network setup.

I don't think he can assign static IPs in a university network. They will be assigned to him, either dynamically or static. Unless he's working as admin there he won't be able to configure the router anyway. So this might work for his testing setup (own router) but not for the real case.

node.js http-server does not have many config options, it should run ootB on port 8080. You need to check that in your testing setup http serving on whatever port you use is open. Same goes for your university network segment - if not, you are doomed. You could try to set up a test page as described here http://thisdavej.com/create-a-web-serve ... -any-code/ and test the setup using a browser to rule out client-side problems.

Only things special I know of about SolydXK are the firewall and clamav running and the setup using tmpfs. I had no problems setting up a minecraft server on SolydX 201607 using standard ports and without changing router config.


Return to “Networking”

Who is online

Users browsing this forum: No registered users and 1 guest