How do I make a server accessible over the internet

2

1

I wrote a chat client and server in Java. It works but as I'm finding out, only locally. The goal is to get it to function over the web.

I've tried quite a lot of things, and can elaborate if need be. Completely new to this, so figure I'm suffering from a lot from "Don't know what I don't know" here."

This is what I've done so far:

  • Enabled port-forwarding on my router.
  • Ensured a static local IP address.
  • Added the service on my network, with the proper port.
  • Added an inbound rule that allows it through windows firewall, and though I'm not sure it was necessary, to cover my bases, I also added an outbound rule to match.
  • Utilized http://www.canyouseeme.org/ to make sure that my service is reachable.

There was a similar question to this on SO, but it's for a web server and deals with .

Legato

Posted 2015-08-31T23:50:06.027

Reputation: 123

In your client, you put a ip to connect to ? I know less java, or it need a webpage to start the java plugin ? I ask in case it need a web server on the server too open – yagmoth555 – 2015-08-31T23:52:47.597

Yes, I put the IPv6 of my router, that is set up to port forward it to another computer that I'm using as a server.

When I used it locally I used the IP of the server computer directly, which didn't work over the net.

I'm not sure if the fact it's in Java even matters, but added it just in case. It doesn't use web start. The client is an executable. – None – 2015-08-31T23:55:57.057

your isp support ipv6 ? remote client might have issue to connect to you – yagmoth555 – 2015-09-01T00:22:13.073

I believe so, It had a field for the IPv6 of the router, I provided the IPv4 as well. I filled out this entry form.

– None – 2015-09-01T00:37:25.090

Can you telnet to your service port to see if it's open correctly ? If telnet can, it mean the client got a problem. If it can't, it can be a firewall issue (firewall on the server) – yagmoth555 – 2015-09-01T00:38:56.240

I set up Telnet, and it failed, so it's certainly a firewall issue in that case? I have an inbound/outbound rule, and just tested with windows firewall off but Telnet still failed. I turned off Windows Firewall, is there some other system I should be aware of? – Legato – 2015-09-01T02:15:36.597

You did a telnet ip port ? – yagmoth555 – 2015-09-01T02:51:40.690

Not sure what you're asking. I tried telnet command with public ip address to see if it forwarded correctly, but it said it failed. Though just to test it using the static local server ip, it connected fine. – Legato – 2015-09-01T04:21:45.370

Does your client ever need to accept an incoming connection (for example, does it tell the server "send me messages at this port: XXXXX")? If so, then the client firewall and port forwarding rules would need to be set up as well. That's not always possible, so it's usually better to have the client make outbound connections only. – CBHacking – 2015-09-01T05:00:57.397

Answers

3

You need to ensure the routing path is complete from internet machines to your desktop. For this to work you need to remove all port blocks (firewalls) for the ports you are interested in exposing, and also ensuring that trafic is routed from your public IP address to the server's IP (if the server is private).

This is normally all accomplished on your home router/wifi/modem box which performs the Network Address Translation (NAT) service for your home network (pretends to be your internal computers when your computers talk to the internet)

So, you need to:

  • in your router, configure the firewall to allow the specific port your server uses (say port 4321).
  • in your router, configure a port-forward for the port 4321 to the internal IP address of your actual server, also to port 4321.
  • on your server, ensure your firewall allows connections to port 4321

Test your chat clients work internally on your network (no NAT involved). Then, test your remote clients work by connecting to your public IP address, on the port you forwarded.

rolfl

Posted 2015-08-31T23:50:06.027

Reputation: 771