Web Access – How Websites Are Accessed Without Port Numbers

iproutingtcp

I am confused on how requests to websites are received. If I type in 172.217.5.110 to my browser, google.com sends me its home page. I didn't have to specify the port number. How does that work? I read that commands such as ping use ICMP, which does not use port numbers, so I thought maybe that's why. However, I also read that one of the first steps of sending data using HTTP is to establish a TCP connection, which requires a port number. How does the web server listen for requests sent to its IP without a specified port number?

Best Answer

Ports are still involved even if you don't explicitly give them. It is an inherent property of the TCP and UDP protocols that you need port numbers.

If you don't give an explicit port number in the URL the browser uses default port numbers: 80 for http:// and ws://, 443 for https:// and wss://, 21 for ftp://.

In other cases there are fixed port numbers, i.e. the mail server is always at port 25 and the DNS MX record only returns the name but not the port. For other situations (like SIP) there are DNS SRV records which also provide information about the port to use etc.

How does the web server listen for requests sent to its IP without a specified port number?

It doesn't. For typical web servers like nginx or apache one still has to specify the port number to use in the servers configuration. Others might use default port numbers.

Related Topic