The vast majority of computers are connected to some sort of network, such as a home network, a corporate LAN, and the internet. These networks are a lynchpin of modern communications, enabling communication between many devices.
To communicate effectively, an addressing scheme is used that allows you to specify where you want your network communications to go. The main addressing scheme used for the internet is known as “IP” or Internet Protocol addresses. There are two IP address schemes in operation at the moment. IPv4 is the traditional addressing scheme. IPv6 is being rolled out as a replacement, as the IPV4 scheme has run out of usable addresses.
IPv4 and IPv6
IPv4 addresses are generally shown in the “dotted quad” notation, where four sets of up to three digits are separated by periods, for example: 192.168.0.1. In this notation, each of the four numbers must be between 0 and 255. A number of types of addresses are set aside as having a special meaning. For example, all IPv4 addresses that start with 192.168 are reserved for use on local networks and can’t directly communicate with the internet. This means that all home and even corporate networks can reuse the same set of addresses, as an address allocation efficiency method.
Tip: Often IP addresses in both IPv4 and IPv6 will have a slash and a number after them such as “/24”, called the subnet mask. The subnet mask is used to indicate which part of the address refers to the network address and which part specifies the host address within that network. For a /24 network, the first 24 binary bits of the address are used to denote the network address, with the remainder used to specify the hosts on that network.
IPv6 addresses are more complicated to display. They can be displayed with up to eight segments of up to four hexadecimal digits, separated by colons. An example IPv6 address could look like this: fe80:4749:dadb:748d:ff:334c:ffff:f000. The use of hexadecimal means that each digit can be 0-9, a-f. A segment can be shorter than four digits because leading zeros are omitted. As with IPv4 some address types are reserved for certain uses. All IPv6 addresses that start with “fe80” are local addresses with the same restrictions as local IPv4 addresses.
Tip: You may often see IPv6 addresses appear significantly shorter with a double colon in the middle, such as fe80:da29::9999. This is notation shorthand designed to make IPv6 addresses easier to read, write, and remember. Segments that are made up of four zeros can be omitted entirely and replaced with a double colon “::”. If two or more segments next to each other are both made entirely of zeros they can both be omitted and replaced with a single use of the double colon. To be able to reconstruct the full address, only one continuous set of segments can be omitted per address.
The loopback address
The “Loopback address” is another example of a reserved address. Somewhat like the local addresses which can only stay within the local network, loopback addresses can only stay on the local computer. If a computer attempts to send a message to the loopback address, the message will never be sent to the network but will instead loop straight back to the computer. This generally isn’t useful to most users, however, it can be useful to access network services such as webservers on the device.
In IPv4, the address “127.0.0.1” is supported by all devices as the loopback address. Technically any address that begins with “127” is reserved for use a loopback address, but not all devices support this usage. You may sometimes see the address written as “127.0.0.1/8” as only the first eight binary bits are used to denote the network portion of the loopback address.
In IPv6, the loopback address is “::1”. Only one address is allocated for use for loopback purposes. It may sometimes be written as “::1/128”, as all 128 binary bits are used to denote the network portion of the address.
Tip: The term “localhost” is reserved in the DNS scheme to refer to the loopback addresses.
If you’re running a webserver on your computer, you can connect to it in your web browser by typing a loopback address. For example: “http://127.0.1”, “http://::1”, and “http://localhost” all resolve to the computer you’re browsing from.
Tip: You can also manually specify port numbers if you’re hosting services on non-standard ports