Let's say 3 computers are connected to the internet through a one Router.If we want one computer of that LAN (which only has 3 computers) to host our web site so everyone over the internet can access...:-
1. Do all 3 computers get the same Public IP address(coz connected to the same router).
2. If so what IP address would our web server get?
3. How does outer world log separately only to the web server by selecting the server machine exactly(if all 3 gets same public IP)

To answer your first question: No they are assigned different IP addresses. 192.168.0.1 is usually the default IP and is usually reserved for a router, the first computer connected to the router will have an IP of 192.168.0.1, the second 192.168.0.2 and i think you can guess the 3rd.

to question 2: i think you can set the IP of the web server but if you're renting one you will be given the IP i think.

to answer question 3: if external users (people not connected to your network) use the website they will access your website by typing in the website URL which references the DNS to get the IP of your webserver where the data for website is stored.

Hope this helps . . .

My answer may not be 100% correct, check other replys to confirm

ChrisHunter's on the right path, just a few things to add to his answer. The three computers on the LAN do not get configured with the public static IP. They will be configured with private IP addresses . The only correction is the say the private side of the router is 192.168.0.1. Then computer #1 will be .2, computer#2 can be .3 and so on. The computers on your LAN can all be set dynamically except your web server, make that IP a private static. It is not important which IP your dynamic clients are assigned within the range.

For question #2, just make it a private static on the same internal subnet, .2 is fine.

For question#3, what you do is port forwarding on your router. First it would be best to have a DNS address, assign that hostname to the public IP address on your router. Then on your router create a port forwarding rule for that public IP on port 80 and map that to te private IP you assigned to your we server on port 80 as well. Make sure the server is running web services and that it's local firewall, if enabled, allows 80 inbound.

That is pretty much it. You can do this on the router without port forwarding by exposing the private server to the Internet completely by the public IP, by I do not suggest that as the server will be fully exposed.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.