What does a Wifi router do and how do they work
Wifi Routers: We all hear phrases like Wifi Routers, CPE’s, AP’s, Wifi Boosters, Repeaters, Bridges and Extenders but what exactly are they and how do they work. In this page we shall concentrate on Wifi Routers only. All the other items will be covered on other pages to simplify things.
First Let’s start with Internet Packets and Packet Switching
In a local area network like you might have in an office or at home the information you share within this network or obtain from other networks outside your network is constructed of packets of data. These packets are derived from chunks of application data like files or real time packets derived from sampling voice recordings in VOIP (voice over IP) applications or streaming video for example.
When you use your web browser to request a web page the data that makes up that page is sent to your wifirouter or gateway in the form of packets. Packets are normally a fixed size and basically are a stream of binary digits representing part of your application data.
What are Wifi Routers and what job do they do in your Network
Now the main task of a router is to direct packets in and out of your local area network (LAN) to the outside wide area networks (WAN). To do this data packets are encapsulated with extra header address information which is used to route the packets to their correct destination. A wifi router contains routing tables which enable it to quickly direct packets to the right host computer in your network and to direct packets to other networks in your WAN.
LAN IP addresses
A typical IP (Internet Protocol) address is formed by 4 tripple digit numbers separated by dots like this … 192.168.2.1. This particular number uniquely defines a host device in your local network as numbers beginning with 192.168.xxx.xxx (xxx is a number 0..255) are specifically allocated for LAN use and cannot be used as WAN addresses. Each tripple element of an IP address can have a theoretical value for 0 to 255 numerically
WAN IP addresses
In the WAN world an IP address uniquely identifies a device or host computer in the world. The form of the IP includes a part which also identifies the network address on which the host computer resides. The network part of the IP address can be used to Identify classes of networks into large and small numbers of hosts. Wifi Routers in the WAN use this information to forward packets to the best network link they can access to send the packet on its way to its destination network and host.
These Routers are very busy and can dynamically change their routing tables to suit network conditions if a link is to busy or has failed in some way. In this way a packet could be sent to an entirely different link. This is Packet Switching. In this way the Internet design is much more robust and tolerant to link failures than circuit switching data as packets can be switched and rerouted on other links.
Your ISP Routers and your WAN IP address
Your Internet service provider has routers that provide to your LAN router an external WAN IP address. In order to share these WAN addresses, ISP’s often dynamically share these IP addresses with your router and those of other clients routers to reduce the costs in buying a dedicated group of IP addresses. As far as your wifi router is concerned it just has one WAN IP address at a given time.
Allocating LAN IP addresses
These WAN IP addresses are allocated during sessions in which your LAN traffic to the WAN is temporarily allocated a shared WAN IP. The same WAN IP address could be associated with an entirely different ISP client next time.
This process is controlled by a protocol called DCHP (Dynamic Host Control Protocol) and your ISP routers provide the DCHP server to do this. Not all ISP’s work in this way only, they can also provided dedicate WAN IP addresses for clients with dedicated host computers used by some clients or for a lot of other reasons. Many WISP and satellite ISP’s provide a dedicated WAN IP address to clients.
Your LAN Wifi Router has a DCHP Server
In turn another role provided by your LAN router is to share the allocated WAN IP address with dynamically allocated local IP addresses using its own dedicated DCHP server. It can route packets from local host computers with their locally assigned IP address to packets on the WAN side of the wifi router using its allocated or fixed WAN IP address. In effect the WAN IP address is shared with all the local hosts on your LAN. So that it appears all your LAN traffic is generated by one host with its WAN address.
Traditionally the local host connections were provided by connecting ethernet cables to each host device in your LAN to dedicated switches connected to your main wifi router. Most routers have built in ethernet switches so that LAN client computers can plug directly in to the router. Switches are used in larger LAN’s and are connected in a hierarchy all leading to one or more main routers.
The Ethernet Protocol
The data links between host devices in your LAN are controlled by a link level protocol whose job is to ensure data packets are sent correctly. The Ethernet Protocol is a widely adopted link level protocol to manage the physical propagation of packets on shared links.
The ethernet protocol manages hosts sending and receiving packets which may be sent at the same time and the protocol can detect packet collisions and take steps to organise retransmission of packet data from the effected hosts. It can also statistically manage when a host may send a packet on a shared link to get the best chance of success. Each host on the LAN has a unique MAC address which is included in packet headers so individual hosts can identify packets addressed to them. All devices that communicate in the world using the IP protocols have a unique MAC address, which is normally printed somewhere on the device.
The addition of wireless links has made for convenience, practical and cost saving advantages over traditional wired networks. It should be remembered that the addition of a wireless (receiver and transmitter) to routers or wireless cards on host computers makes no difference to how we see packets of data being sent and managed on our LAN. We just change a physical wired link for a wireless link. And both can exist at the same time on the same network.
There are separate protocols underneath the ethernet protocol that manage the propagation of packets on these wireless links. Examples of the protocols include the Wireless IEEE 802.11b/g/n standards. The main difference in these standards are increased data rates from 802.11b to 802.11n.
Wifi Routers with 3G connectivity
Now it is possible to combine normal ADSL/WISP/Cable connectivity to the Internet with access through your 3G telephone network connection. In this way you can manage which network to use and to fall back on when the best connection option is not available. Often the 3G connectivity option is ideal for remote access where normal Internet connection might not exist. Also for portable applications when on the move these routers are ideal.