-
Notifications
You must be signed in to change notification settings - Fork 4
Networking Basics
Computer networks are used to connect machines and transmit data between them. When you open a webpage, your computer uses the network it is connected to and fetches the page's content from a remote server.
The most common of all networks is the Internet. It was originally designed for military communications and then used by universities across the world before becoming the global communication network that it is now.
As a developer, you will have to understand how computer network work to create application that communicate online. When developing such applications, understanding networking issues is very important to debug and improve your code. In the following, we cover the basics that you need to know about networking and internet.
On a basic level, Internet consists of a bunch of computers connected together. Each computer has a unique IP address. This address acts just like your regular postal address.
You can find the IP address of your computer using the command line. On Mac OSX and linux, the command ifconfig
returns a list of all the network interfaces used by your computer and their configured addresses. For instance:
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 44:2a:60:f2:b0:bc
inet 10.0.1.152 netmask 0xffffff00 broadcast 10.0.1.255
media: autoselect
status: active
Here, the interface en0
, which represents the wifi connection of my laptop, is assigned the address 10.0.1.152
. This a private IP address, as we explain later.
The address 10.0.1.152
is a IPv4 address. An IPv4
address is any value between 0.0.0.0
and 255.255.255.255
. That makes up for a total of roughly 4 billion possible addresses.
Although this seemed a lot in the 80s, when these addresses were defined, with the increase of online devices, laptop, tablets, smart phones, etc., we are quickly running out of IPv4
addresses. To solve this, a new version of IP addresses has been developed, called IPv6. A IPv6
address looks like this: FE80:0000:0000:0000:0202:B3FF:FE1E:8329
. Because it is longer, the number of possible IPv6
addresses is enormous, equal to 2128
. Although you may not see a lot of IPv6
addresses for now, they are expected to replace IPv4
addresses very soon.