The world of networking is complex, including that little bundle of technology sitting on your shelf – your router. It is actually a pretty amazing little device that can probably do more than you realize. In truth, the typical “consumer” router is a combination of three devices:
- A router – a router is a device with two or more ports that is used to connect two or more networks together. Typically, the consumer router has a “WAN” port that connects to the “Wide Area Network” of your Internet Service provider and “LAN” ports for your Local Area Network.
- An Ethernet switch – you may have noticed that your router doesn’t have two ports; most actually have five: one WAN port and four LAN ports. Inside the box is an Ethernet switch that turns the LAN port of the router into 4 LAN ports to which you can connect wired computers, servers, and even additional Ethernet switches if needed. Actually, it’s 5 LAN ports, because the fifth one is connected to…
- A WiFi Access Point – this is simply a wireless radio connected to an internal LAN port that provides a WiFi signal for computers, tablets, smartphones, IP cameras, entertainment systems, and all kinds of other things. This WiFi radio is usually optimized for short-range, indoor use, providing maximum throughput for a short distance.
One of the odd and important facts about a router is that it has two Internet Protocol (IP) addresses: one on the network to which its WAN port is connected (which should be a public IP address, visible from the Internet – e.g. 188.8.131.52, ayrstone.com’s address), and one on the LAN port, the network it creates for you (a private address, not usable from the Internet, e.g. 192.168.1.1). Its job is to take data packets from each network and move them to their destination network. So, if your computer is at 192.168.1.50 on the LAN, and it receives a packet on its WAN port destined for 192.168.1.50, it passes it to the LAN port where it finds its way to your computer. Similarly, if your computer creates a connection to 184.108.40.206, the router receives packets from your computer on its LAN port and routes them to the WAN port. When you print to your networked printer (at, say, 192.168.1.100), it receives packets from your computer and then just turns them around and sends them back down the LAN port, since they are not destined for the Internet.
The ability of the router to accept traffic on a single public IP address and enable several different computers at private IP addresses to have separate “conversations” with the Internet is called “Network Address Translation” or NAT. The way it does this is by using “ports” – simply numbers associated with every IP address.
Each IP address has 65,535 possible ports. Some ports have pre-assigned purposes, some are available for use by applications, and some are ephemeral – here’s a good explanation of which are which. NAT uses those ephemeral ports to keep the conversations between your network and the Internet straight; for instance, your computer’s conversation with this website might be using your public IP address’s port 55135, while another computer on your network might be having a conversation with another website on port 61234. To the two websites, it looks like the traffic is coming from a single computer, specifically your router. Your router then routes the responses from the websites to the correct computer based on the port on which the data comes in.
The private IP addresses on your network are usually assigned by your router using Dynamic Host Configuration Protocol or DHCP. When a computer connects to your network, it will ask the router for an address via DHCP, and the router will provide it one (assuming it has one to provide). The address is referred to as a “lease,” because it will expire at some point after the device leaves the network, so it can be used by another device. However, note that you can simply assign a static IP address to a device in your network, as long as (1) it is an IP address inside your network (usually meaning it has the same three first numbers as everything else on your local network, e.g. 192.168.1.x) and (2) it does not interfere with the DHCP settings on your router (if your DHCP server begins at 192.168.1.50 and your router is at 192.168.1.1, use static addresses between 192.168.1.2 and 192.168.1.49, and KEEP TRACK OF THEM WHEN YOU ASSIGN THEM!!!)
The first tip for getting the most out of your router is this: set up your router’s DHCP server carefully. I suggest setting your router’s IP address as 192.168.1.1 and setting your router’s DHCP range from 192.168.1.50 to 192.168.1.254 (204 addresses). The reason for this particular range is that, first, it allows for a large number of devices to automatically use your router, getting private IP addresses via DHCP (204) but still leaves you 48 addresses you can use for devices you want to statically assign. This gives you the flexibility to maintain, expand, and control your home network.
Alternately, most modern routers support DHCP Reservations, which allow you to ensure that the router ALWAYS provides the same IP address to a device on the network. That way you get the advantage of a static IP address (knowing where a device is at all times) with the advantage of DHCP (ease of configuring devices and the IP addresses being managed by the router).