Spiria logo.

Understanding the Internet, Part 1: IP addressing and ports

March 6, 2019.

The Internet can sometimes seem profoundly obscure or magical. However, at its core, it is an information delivery system, functioning a bit like a package delivery service. In fact, I will use the analogy of the postal service to explain the various aspects of the functioning of this communication system.

Due to the complexity of the subject, this presentation is divided into three parts, each of which will conclude with practical examples applicable to Windows machines.

IP addresses

All resources available on the Internet are contacted through an external IP address. An external IP address is similar to a building’s postal address. IP addresses are generally made up of 4 groups of numbers from 0 to 255, separated by dots. Here are some examples of external IP addresses in the real world:

There is a second type of IP address, commonly called “internal”, which roughly corresponds to a room or office number. An internal IP address never appears publicly on the Internet. As with an office number, giving it to someone without specifying the external address is not very useful. There are 3 internal IP address formats, defined by convention, as follows:

  • 192.168.XXX.XXX
    • Note: by default, most home networks are either 192.168.0.XXX or 192.168.1.XXX.
    • Note: In home networks, by default, values 0, 1 and 255 are never attributed, for technical reasons that fall outside the scope of this article.
  • 10.XXX.XXX.XXX
  • 172.16.XXX.XXX

In short, if you see an IP address other than the 3 formats mentioned above, you are dealing with an external address. In a home network, the connection to the external network is made through what is called the gateway which is normally assigned the address XXX.XXX.XXX.001 and usually resides on the router. The role of the router, provided by your telecom company, is mainly to keep track of all requests from the internal network to the outside world. When you contact anyone in the outside world from any internal address on your network, they will only see your external address.

Often, external IP addresses for residential use are not fixed, meaning that your IP address can change overnight without notice. On the other hand, companies, or websites, are generally hosted behind a static address, i.e. one that does not change.

Port usage

Having the IP address of an Internet resource is not enough; the input port and the protocol must also be specified. In our postal service analogy, the port represents a building entrance door, a service counter or a loading dock. The protocol defines how this point of entry is to be used (for example, delivery of packages, taking possession or reading of documents, etc.) Technically, there is nothing to prevent the use of any protocol on any port, but in actuality, conventional practices apply. In any case, your browser manages this for you transparently so that in general, you will never see this information on the screen. Here is a very short list of the most commonly-used protocols as well as the associated default ports:

  • Port 21.
    • FTP protocol.
    • Typically used for transferring large documents and files.
  • Port 22.
    • SFTP and SSH protocols.
    • Dual use: can be utilized as a secure document transfer service and as a secure communication protocol for command line server terminals.
  • Port 25.
    • SMTP protocol.
    • Used for emails.
  • Ports 80 and 443.
    • HTTP and HTTPS protocols respectively.
    • Used mainly for websites.

Coming back to our analogy, after finding the street address of a company from which you want information, you must go to the company’s physical address (IP address), enter through the lobby (port 80) and then request an information brochure (HTTP protocol).

If you decide to fill out a form to receive more information, you will need to write a letter (SMTP protocol), address the envelope with the physical address (IP address), and deposit it in the mailbox (port 25).

Then, should the company decide to provide you with a box containing several product samples, you would return to the same address, go to the appropriate counter (port 21) and take possession of the package (FTP protocol).

In the simplest cases, all services, regardless of their nature, are grouped on the public address of the organization you are trying to reach. But in reality, with the decentralization of services, this is less and less the case, as the various organizations present on the web will often get their email services from one provider and their website services from another. Also, for reasons of efficiency, it is more than likely that the websites of several different companies will be grouped at one common IP address, provided by a web hosting company.

Fortunately, to manage this complexity, there is something called DNS (Domain Name Service), which makes it easier for mere mortals to use the Internet. This will be the subject of the second part of this article.

Practical demonstration to check IP addresses

  • Click on Start and type “cmd”; the “Command Prompt” program should appear.
  • In this window, type the command “ipconfig” followed by “Enter”.

 

decorative

Depending on your machine, there could be a lot of data, but your internal IP address should normally appear right after “IPv4 Address”, in a section called “Ethernet adapter” or “Wireless LAN adapter”.

decorative

  • In most cases, for a household IP address, you should see something that looks like 192.168.1.XXX, the last number being a value between 2 and 254.
  • The Subnet Mask will generally be 255.255.255.0.
    • Messing with the Netmask is wrong…
  • The Gateway will generally be 192.168.1.1.
    • This is your exit door to the Internet.
    • All traffic from the house will run through this address before being translated into an external address.

What can you do with this information? You could do pro tests and impress your family with your computer skills (subsequently condemning yourself to a life of servitude as the family’s computer expert).

If you suspect a problem with your Internet, start by doing ping tests.

  • Step 1 – Test access to your gateway.
    • In the previously opened CMD window, type:
      • ping 192.168.1.1
      • If you see a line saying that 4 packets were sent and received, the test was successful. Proceed to the next step.
      • Otherwise, there is a connectivity problem with your router.
        • Check all your wires for a wired connection.
        • Disable your computer’s Wi-Fi connection and reactivate it.
        • If all else fails, restart your router and repeat the test.
  • Step 2 – Test internet access.
    • ping 8.8.8.8
      • This is a Google DNS service that also responds to pings.
    • If it answers, your internet access works.
      • Your problem is not your internet connection.
    • If it doesn’t answer, contact your Internet provider.

This is what a successful ping test looks like:

decorative

Finally, if you are curious and want to know your current external address, type the phrase “what is my IP” in the search bar and your browser should return something like this (if Google is your default search engine):

decorative