Home Networking

Running your Web Server from a Home Network

To run a web server (or any server) from your home network and publishing your website to the wider world you will need the following:

  • a PC with a webserver running on it (I use Apache on a Gentoo box in this example)
  • A router connected to the Internet through an always on broadband connection. I use a Linksys Wireless-G router connected to an Eircom broadband connection.
  • A registered domain name
  • A Dynamic DNS account

Setting your IP Address

In order to ensure that your router forwards traffic to your web server correctly you must ensure that the web server runs on a machine in your network with a static IP address. You must ensure that your IP Address is set to a static value. This must be outside the range which your router uses to allocate dhcp addresses (with the Linksys Router on default settings, this means the IP address should not be in the range 192.168.1.100 to 192.168.1.149 (this information is available on the main setup page - usually at 192.168.1.1). If your router runs on 192.168.1.1, you might consider setting your web server PC to the IP address 192.168.1.2. These instructions show how to do this:

Setting your static IP Address in Windows 2000 or XP

  1. Open your active Network Connection Settings (under Start→Settings→Control Panel→ Network Connections). Click on Properties. This will open up your Connection Properties for your active connection (probably either Wireless Network Connection or Local Area Connection)
  2. Click on Internet Protocol (TCP/IP) and Click on Properties
  3. Select the “Use the following IP address:” radio button
  4. Fill in 192.168.1.2 for your IP address
  5. Fill in 255.255.255.0 for your Subnet mask
  6. Fill in 192.168.1.1 for your Default Gateway (or whatever address your router is using)

If your router offers DNS (as the Linksys one does):

  1. Select the “Use the following DNS server address:” radio button
  2. Fill in 192.168.1.1 for your Preferred DNS server (or whatever address your router is using)

Setting your static IP Address in Gentoo

Use route to discover your default gateway (in the windows instructions above we guessed). The output will be something like this:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 eth0
loopback        *               255.0.0.0       U     0      0        0 lo
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0

This tells us that the default gateway is 192.168.1.1 (as we used above in the windows instructions)

Set the computer's IP address, subnet mask and gateway in /etc/conf.d/net using the following (for IP address 192.168.1.2, subnet mask 255.255.255.0 and gateway address 192.168.1.1):

config_eth0=( "192.168.1.2 netmask 255.255.255.0" )
routes_eth0=( "default gw 192.168.1.1" )

To add your DNS server (presuming your router runs DNS on 192.168.1.1), open /etc/resolv.conf and edit it so that it reads the following:

# Generated by dhcpcd for interface eth0
nameserver 192.168.1.1
domain homenetwork

Now reboot and move to set up port forwarding on your router.

(these instructions were adapted from the Gentoo Wiki here and here.

Port forwarding

public/homenetwork.txt · Last modified: 2008/08/09 09:59 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki