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)

Dani AI

Generated

Short summary tied to the replies from , and : all three LAN machines will share the single public IPv4 address on the Internet because the router performs NAT. Each PC still has its own private IP on the LAN (common examples: 192.168.x.x or 10.x.x.x). Outbound traffic is translated to the router’s public IP; inbound traffic must be directed by the router to one internal host.

Practical steps to make one LAN machine host a website:

  1. Give the web server a fixed private address (either set a static IP on the server or create a DHCP reservation on the router), e.g. 192.168.0.10.
  2. Configure port forwarding / NAT on the router to map incoming TCP port 80 (HTTP) and 443 (HTTPS) to the server: PublicIP:80 -> 192.168.0.10:80.
  3. Ensure the server’s OS firewall allows those ports.
  4. Point a DNS A record for the domain to the router’s public IP. If the ISP provides a dynamic public IP, use a dynamic-DNS service.
  5. Verify externally (from a device not on the LAN) that the site is reachable.

Notes and common gotchas not covered above: ISPs sometimes block port 80 on residential connections—testing on an external network will show this. To host multiple internal web servers on standard ports, either run a reverse proxy (Nginx/HAProxy) on the forwarded host and route by hostname, or forward different external ports to different internal machines. TLS for multiple sites requires SNI support on the server/reverse proxy. Avoid placing the server in a router “DMZ” unless the machine is hardened; port forwarding is safer.

Security and troubleshooting: keep the web server patched, use HTTPS (Let’s Encrypt is a common free option), check ss/netstat for listening ports, and confirm router logs/rules. The core ideas in ’s and ’s posts are correct; the extra points here cover DNS, dynamic IPs, reverse-proxy options, ISP limits, and security.

Recommended Answers

All 2 Replies

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.