深入理解计算机网络_什么是计算机网络以及如何真正理解它们

深入理解计算机网络

by Sumedh Nimkarde

由Sumedh Nimkarde

Whether you are new to the world of development, or have been building things for a long time — or even if you’re a person who just likes computers and uses the internet daily — you’ve got to know the basics of networking and specifically Computer Networks.

无论您是刚接触开发领域的新手,还是已经进行了很长时间的构建(即使您只是喜欢计算机并每天使用互联网的人),您都必须了解网络的基础知识,尤其是计算机网络。

If you like digging more into servers, their security, and how you connect to your servers from a remote client, all of this requires some knowledge of computer networks and their components. I have tried to cover most of the topics concerning computer networks in this article.

如果您想深入研究服务器,服务器的安全性以及如何从远程客户端连接到服务器,那么所有这些都需要对计算机网络及其组件有一定的了解。 我试图在本文中涵盖有关计算机网络的大多数主题。

Also, from here, I will refer to “computer networks” simply as “networks”.

另外,从这里,我将“计算机网络”简称为“网络”。

Let us first look at my working definition of computer networks:

让我们首先看一下我对计算机网络的工作定义:

Computer networks can be defined as the exchange of network packets between computing machines across the world with the help of data lines like wire cables, optical fibers, etc.

可以将计算机网络定义为借助电缆,光纤等数据线在全球计算机之间交换网络数据包。

The Internet is a kind of computer network. Sorta.

互联网是一种计算机网络。 索塔

We will take a look at some commonly used terms and components and how they function in a computer network, some of which are in the above diagram.

我们将研究一些常用的术语和组件以及它们在计算机网络中的工作方式,其中一些在上图中。

计算机网络中的常用术语 (Commonly used terms in Computer Networks)

节点数 (Nodes)

Nodes in computer networks mean any computing device such as computers, mobile phones, tablets, etc which try to send and receive network packets across the network to another similar device.

计算机网络中的节点是指试图通过网络向另一个类似设备发送和接收网络数据包的任何计算设备,例如计算机,移动电话,平板电脑等。

网络数据包 (Network Packets)

Network packets are nothing but the information or units of data that a source node wants to send/receive to/from the destination node. In this article, network packets/data packets all convey the same meaning.

网络数据包不过是源节点要向目标节点发送/从目标节点接收的信息或数据单元。 在本文中,网络数据包/数据包都传达相同的含义。

互联网协议(IP) (Internet Protocol (IPs))

Consider you want to send a birthday gift to your friend on their birthday, where will you send it? To their street address right?

考虑您要在生日那天向您的朋友发送生日礼物,您将在哪里发送? 到他们的街道地址吧?

Same is the case here. The early computer scientists wanted to identify computers on the internet with a unique number, something like a telephone numbers today. So, they came up with the concept of TCP/IP.

这里也是一样。 早期的计算机科学家想用唯一的号码(例如今天的电话号码)来标识互联网上的计算机。 因此,他们提出了TCP / IP的概念。

An IP of a computer device is the address of that device in a computer network. Technically, it is a 32-bit number used which identifies devices in a network. All the communication to and fro from the device in that network will be done in terms of its IP address.

计算机设备的IP是该计算机在计算机网络中的地址。 从技术上讲,它是用于标识网络中设备的32位数字。 该网络中与该设备之间来回的所有通信都将根据其IP地址进行。

Consider that you are uploading a file to any site or say to Google drive.

考虑到您正在将文件上传到任何站点或说到Google驱动器。

Talking at the lowest level of network communication, your file is converted to packets and each packet has the destination node address with it which is nothing but the IP address.

在网络通信的最低级别进行交谈时,您的文件将转换为数据包,每个数据包都具有目标节点地址,该地址只是IP地址。

On a higher level, IP addresses are classified into two types:

在较高级别上,IP地址分为两种类型:

  • IPv4: IPv4 addresses are 32 bits (four bytes) as explained in the definition. An example of the IPv4 address would be 104.244.42.129 which is the IPv4 address of twitter.com. They are stable to use and hence are used today to identify machines in the world.

    IPv4 :如定义中所述,IPv4地址为32位(四个字节)。 IPv4地址的示例为104.244.42.129 ,这是twitter.com的IPv4地址。 它们使用稳定,因此如今已用于识别世界上的机器。

  • IPv6: IPv6 addresses are pretty new to the world and are basically eight hexadecimal numbers separated by “:”. An example of IPv6 address would be 2001:0cb8:85a3:0000:0000:8a2e:0370:7334. They are unstable and hence not used widely yet. The web is still using IPv4 due to its stability and there is no estimate when we will start to use IPv6 since it is not stable for now.

    IPv6 :IPv6地址对世界来说是一个很新的地址,基本上是八个以“:”分隔的十六进制数字。 IPv6地址的示例为2001:0cb8:85a3:0000:0000:8a2e:0370:7334 。 它们是不稳定的,因此尚未广泛使用。 由于其稳定性,Web仍在使用IPv4,并且由于目前还不稳定,因此无法估计何时开始使用IPv6。

IPv4 is classified into five classes named Class A, B, C, D, E.

IPv4分为五类,分别称为A,B,C,D,E。

Class A: As shown in the third column of the above image, for a Class A IP addresses, the first bit of the first octet of the IP address is constant and is “0”.

A类 :如上图的第三列所示,对于A类IP地址,该IP地址的第一个八位位组的第一位是常量,并且为“ 0”。

The Second column indicates the Network bits and the host bits of the corresponding class of IP address. Consider in case of a Class A IP address, we have the following formula:

第二列表示相应IP地址类别的网络位和主机位。 考虑到A类IP地址,我们具有以下公式:

Number of networks/subnets = 2^(# of network bits) .

网络/子网数= 2^(# of network bits)

Number of valid hosts in each subnet = 2^(# of host bits) — 2 .

每个子网中有效主机的数量= 2^(# of host bits) — 2

The number of network bits and host bits are decided by the default subnet mask of the class of IP address.

网络位和主机位的数量由IP地址类别的默认子网掩码决定。

The default subnet mask for a class A IP addresses is 255.0.0.0, that is 11111111.00000000.0000000.00000000`. Thus, for class A:

A类IP地址的默认子网掩码是255.0.0.0,11111111.00000000.0000000.00000000 因此,对于A类:

Network bits = 8, and Host bits = 24.

网络位= 8,主机位= 24。

Since Network bits = 8, Host bits = 24, their sum has to be 32, since IPv4 addresses are of 32 bits. But, since we are using the one bit (first bit in the first octet) to identify the class:

由于网络位= 8主机位= 24 ,因此它们的总和必须为32,因为IPv4地址为32位。 但是,由于我们使用一位(第一个八位位组的第一位)来标识类:

Number of usable network bits = Number of network bits — Number of constant bits = 8–1 = 7

可用网络位数 =网络位数–常数位数= 8–1 = 7

Thus, the Number of possible networks in Class A = 2^7 — 2 = 126 and,

因此, A类中可能的网络数 = 2^7 — 2 = 126并且

Number of possible hosts (that is devices that can be connected to the network) per network in Class A = 2^24-2 = 16277214 .

每个网络在Class A = 2^24-2 = 16277214 中可能的主机(即可以连接到网络的设备)数

Now, here, for class A, you may wonder why I subtracted an extra 2 from the number of possible networks. It is because, for class A, 127.x.y.z was kept reserved. For other classes, the usual formula is used.

现在,在这里,对于A类,您可能想知道为什么我从可能的网络数量中减去了额外的2。 这是因为,对于A类,保留了127.xyz。 对于其他类别,使用常规公式。

Thus, IP addresses in class A range from 1.x.x.x to 126.x.x.x.

因此,A类的IP地址范围是1.xxx126.xxx

Class B: the case is similar with Class B. The only difference is 2 bits of the first octet are constant (10) and they identify the class of IP address that is class B. All other calculations are same, and I am not mentioning them here since they are easy to grab from the table above. They range from 128.0.x.x to 191.255.x.x .

B类:情况与B类相似。唯一的区别是第一个八位位组的2位是常量(10),它们标识IP地址的类为B类。所有其他计算都相同,这里我不赘述他们在这里,因为它们很容易从上表中获取。 范围从128.0.xx191.255.xx

Class C: 3 bits of the first octet are constant (110) and they identify the class as class C. They range from 192.0.0.x to 223.255.255.x .

C类 :第一个八位位组的3个位是常量(110),它们将类标识为C类。它们的范围是192.0.0.x223.255.255.x

Class D and Class E: Class D and Class E are used for experimental purposes.

D级和E级 :D 级和E级用于实验目的。

IPv4 addresses are mainly of two types:

IPv4地址主要有两种类型:

  • Static: These IP addresses are the ones which remain constant for a device over time. Examples of these are the remote servers that we use to host our apps, websites, etc. where we use the ssh client to ssh to our server.

    静态 :这些IP地址是设备随时间推移保持不变的地址。 这些示例是我们用来托管应用程序,网站等的远程服务器。在这些服务器上,我们使用ssh客户端来ssh到我们的服务器。

  • Dynamic: Generally, these are the IP addresses that a common computer in an Internet network is assigned. Try switching your router off and you will see a change in the IP address of your computer! (But only after reading this article ?). Now, you may be thinking who allocates these IP addresses? It is the DHCP (Dynamic Host Configuration Protocol) server which is explained briefly further in this article.

    动态 :通常,这些是Internet网络中普通计算机分配的IP地址。 尝试关闭路由器,您会发现计算机的IP地址发生了变化! (但是仅在阅读了这篇文章之后?)。 现在,您可能在考虑谁分配这些IP地址? 本文是DHCP(动态主机配置协议)服务器的简要说明。

Note: A device can have multiple IP addresses at the same time. Consider a device connected to two networks, wifi as well as any LAN network — it will have two IP addresses. This implies that the IP addresses are assigned to the interfaces and not directly to the computer.

注意 :一台设备可以同时具有多个IP地址。 考虑一个连接到两个网络,WiFi和任何LAN网络的设备-它将具有两个IP地址。 这意味着IP地址是分配给接口的,而不是直接分配给计算机的。

Okay, so far so good. Let’s continue.

好的,到目前为止很好。 让我们继续。

路由器 (Routers)

As its name suggests, a Router is a hardware component that takes care of routing packets. It determines which node the packet came from and which destination node the sender node want to send it to. No computer knows where other computers are located, and packets are not sent to every computer. A Router identifies the destination node address to which a network packet has to be sent and it forwards it to the desired address.

顾名思义,路由器是一种硬件组件,负责路由数据包。 它确定数据包来自哪个节点以及发送方节点要将数据包发送到哪个目标节点。 没有计算机知道其他计算机的位置,并且数据包不会发送到每台计算机。 路由器标识必须向其发送网络数据包的目标节点地址,并将其转发到所需的地址。

Routers have a specific “Routing Protocol” which defines the format in which they exchange data with another router or networking nodes. In other words, routing protocol defines how routers communicate with each other.

路由器具有特定的“路由协议” ,该协议定义了与其他路由器或网络节点交换数据的格式。 换句话说,路由协议定义了路由器之间如何通信。

Routers build up a “Routing Table” which identifies the most optimized paths to be taken in the network while sending packets.

路由器建立一个“路由表” ,该确定发送数据包时网络中要采用的最优化路径。

Technically, a routing table is just a table with the list of “routes” from one router to other. Each route consists of the address of the other routers/nodes in the network and how to reach them.

从技术上讲,路由表只是一个表,其中包含从一个路由器到另一个路由器的“路由”列表。 每个路由都包含网络中其他路由器/节点的地址以及如何到达它们。

Routing table:
Destination  Gateway     Genmask        Flags Metric Refs Ifacedefault      192.168.0.1 0.0.0.0        UG    1024   233  eth0192.168.0.0  *           255.255.255.0  UC    0      0    wlan0192.168.0.0  *           255.255.255.0  UH    0      2    eth0

Above is an example of a routing table. The key points to take a note of here are:

上面是路由表的示例。 这里要注意的关键点是:

  • Destination: This is the IP address of the destination node. It indicates where the network data packet should end up.

    目标:这是目标节点的IP地址。 它指示网络数据包应在何处结束。

  • Gateway: Gateway is the component which connects two networks. Consider that you have a router connected to another router. Each of the routers has devices connected to it. So, the address of the last router (say R1 here) after which the network packet enters the other network (say R2’s network) is called the gateway. Usually, the gateways are nothing but the routers. Let me give one more example: say that your room is one network and your sibling’s room next to yours is another network, then the “door” between the two rooms can be considered the gateway. People sometimes refer to the “routers” as the gateway, because, that’s what they are, “a gateway to another network”.

    网关:网关是连接两个网络的组件。 考虑您有一台路由器连接到另一台路由器。 每个路由器都有连接的设备。 因此,最后一个路由器的地址(此处称为R1),之后网络数据包进入另一个网络(例如R2的网络),称为网关。 通常,网关不过是路由器。 让我再举一个例子:假设您的房间是一个网络,而您兄弟姐妹旁边的房间是另一个网络,则可以将两个房间之间的“门”视为网关。 人们有时将“ 路由器 ”称为网关,因为这就是“ 通往另一个网络的网关 ”。

  • Genmask/Subnet mask: It is nothing but the net/subnet mask. A subnet mask is a number which when combined with an IP address allows you to divide the IP space into smaller and smaller chunks for use in both physical and logical networks. The explanation of how subnet mask calculations happen is beyond the scope of this article.

    Genmask / Subnet掩码:只是网络/子网掩码。 子网掩码是一个数字,当与IP地址结合使用时,您可以将IP空间分成越来越小的块,以供物理和逻辑网络使用。 子网掩码计算如何发生的解释超出了本文的范围。

  • Flags: Different flags have a different meaning. For example, in the first route, “U” in “UG” means the route is UP, whereas “G” in “UG” means GATEWAY. Since the route signifies a GATEWAY, it is a door to the other network. Whenever we send any data through this route, it gets sent to another network.

    标志:不同的标志具有不同的含义。 例如,在第一个路径中,“ UG”中的“ U”表示路径为UP,而“ UG”中的“ G”表示网关。 由于该路由表示网关,因此它是通往另一个网络的大门。 每当我们通过此路由发送任何数据时,它都会被发送到另一个网络。

  • Iface (Network interface): Network interface refers to the network that the route defined in the routing table is having the destination computer in. That is if you are connected to Wifi, then it would be “wlan” and when you are connected to a LAN, then it would be “eth”.

    Iface(网络接口):网络接口是指路由表中定义的路由具有目标计算机所在的网络。即,如果您连接到Wifi,则它将是“ wlan”,而当您连接到Wifi时。局域网,那就是“ eth”。

So this is the way a router works, with the help of Routing Protocol and Routing Table.

因此,这是路由器在“ 路由协议”和“ 路由表 的帮助下工作的方式。

All good up to now. But, you must be thinking —

到目前为止一切都很好。 但是,您必须在思考-

“Okay! But hey, we are learning about components here. I need to stitch them together and get to know how the internet works.”

“好的! 但是,我们正在这里学习组件。 我需要将它们缝合在一起,并了解互联网的工作原理。”

Cool! Some more terms and you will have a proper understanding of how everything goes.

凉! 再加上一些术语,您将对一切进行了正确的理解。

网络地址转换(NAT) (Network Address Translation (NAT))

Network address translation is a technique used by routers to provide internet service to more devices with less usage of public IPs. Thus, a router is assigned a single IP address by the ISP and it assigns the private IPs to all the devices connected to it. NAT helps the ISPs provide internet access to more consumers.

网络地址转换是路由器用于通过较少的公共IP使用量向更多设备提供Internet服务的技术。 因此,路由器由ISP分配了一个IP地址,并且将私有IP分配给了与其连接的所有设备。 NAT帮助ISP为更多消费者提供Internet访问。

Thus, if you are connected to the router of your house, your public IP will be visible to the world, but the private one will not. Whatever network packets are communicated will be addressed by your public IP (that is the public IP assigned to the router).

因此,如果您连接到房屋的路由器,则您的公共IP对全世界都是可见的,而私有IP将不可见。 无论通信什么网络数据包,都将由您的公共IP(即分配给路由器的公共IP)寻址。

Consider the above figure. Let’s say that in your home network, you are trying to access medium.com (remote static IP: 72.14.204.147), from your computer (private IP: 192.168.1.100).

考虑上图。 比方说,在您的家庭网络,您试图访问medium.com(远程静态IP: 72.14.204.147 ),从您的计算机(私有IP: 192.168.1.100 )。

So, for your computer, the connection looks like:

因此,对于您的计算机,连接如下所示:

192.168.1.100:3764172.14.204.147:80 .

192.168.1.100:37641 →交通72.14.204.147:80

“37641” is the random port number assigned by NAT router to your device/computer. (When there is network communication between daemons running on different ports on a computer, the respective port is used by NAT). Each outbound connection gets an assigned port by the NAT router.

“ 37641”是NAT路由器分配给您的设备/计算机的随机端口号。 (当计算机上不同端口上运行的守护程序之间存在网络通信时,NAT将使用相应的端口)。 每个出站连接均由NAT路由器分配一个端口。

The connection is established in NAT like:

连接是在NAT中建立的,例如:

Private IP   |PrivatePort |PublicIP |PublicPort |Remote |RemotePort
------------- ------------ --------- ----------- ------- -----------
192.168.1.100 | 37641 | 104.244.42.129 | 59273 | 72.14.204.147 | 80

But, since the outside world of the network doesn’t know about your private address, the connection looks like the following to medium.com:

但是,由于网络的外部世界不知道您的私人地址,因此与medium.com的连接如下所示

104.244.42.129:5927372.14.204.147:80 .

104.244.42.129:59273 →交通72.14.204.147:80

That way, we achieve assigning a higher number of IP addresses without wasting many public IPs.

这样,我们就可以分配更多的IP地址,而不会浪费很多公共IP。

Now, when medium.com sends the response back to 104.244.42.129:59273 , it travels all the way to your home router which then looks up for the respective private IP and private port and redirects the packet to your device/computer.

现在,当medium.com将响应发送回104.244.42.129:59273 ,它将一直传播到您的家庭路由器,然后由其查找各自的专用IP和专用端口,并将数据包重定向到您的设备/计算机。

Note: NAT is a generalized concept. NAT can be achieved as 1:1, 1:N where 1, N are the number of IP addresses in the network. A technique called as “IP Masquerading” is a 1:N NAT.

注意 :NAT是一个广义的概念。 NAT可以实现为1:1、1:N,其中1,N是网络中IP地址的数量。 一种称为“ IP伪装”的技术是1:N NAT。

动态主机配置协议(DHCP) (Dynamic Host Configuration Protocol (DHCP))

Dynamic Host Configuration Protocol or DHCP is responsible for assigning dynamic IP addresses to the hosts. The DHCP server is maintained by the ISP or previous router if there is a chain of routers to reach the host.

动态主机配置协议DHCP负责为主机分配动态IP地址。 如果有一系列路由器可以到达主机,则DHCP服务器由ISP或以前的路由器维护。

Thus, allocation of IP addresses is carried out by the DHCP server. Generally, ISP maintains a DHCP server and the routers in our houses get assigned a public IP from the DHCP server.

因此,IP地址的分配由DHCP服务器执行。 通常,ISP维护着一个DHCP服务器,并且我们家中的路由器从DHCP服务器获得了一个公共IP。

Note: Whenever a router or say a DHCP server maintained by an ISP or router restarts, the IP address allocation starts again and devices are allocated IPs which are different than the previous ones.

注意 :每当路由器或由ISP维护的DHCP服务器重新启动时,IP地址分配都会重新开始,并且设备分配的IP地址与以前的IP地址不同。

域名系统/服务器 (Domain Name System/Server)

We have already discussed that any machine is identified by the IP address.

我们已经讨论过,任何机器都由IP地址标识。

Okay, so you are running a web server on your localhost on your machine. If you have dug around in the hosts on any Linux machine, you would have encountered something like this:

好的,因此您正在计算机上的localhost上运行Web服务器。 如果您在任何Linux机器上的主机中进行挖掘,那么您将遇到以下情况:

127.0.0.1        localhost255.255.255.255  broadcasthost::1              localhost

which means that even if you type 127.0.0.1 in your browser’s URL bar, it would mean the same as localhost .

这意味着即使您在浏览器的URL栏中键入127.0.0.1 ,也将与localhost相同。

Similar to the above, the websites you use daily are web servers running on some remote instance/node having a static IP address. So, typing that IP address in your browser’s URL bar will take you to the website?

与上述类似,您每天使用的网站是在某些具有静态IP地址的远程实例/节点上运行的Web服务器。 那么,在浏览器的URL栏中键入该IP地址将带您进入网站吗?

Yes, surely it will. But, are you a superhuman to remember the IP addresses of thousands of sites?

是的,肯定会。 但是,您是记住数千个站点IP地址的超人吗?

NO.

没有。

Thus, there come the domains that we use, say medium.com, twitter.com, behance.net, codementor.io, etc.

因此,出现了我们使用的域,例如medium.com,twitter.com,behance.net,codementor.io等。

A Domain Name Server is a server having huge records of domain name mapping IP addresses which searches for the domain input and returns the respective IP address of the machine on which the website you want to access is hosted.

域名服务器是具有大量域名映射IP地址记录的服务器,该服务器搜索域名输入并返回承载您要访问的网站的计算机的相应IP地址。

How does DNS work actually?

DNS实际上如何工作?

  1. DNS is managed by your ISP (internet service provider).

    DNS由您的ISP(互联网服务提供商)管理。
  2. When we type an URL in the address bar, the data packets travel through your router, maybe multiple routers to your ISP where your DNS server is present.

    当我们在地址栏中键入URL时,数据包将通过您的路由器(也许有多个路由器)到达您的DNS服务器所在的ISP。
  3. DNS server present at the ISP looks up for the domain in its database. If an entry is found, then it returns it.

    ISP上存在的DNS服务器在其数据库中查找域。 如果找到条目,则将其返回。
  4. If any entry is not found in its primary database that it maintains, the DNS server will travel through the internet to another DNS server maintained by another ISP and check if the entry is available in that another DNS server’s database. Along with returning the IP address taken from another DNS, it will update the primary database with this new entry also.

    如果在其维护的主数据库中找不到任何条目,则DNS服务器将通过Internet到达由另一个ISP维护的另一个DNS服务器,并检查该条目在该另一个DNS服务器的数据库中是否可用。 除了返回从另一个DNS获取的IP地址外,它还将使用此新条目更新主数据库。
  5. Thus, sometimes (very rarely) a DNS server may have to traverse to multiple DNS servers to get a matching entry.

    因此,有时(非常罕见),DNS服务器可能必须遍历多个DNS服务器才能获得匹配的条目。
  6. If after traversing a lot of DNS servers across the internet, it doesn’t get a matching entry, then the DNS server throws an error indicating that the “domain name is invalid or doesn’t exist”.

    如果在Internet上遍历许多DNS服务器后,它没有找到匹配的条目,则DNS服务器会引发错误,指示“域名无效或不存在”。

Note:

注意:

The Internet Corporation for Assigned Names and Numbers (ICANN) is a consortium (a non-profit corporation) that manages the assignment of domain names and IP address ranges on behalf of the community.

互联网名称与数字地址分配机构(ICANN)是一个财团(非营利性公司),代表社区管理域名和IP地址范围的分配。

A domain is divided into three parts as shown in the following figure.

一个域分为三个部分,如下图所示。

  1. Protocol: The protocol used to access the website, for example, HTTP, HTTPS, etc.

    协议 :用于访问网站的协议,例如HTTP,HTTPS等。

  2. Domain name: The main domain name in our domain. This can be anything that is available as per the ICANN registry.

    域名 :我们域中的主要域名。 可以是ICANN注册管理机构提供的任何内容。

  3. Domain extension: This is one which is considered important while buying a domain. Generally, it is classified into two types:

    域名扩展 :这是在购买域名时被视为重要的域名扩展 。 通常,它分为两种类型:

  • Generic Top-level Domains (gTLDs): This includes most popular domain extensions like .com, .org, .net, .edu, .co, etc.

    通用顶级域名(gTLD) :包括最流行的域名扩展,例如.com,.org,.net,.edu,.co等。

  • Country Code Top-level Domains(ccTLDs): These indicate that the domain is related to the country code specified in the domain extension. For example, “.in” indicates that the website is originated from India. Also, some of the ccTLDs require that the person purchasing the domain should be from the same country. Most of the small country code extensions are not searchable from outside that country.

    国家/地区代码顶级域(ccTLD) :这些表明域与域扩展中指定的国家/地区代码相关。 例如,“。in”表示该网站源自印度。 另外,某些ccTLD要求购买域名的人应来自同一国家。 无法从该国家/地区搜索大多数的小国家/地区代码扩展名。

互联网服务提供商(ISP) (Internet Service Providers (ISPs))

Internet Service Providers are the companies that provide everyone Internet. The article you are reading now is because of the internet that your ISP provides you.

互联网服务提供商是为所有人提供互联网的公司。 您正在阅读的文章是由于您的ISP为您提供的互联网。

ISPs provide internet, handle routing your requests to the correct destination, resolve domain names with the help of DNS cache that they maintain, and handle all this network infrastructure which enables us to use the internet.

ISP提供Internet,处理将您的请求路由到正确的目的地,借助其维护的DNS缓存来解析域名,并处理所有使我们能够使用Internet的网络基础结构。

ISP is a hierarchical thing working across the internet. There are certain types of ISPs namely Tier 1, Tier 2, Tier 3 ISPs.

ISP是跨Internet工作的层次结构。 某些类型的ISP,即第1层,第2层,第3层ISP。

  • Tier 1 ISPs are the ones which connect major networks on the internet. Consider them as the major highways of the internet. They are connected to almost every network on the internet. Also, they provide internet access to the Tier 2 ISPs. ex. CERFNet, UUNet, PSINet. They are also called Network Service Providers. These ISPs are connected to each other by means of large cables going beneath the sea.

    第1层 ISP是连接Internet上主要网络的ISP。 将它们视为互联网的主要高速公路。 它们几乎连接到Internet上的每个网络。 此外,它们还提供对第2层ISP的Internet访问。 例如 CERFNet,UUNet,PSINet。 他们也称为网络服务提供商。 这些ISP通过海底下的大电缆相互连接。

  • The Tier 2 (Regional) ISPs are the ones who primarily provide Internet services to organizations, consumers (that is “us”) or the Tier 3 ISPs. The internet connection you are using is from a Tier 2 ISP. However, organizations can also get Internet access from Tier 1 ISPs.

    第2层(区域) ISP是主要为组织,消费者(即“我们”)或第3层ISP提供Internet服务的提供商。 您正在使用的Internet连接来自第2层ISP。 但是,组织也可以从一级ISP获得Internet访问。

  • Tier 3 (Local) ISPs are just like Tier 2. It’s just one more level of hierarchy out there that purchases bandwidth from Tier 2 ISP and sells it to consumers.

    第3层(本地) ISP与第2层类似。它只是那里的一个层次结构,可以从第2层ISP购买带宽并将其出售给消费者。

The traffic that goes through your router also goes through Tier 3 (if present), Tier 2, and ultimately through Tier 1 ISPs all the way to another network.

通过路由器的流量还会通过第3层(如果存在),第2层,并最终通过第1层ISP一直到达另一个网络。

Woot Woot! I am happy that you are still with me. We will put all the things together now.

呜呜! 我很高兴你仍然和我在一起。 我们现在将所有东西放在一起。

将以上所有内容放在一起 (Putting all of the above things together)

Up until now, we have learned about all the components needed to make everything work. Now, we will glue them together.

到目前为止,我们已经了解了使一切正常运行所需的所有组件。 现在,我们将它们粘合在一起。

Let’s summarize all the things we’ve learned:

让我们总结一下我们学到的所有东西:

  • When a computer/device comes online, it gets a private IP assigned by the router. The router gets a public IP from the ISP.

    当计算机/设备联机时,它将获得由路由器分配的专用IP。 路由器从ISP获取公共IP。
  • Other devices in the network are allocated unique private IPs.

    网络中的其他设备分配有唯一的专用IP。
  • ISPs are the ones who are present across the world and are connected to each other. They sell Internet services to the regional and local ISPs, from whom we, the consumers, purchase Internet.

    ISP是遍布全球且相互连接的ISP。 他们向区域和本地ISP出售Internet服务,我们,消费者从那里购买Internet。
  • Thus, when a device tries to establish a network connection with some other device on some other network, it does it with the identity of its gateway (the router). The router then maps the private IP and private port number with the public IP and random high integer public port number.

    因此,当设备尝试与某个其他网络上的某个其他设备建立网络连接时,它将使用其网关(路由器)的身份进行连接。 然后,路由器将专用IP和专用端口号与公用IP和随机的高整数公用端口号进行映射。
  • The router then sends the packets to the desired destination where some other router or gateway does the same thing as the previous router and analyses which computer/device that packet came from.

    然后,路由器将数据包发送到所需的目的地,其他路由器或网关在该目的地执行与先前路由器相同的操作,并分析该数据包来自哪台计算机/设备。
  • The remote computer/device responds by sending the destination as the public IP and public port of the router.

    远程计算机/设备通过将目的地作为路由器的公共IP和公共端口发送进行响应。
  • The router then again checks for the private IP and private port and forwards the network packets.

    然后,路由器再次检查专用IP和专用端口并转发网络数据包。

So, this is how the Internet aka A kind of Computer Network using TCP/IP protocol works.

因此,这就是Internet又称为使用TCP / IP协议的一种计算机网络的工作方式

Thanks for reading the article. If you have any questions, please feel free to ask them in the comments below.

感谢您阅读本文。 如果您有任何疑问,请随时在下面的评论中提问。

If you liked this article, please give me some ? and share it with others. See you in the next one. You are awesome!

如果您喜欢这篇文章,请给我一些? 并与他人分享。 下一个见。 你真棒!

Also, if you’d like to support me ?

另外,如果您想支持我?

Buy Sumedh Nimkarde a Coffee - BuyMeACoffee.comHello, I am Sumedh and my work is to build, break and rebuild things.www.buymeacoffee.com

买Sumedh Nimkarde喝咖啡-BuyMeACoffee.com 您好,我是Sumedh,我的工作是建造,破坏和重建事物。 www.buymeacoffee.com

Thanks a lot again for reading! Feel free to connect with me on Twitter, GitHub.

再次感谢您的阅读! 随时在TwitterGitHub上与我联系。

翻译自: https://www.freecodecamp.org/news/computer-networks-and-how-to-actually-understand-them-c1401908172d/

深入理解计算机网络

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值