I want to run a server on my machine so that anyone in the Internet may connect to it. But my Broadband internet provider issues the same WAN ip to all the customers while each of them has a different LAN ip. How can I run a server then?
migrated from stackoverflow.com May 22 '11 at 15:18
You mention LAN IP, so I'm assuming you have a router or switch in between your PCs and the WAN. In order to setup a single server, for example web server, to be identified as the sole system for WAN facing services you can either:
How to go about it depends on what type of router/switch you are using.
I take it you mean that you have a 'private' IP assigned to you by your broadband ISP (which you see allocated on your Server network interface). Meanwhile, if you try to identify your external IP, its different (which you refer as your WAN IP).
Setting up a server that can receive incoming connections from the Internet requires things like NAT provided from your ISP.
Simply put, someone on the Internet would try to connect to your 'WAN' IP on some port number (say 8081/tcp), and this NAT on the ISP would convert that to your 'private' IP and port 80/tcp (say).
However, if you really want to run a server on such a network, your ISP usually would provide you with a static public IP address rather than the private IP you are seeing now. You will need to talk with him on this and get your subscription modified likewise.
Usually, broadband ISPs give out public IP allocations which might change each time you reconnect. That is an easier thing to handle since you can then get a domain registered and use things like OpenDNS to make your server easily accessible on the Internet.
Configure port forwarding at your broadband-router.
.--------. [PC 1]--------+ | | | [PC 2]--------+ router +---- DSL/cable ... : : [PC n]--------+ | '--------'
(Assuming the computers are connected to the typical built-in switch-ports of a typical consumer broadband router, which provides NAT and internal DHCP service)
The router's WAN (i.e. Internet) IP address is used externally for all PC 1, PC 2 ... (i.e. NAT applies)
If PC 2 is the "server" and has DHCP reservation 192.168.1.2, configure port forwarding at the router so that Internet traffic for port 80 is forwarded to port 80 at 192.168.1.2
I'm assuming that you are on a standard home internet connection. If this is a business grade question it may be bit different because of how your ISP handles your WAN IP.
Most likely, your WAN IP is actually dynamic. For instance, right now my WAN IP may be 184.108.40.206. In another hour my WAN IP may be reset to a new IP within my ISPs range, so it may change to 220.127.116.11.
The other answers to this question are perfectly correct, in that you will need to set up some port forwarding. Port forwarding will tell your router (the device that passes your internet connection to various connected devices) to send everything on port x (80?) to a specific LAN IP. To handle the changing IP provided by your ISP, however, you will also need to use a dynamic dns service like dyndns. This service will install a client on your server, and do a check every few minutes to see if your WAN IP has changed.
dyndns is easily the most popular service to handle this kind of thing, but there are many more free options.