What is LAN, what is WAN and what is NAT
LAN and WAN are two acronyms that you are likely to come across when you are trying to carry out any kind of computer networking. LAN stands for Local Area Network and WAN is Wide Area Network. We;ll take a closer look at this terms to help you get a better understanding of their roles.
LAN
Local Area Network refers to a computer network that covers small to medium areas like homes and small offices. A LAN within your home or small business can include a variety of devices including a router, desktop computer, laptop, printer and game console. Every device in your LAN has to feature an IP address to establish communication with other devices within your local network and across internet. LANs usually work for data sharing and support for printers and other peripheral devices.
WAN
WAN stands for Wide Area Network. As the name suggests, this is is a network that covers a wide area, such as a city, a region or a state. A WAN is a network outside of the Local Area Network or LAN and in the majority of cases (although not always), it refers to internet. It is possible to set up a small WAN using many LANs. When using a LAN, you will notice that the devices within that network have IP addresses that share the same format. For instance they all start with 192.168.1.x. The x is the number that varies and it goes from 1 up to the number of devices that you have. The laptop’s IP address may be 192.168.1.1, the laptop’s IP can be 192.168.1.2 and so on.
Why does a router have two IP addresses?
You may have noticed that routers have two IP addresses and you may be wondering what is the reason behind this. We should start by saying that while home users and small offices generally use a router, in general large businesses rely on a Network Address Translation or NAT server. A NAT and a router have the same role, but the latter works in smaller scale environments.
A router has two IP addresses because there are two kinds of IP addresses: public and private. The IP addresses that we previously mentioned for devices within a LAN network (192.168.1.x) are private. The easiest way to understand the difference between public and private IP addresses is to think of the public IP as the phone number of a company, where the private IP addresses are the internal telephone line extensions.
Public IP addresses are set for public access and are visible to other users on internet. A websites is hosted on a server associated to a public IP address. On the other hand, a private IP address is only used within your Local Area Network and no one can access it from outside your LAN.
The traffic received on your LAN, has to pass through a public IP address first. This means that anyone else can see the public IP address on your router since it is publicly available. The idea is that your private Local Area Network (LAN) is kept behind one single public IP address. To achieve this, a router is required and a NAT server can also play a part in this setting.
NAT Servers
NAT servers or routers are suitable for three main purposes. They can ensure that devices connected to your LAN remain private (private IP), they can route a call to the right computer. They manage the type of traffic by routing it through the right portal. Traffic can be incoming, outgoing or it can only go within your LAN, this is why the router is in charge of ensuring that the computer or device that made the outbound request is the same computer that gets the inbound response. Computers within your LAN can establish communication without restrictions, but traffic coming into the network or going out needs Network Address Translation (NAT). Thanks to NAT, your devices with private IP address are able to access the public environment of the Internet. A router is like the intermediary that helps to establish the connection.
How does NAT work
The NAT server or router receives the outbound request from a device connected to your Local Area Network. It saves the call request in its memory and turns the private IP address into its own public IP address before forwarding the request. When a response comes back from the Internet, it searches its memory to find out which was the device that made the original request and then it delivers the packet to that device.In this setting, all outbound requests sent to the Internet show as if they are coming from the same public IP address.
Summary
Let’s go through the main details covered in this article once again. With NAT, every device connected to the router will appear to be using the same public IP address, even though each device within your LAN has a private IP address of its own. A device makes the outbound request to the Internet (the WAN) and the router gets the request and puts it into its memory, taking note of the device that made the request.
The router then converts the device’s private IP address to its public IP address before forwarding the request. When the Internet sends back a response, the router reviews its memory to see which private IP address made the original request. Then it delivers the packet back to the appropriate device.
To be able to get information from the WAN to your Local Area Network and to or from computers within your LAN, the router has to let traffic pass through a portal or opening in its firewall. Port forwarding is what allows you to open a port. This is needed so that programs can send and receive data through a port in your router.