Assume that you have installed a server application and run it via port 25535 on your local PC, you don't have an external static IP, your PC is connected to your local ISP through a modem, and you have a router to connect with all your local PCs. The goal is to make the server accessible from the Internet, i.e., both from your local network and from external client.
1. Configure local static IP
1.1 Find router's Local IP address
Go to Command Prompt and type:
> ipconfig /all
Take note that the Default Gateway is your router's Local IP Address, e.g., 192.168.1.1.
1.2 Choose a valid static IP address
By default, your local IP address is assigned by DHCP service on your local computer, which means the internal IP of each PC on your local network may change. In order to set up a dedicated server, you must have at least a local static IP, or an external static IP.
You would logon to the router and review the DHCP Scope. The purpose of setting a DHCP Scope is to use a designated block of addresses that don't conflict with your static IP address. Usable local IP addresses only range from 1 to 254. Assuming your router is .1, most consumer routers start at .100 and end at .254 by default, IIRC, while most available DHCP router ranges allow for 50 Maximum Number of DHCP Users by default. You would then choose an IP address not in that scope to do a static assignment.
1.3 Assign a static local IP address
Control Panel -> Network and Internet -> Network and Sharing Center -> Local Area Connection
From the Local Area Connection Status window, click the Details button to see your existing connection details (most likely DHCP). Click the Close button after you've made note of those IP addresses for subsequent steps.
Back at the Local Area Connection Status window, click the Properties button. It will show you the Local Area Connection Properties dialog. Double click on the Internet Protocol Version 4 (TCP/IPv4) in the item box of the dialog window. Click the Use the following IP address radio button and enter the appropriate values for your static IP address.
Reboot the operating system to make the static IP take effect.
2. Port forwarding
Port forwarding or port mapping is a name given to the combined technique of
- translating the address and/or port number of a packet to a new destination
- possibly accepting such packet(s) in a packet filter (firewall)
- forwarding the packet according to the routing table
The destination may be a predetermined network port (assuming protocols like TCP and UDP, though the process is not limited to these) on a host within a NAT-masqueraded, typically private network, based on the port number on which it was received at the gateway from the originating host.
The technique is used to permit communications by external hosts with services provided within a private local area network.
Port forwarding is used when you have a router and you wish to let users connect to your server through it. If you wish to host your server for local reasons, it is not required that you do so. Keep in mind that port forwarding might cause security risks. You must open the TCP port on the firewall for the other users to connect to the server.
2.1 Find the local static IP
Go to Command Prompt and type:
> ipconfig /all
From there, you should be given a list of text. Scroll up to Wireless LAN, and look at IPv4 address which should be the one you have configured.
2.2 Configure new port forwarding rule
Type your router's IP in the browser address window and log in your router's admin page, find the Port Forwarding page; Enter your applicaiton name, port range, protocol type, and the local static IP you have configured, don't forget to enable it. Save the configuration, and you have successfully port forwarded.
3. Connect to the server
For people to connect to your server, they must use your external IP, which you can find at websites such as IP Chicken. Your external IP can change if you do not have a static IP from your internet service provider. Use a tool such as MyWANIP to periodically check on the external IP address. You may also search "my ip address" on Google and it will show your IP address.
Alternatively, If you don't want to use such IPs, you can look into a DNS service, such as NoIP DynDNS, that will allow you to have a name, rather than an IP address, that will remain the same. The name will point to your external IP address, regardless of whether or not it changes (the DNS is updated when changes occur).
Verify the port is open, and note your external IP by using a port checker tool, such as You Get Signal. Or if it's a HTTP server or Tomcat server, you can access from the browser by: