Computer Networks: Crash Course Computer Science #28
Summary
TLDR本视频介绍了计算机网络的起源和发展,以及支撑它们的基本原理和技术。20世纪50年代和60年代,局域网(LAN)首次出现,主要用于组织内部,如公司或研究实验室,以促进不同人员和计算机之间的信息交换。以太网是最著名的局域网技术,它通过将计算机连接到一个共享的电缆上来进行数据传输。为了解决共享介质上的碰撞问题,以太网采用了载波监听多路访问(CSMA)和指数退避算法。随着网络的扩大,需要减少碰撞并提高效率,通过使用网络交换机将网络分割成多个碰撞域。此外,视频还探讨了数据传输的不同方法,包括电路交换和消息交换,并引入了分组交换的概念,这是现代互联网的基础。分组交换允许数据被分割成小包,通过灵活的路由进行传输,提高了网络的效率和容错性。最后,视频提到了ARPANET,它是现代互联网的前身,以及互联网协议(IP)和传输控制协议(TCP/IP)的作用。
Takeaways
- 🌐 互联网的出现极大地改变了世界,使得信息传递的速度从数周缩短到几秒钟。
- 📧 早期计算机大多是独立工作的,但随着大型计算机和低成本机器的出现,数据和资源共享变得越来越有用。
- 🖥️ 局域网(LAN)允许组织内部的计算机之间交换信息,提高了效率并减少了物理资源的重复。
- 🔌 以太网(Ethernet)是最著名的局域网技术,通过将数据作为电信号写入共享电缆来传输数据。
- 🆔 每台计算机都有一个唯一的MAC地址,用于区分网络上的数据包,这是以太网通信的基础。
- 🚫 共享传输介质(如以太网电缆)的主要问题是会发生碰撞,导致数据传输混乱。
- 🤖 计算机可以通过监听电缆上的信号来检测碰撞,并采用指数退避(Exponential Backoff)策略来减少碰撞。
- 🔄 使用网络交换机可以减少碰撞域,提高网络效率,通过隔离不同的网络段来减少设备间的冲突。
- 🔄 路由是计算机网络中的另一个基础概念,它涉及数据在不同网络间的传递,可以有多种路径选择。
- 📦 消息交换和电路交换是早期的数据传输方式,而现代互联网使用的是分组交换(Packet Switching),它更加灵活和可靠。
- 🌐 ARPANET是第一个分组交换网络,也是现代互联网的前身,它通过多个节点连接不同的计算机和网络。
- 📈 随着物联网(IoT)的发展,互联网的连接设备数量正在迅速增长,预计将接近100亿。
Q & A
互联网如何改变了信息传递的速度?
-互联网极大地提高了信息传递的速度。150年前,从伦敦到加利福尼亚发送一封信需要两到三周的时间,而现在通过电子邮件,这一过程只需要几分之一秒。这种延迟的百万倍改进,即信息传输所需的时间,促进了全球经济的发展,帮助现代世界以光速在遍布全球的光纤电缆上移动。
计算机和网络是如何开始结合使用的?
-虽然人们可能认为计算机和网络总是紧密结合的,但实际上,1970年之前的大多数计算机都是独立工作的。随着大型计算机开始普及,低成本机器开始出现在人们的办公桌上,共享数据和资源变得越来越有用,这导致了第一批计算机网络的出现。
局域网(LAN)是如何定义的?
-局域网(LAN)是相对较小的计算机网络,它们通常位于同一建筑物内或校园内,连接着多台计算机。LAN可以小到只有同一房间内的两台机器,也可以大到一个拥有数千台计算机的大学校园。
以太网(Ethernet)是如何工作的?
-以太网在其最简单的形式中,是将一系列计算机连接到一条共同的以太网电缆上。当计算机想要向另一台计算机传输数据时,它会将数据作为电信号写入电缆。由于电缆是共享的,网络上的每台计算机都能看到传输,但不知道数据是针对它们还是另一台计算机。为了解决这个问题,以太网要求每台计算机都有一个唯一的媒体访问控制地址(MAC地址)。这个独特的地址被放入一个头部,作为网络上传输的任何数据的前缀。
什么是CSMA/CD协议?
-CSMA/CD(Carrier Sense Multiple Access with Collision Detection)即载波侦听多路访问/碰撞检测协议,是一种网络通信协议。它允许计算机在检测到传输介质(如以太网电缆或Wi-Fi无线电波)空闲时发送数据,但如果检测到碰撞(即多个设备同时尝试传输数据),则可以停止传输并等待随机时间后再次尝试。
什么是冲突域?
-冲突域是指网络上的一个区域,其中的设备共享同一传输介质,并且如果两个或多个设备同时发送数据,它们可能会发生冲突。通过使用网络交换机,可以将一个大的冲突域分割成多个更小的冲突域,从而减少冲突的可能性并提高网络效率。
什么是路由和路由选择?
-路由是指在网络中从一个点到另一个点的数据传输路径的选择过程。路由选择是指网络路由器决定数据传输的最佳路径的过程。路由选择可以通过多种方式进行,包括电路交换、报文交换或分组交换。在分组交换中,数据被分成小的包,每个包独立路由,这增加了网络的灵活性和容错性。
什么是电路交换?
-电路交换是一种网络通信方式,其中在通信期间为两个通信点之间建立一个专用的通信线路。这种线路在通话期间一直占用,直到通话结束。电路交换类似于早期的电话系统,它相对不灵活且成本较高,但可以提供专用的线路容量。
什么是分组交换?
-分组交换是一种网络通信方式,它将大数据传输分解成许多小的、独立的包,这些包通过网络中的不同路由独立传输。每个包都包含目的地地址,使得路由器能够知道如何转发它们。分组交换提高了网络的效率和容错性,是现代互联网的基础。
什么是IP地址?
-IP地址(Internet Protocol Address)是分配给网络中每个设备的唯一标识符。它通常由四个用点分隔的8位数字组成,例如172.217.7.238。IP地址使得设备能够在网络中进行通信和数据传输。
什么是TCP/IP协议?
-TCP/IP协议是传输控制协议/互联网协议的缩写,是一组用于管理互联网上设备之间通信的协议。TCP负责确保数据包的有序传输和错误检查,而IP负责将数据包从源地址路由到目的地址。TCP/IP协议是互联网通信的基础。
什么是ARPANET?
-ARPANET是高级研究计划署网络(Advanced Research Projects Agency Network)的缩写,是世界上第一个分组交换网络,也是现代互联网的前身。它由美国国防部的高级研究计划署资助建立,最初连接了大学和研究机构的计算机,为后来的互联网发展奠定了基础。
Outlines
🌐 互联网的诞生与计算机网络的基本原理
Carrie Anne在CrashCourse计算机科学课程中介绍了互联网的惊人之处,它使信息传递速度大幅提升,对全球经济产生了深远影响。早期计算机独立运作,但随着大型计算机和低成本机器的普及,数据和资源共享变得日益重要,从而催生了第一批计算机网络。本节课程将探讨计算机网络的起源、基本原则和技术。20世纪50至60年代,计算机网络主要在组织内部使用,如公司或研究实验室,以促进信息交换。局域网(LAN)是这种网络的典型形式,其规模可从两台机器到整个大学校园。以太网(Ethernet)是最著名的LAN技术,至今仍被广泛使用。以太网通过将数据作为电信号写入共享电缆来传输数据,每台计算机都有一个唯一的MAC地址,以确保数据的正确传输。此外,还介绍了载波监听多路访问(CSMA)和碰撞检测机制,以及碰撞发生时的解决策略,如指数退避(Exponential Backoff)。
🔌 网络交换机与路由:构建大型计算机网络的基础
为了降低冲突率并提高效率,需要减少任何给定共享载体上的设备数量,这称为冲突域。通过使用网络交换机,可以将一个大的网络分割成多个较小的冲突域。交换机通过维护MAC地址列表来智能地转发数据,从而避免不必要的数据传输。此外,介绍了构建大型计算机网络的方法,包括互联网——由多个小型网络互相连接构成的全球性网络。讨论了路由的重要性,包括早期电话系统使用的电路交换和邮政系统类比的消息交换。消息交换通过多个中转站传递消息,提高了通信的可靠性和容错性。然而,消息交换可能导致网络拥堵,因为必须在消息完全传输到下一个中转站后才能继续传输。为了解决这个问题,引入了数据包交换的概念,将大的传输分解成许多小的数据包,每个数据包都包含目的地地址,从而提高了网络的效率和可靠性。
📦 数据包交换与互联网的演进
数据包交换是互联网目前运行的基础,它通过将数据分割成小包并沿灵活的路由传递,具有高效率和容错性。这种路由方式称为数据包交换,它还具有去中心化的特性,没有中央权威或单点故障。在冷战期间,为了防止核攻击,数据包交换被开发出来。全球的路由器使用特殊的协议,如互联网控制报文协议(ICMP)和边界网关协议(BGP),相互交换信息,以找到高效的路由。ARPANET是第一个数据包交换网络,也是现代互联网的前身。1974年的ARPANET连接了大学和研究实验室等地点的路由器和计算机。随着时间的推移,互联网经历了巨大的增长,如今估计有近100亿台设备在线,并且随着Wi-Fi连接的冰箱等智能设备的普及,互联网的增长势头仍在持续。下周的课程将探讨更高层次的传输协议,并逐步深入到万维网。
Mindmap
Keywords
💡计算机网络
💡以太网(Ethernet)
💡媒体访问控制(MAC地址)
💡载波监听多路访问(CSMA)
💡冲突域(Collision Domain)
💡指数退避(Exponential Backoff)
💡网络交换机(Network Switch)
💡路由(Routing)
💡分组交换(Packet Switching)
💡互联网协议(IP)
💡传输控制协议/互联网协议(TCP/IP)
Highlights
互联网的惊人之处在于,只需几次按键操作,我们就可以观看YouTube上的视频,阅读Wikipedia上的文章,通过亚马逊订购用品,与朋友视频聊天,以及在推特上谈论天气。
150年前,从伦敦寄信到加利福尼亚需要两到三周的时间,这还是特快专递的速度。
现代全球经济的快速发展得益于光纤电缆上的信息传输速度,这使得世界以光速移动。
20世纪70年代之前的大多数计算机都是独立工作的,但随着大型计算机的普及和低成本机器的出现,共享数据和资源变得越来越有用。
局域网(LAN)是连接附近计算机的小型网络,可以是同一房间的两台机器,也可以是拥有数千台计算机的大学校园。
以太网是最著名的局域网技术,由施乐帕洛阿尔托研究中心在20世纪70年代初开发,至今仍被广泛使用。
以太网通过将数据作为电信号写入共享电缆来传输数据,每台计算机都有一个唯一的MAC地址,以确保数据正确传输。
载波监听多路访问(CSMA)是一种网络传输方法,允许多台计算机同时感知共享传输介质并访问数据。
当网络流量增加时,两台计算机同时尝试写入数据的概率也随之增加,这会导致数据冲突。
冲突检测和退避算法(Exponential Backoff)是解决网络冲突的有效方法,通过随机等待时间来减少冲突。
为了减少冲突并提高效率,可以使用网络交换机将网络分割成多个冲突域。
互联网实际上是由许多小型网络相互连接而成的,允许网络之间的通信。
路由是计算机网络中的另一个基本话题,涉及将数据从一个地方传输到另一个地方的多种路径。
电路交换和消息交换是早期电话系统和邮政系统的工作原理,它们对现代网络通信的发展有着重要影响。
分组交换是互联网目前运行的基础,它将大数据传输分解成许多小的、灵活的路由包,提高了效率和容错性。
ARPANET是第一个分组交换网络,也是现代互联网的祖先,由美国高级研究计划局资助。
互联网自ARPANET以来已经取得了巨大的增长,现在估计接近100亿台设备在线,并且随着物联网的发展,它还在迅速增长。
下一集我们将探讨更高层次的传输协议,逐步深入到万维网。
Transcripts
Hi, I’m Carrie Anne, and welcome to CrashCourse Computer Science!
The internet is amazing.
In just a few keystrokes, we can stream videos on Youtube -- Hello! -- read articles on Wikipedia,
order supplies on amazon, video chat with friends, and tweet about the weather.
Without a doubt, the ability for computers, and their users, to send and receive information
over a global telecommunications network forever changed
the world.
150 years ago, sending a letter from London to California would have taken two to three
weeks, and that’s if you paid for express mail.
Today, that email takes a fraction of a second.
This million fold improvement in latency, that’s the time it takes for a message to
transfer, juiced up the global economy helping the modern world to move at the speed of light
on fiber optic cables spanning the globe.
You might think that computers and networks always went hand in hand, but actually most
computers pre-1970 were humming away all alone.
However, as big computers began popping up everywhere, and low cost machines started
to show up on people’s desks, it became increasingly useful to share data and resources,
and the first networks of computers appeared.
Today, we’re going to start a three-episode arc on how computer networks came into being
and the fundamental principles and techniques that power them.
INTRO
The first computer networks appeared in the 1950s and 60s.
They were generally used within an organization – like a company or research lab – to
facilitate the exchange of information between different people and computers.
This was faster and more reliable than the previous method of having someone walk a pile
of punch cards, or a reel of magnetic tape, to a computer on the other side of a building
‒ which was later dubbed a sneakernet.
A second benefit of networks was the ability to share physical resources.
For example, instead of each computer having its own printer, everyone could share one
attached to the network.
It was also common on early networks to have large, shared, storage drives, ones too expensive
to have attached to every machine.
These relatively small networks of close-by computers are called Local Area Networks,
or LANs.
A LAN could be as small as two machines in the same room, or as large as a university
campus with thousands of computers.
Although many LAN technologies were developed and deployed, the most famous and succesful
was Ethernet, developed in the early 1970s at Xerox PARC, and still widely used today.
In its simplest form, a series of computers are connected to a single, common ethernet cable.
When a computer wants to transmit data to another computer, it writes the data, as an
electrical signal, onto the cable.
Of course, because the cable is shared, every computer plugged into the network sees the
transmission, but doesn’t know if data is intended for them or another computer.
To solve this problem, Ethernet requires that each computer has a unique Media Access Control
address, or MAC address.
This unique address is put into a header that prefixes any data sent over the network.
So, computers simply listen to the ethernet cable, and only process data when they see
their address in the header.
This works really well; every computer made today comes with its own unique MAC address
for both Ethernet and WiFi.
The general term for this approach is Carrier Sense Multiple Access, or CSMA for short.
The “carrier”, in this case, is any shared transmission medium that carries data – copper
wire in the case of ethernet, and the air carrying radio waves for WiFi.
Many computers can simultaneously sense the carrier, hence the “Sense” and “Multiple
Access”, and the rate at which a carrier can transmit data is called its Bandwidth.
Unfortunately, using a shared carrier has one big drawback.
When network traffic is light, computers can simply wait for silence on the carrier, and
then transmit their data.
But, as network traffic increases, the probability that two computers will attempt to write data
at the same time also increases.
This is called a collision, and the data gets all garbled up, like two people trying to
talk on the phone at the same time.
Fortunately, computers can detect these collisions by listening to the signal on the wire.
The most obvious solution is for computers to stop transmitting, wait for silence, then
try again.
Problem is, the other computer is going to try that too, and other computers on the network
that have been waiting for the carrier to go silent will try to jump in during any pause.
This just leads to more and more collisions.
Soon, everyone is talking over one another and has a backlog of things they need to say,
like breaking up with a boyfriend over a family holiday dinner.
Terrible idea!
Ethernet had a surprisingly simple and effective fix.
When transmitting computers detect a collision, they wait for a brief period before attempting
to re-transmit.
As an example, let’s say 1 second.
Of course, this doesn’t work if all the computers use the same wait duration -- they’ll
just collide again one second later.
So, a random period is added: one computer might wait 1.3 seconds, while another waits
1.5 seconds.
With any luck, the computer that waited 1.3 seconds will wake up, find the carrier to
be silent, and start transmitting.
When the 1.5 second computer wakes up a moment later, it’ll see the carrier is in use,
and will wait for the other computer to finish.
This definitely helps, but doesn’t totally solve the problem, so an extra trick is used.
As I just explained, if a computer detects a collision while transmitting, it will wait
1 second, plus some random extra time.
However, if it collides again, which suggests network congestion, instead of waiting another
1 second, this time it will wait 2 seconds.
If it collides again, it’ll wait 4 seconds, and then 8, and then 16, and so on, until
it’s successful.
With computers backing off, the rate of collisions goes down, and data starts moving again, freeing
up the network.
Family dinner saved!
This “backing off” behavior using an exponentially growing wait time is called Exponential Backoff.
Both Ethernet and WiFi use it, and so do many transmission protocols.
But even with clever tricks like Exponential Backoff, you could never have an entire university’s
worth of computers on one shared ethernet cable.
To reduce collisions and improve efficiency, we need to shrink the number of devices on
any given shared carrier -- what’s called the Collision Domain.
Let go back to our earlier Ethernet example, where we had six computers on one shared cable,
a.k.a. one collision domain.
To reduce the likelihood of collisions, we can break this network into two collision
domains by using a Network Switch.
It sits between our two smaller networks, and only passes data between them if necessary.
It does this by keeping a list of what MAC addresses are on what side of the network.
So if A wants to transmit to C, the switch doesn’t forward the data to the other network
– there’s no need.
This means if E wants to transmit to F at the same time, the network is wide open, and
two transmissions can happen at once.
But, if F wants to send data to A, then the switch passes it through, and the two networks
are both briefly occupied.
This is essentially how big computer networks are constructed, including the biggest one
of all – The Internet – which literally inter-connects a bunch of smaller networks,
allowing inter-network communication.
What’s interesting about these big networks, is that there’s often multiple paths to
get data from one location to another.
And this brings us to another fundamental networking topic, routing.
The simplest way to connect two distant computers, or networks, is by allocating a communication
line for their exclusive use.
This is how early telephone systems worked.
For example, there might be 5 telephone lines running between Indianapolis and Missoula.
If John picked up the phone wanting to call Hank, in the 1910s, John would tell a human
operator where he wanted to call, and they’d physically connect John’s phone line into
an unused line running to Missoula.
For the length of the call, that line was occupied, and if all 5 lines were already
in use, John would have to wait for one to become free.
This approach is called Circuit Switching, because you’re literally switching whole
circuits to route traffic to the correct destination.
It works fine, but it’s relatively inflexible and expensive, because there’s often unused
capacity.
On the upside, once you have a line to yourself – or if you have the money to buy one for
your private use – you can use it to its full capacity, without having to share.
For this reason, the military, banks and other high importance operations still buy dedicated
circuits to connect their data centers.
Another approach for getting data from one place to another is Message Switching, which
is sort of like how the postal system works.
Instead of dedicated route from A to B, messages are passed through several stops.
So if John writes a letter to Hank, it might go from Indianapolis to Chicago, and then
hop to Minneapolis, then Billings, and then finally make it to Missoula.
Each stop knows where to send it next because they keep a table of where to pass letters
given a destination address.
What’s neat about Message Switching is that it can use different routes, making communication
more reliable and fault-tolerant.
Sticking with our mail example, if there’s a blizzard in Minneapolis grinding things
to a halt, the Chicago mail hub can decide to route the letter through Omaha instead.
In our example, cities are acting like network routers.
The number of hops a message takes along a route is called the hop count.
Keeping track of the hop count is useful because it can help identify routing problems.
For example, let’s say Chicago thinks the fastest route to Missoula is through Omaha,
but Omaha thinks the fastest route is through Chicago.
That's bad, because both cities are going to look at the destination address, Missoula,
and end up passing the message back and forth between them, endlessly.
Not only is this wasting bandwidth, but it’s a routing error that needs to get fixed!
This kind of error can be detected because the hop count is stored with the message and
updated along its journey.
If you start seeing messages with high hop counts, you can bet something has gone awry
in the routing!
This threshold is the Hop Limit.
A downside to Message Switching is that messages are sometimes big.
So, they can clog up the network, because the whole message has to be transmitted from
one stop to the next before continuing on its way.
While a big file is transferring, that whole link is tied up.
Even if you have a tiny, one kilobyte email trying to get through, it either has to wait
for the big file transfer to finish or take a less efficient route.
That’s bad.
The solution is to chop up big transmissions into many small pieces, called packets.
Just like with Message Switching, each packet contains a destination address on the network,
so routers know where to forward them.
This format is defined by the “Internet Protocol”, or IP for short, a standard created
in the 1970s.
Every computer connected to a network gets an IP Address.
You’ve probably seen these as four, 8-bit numbers written with dots in between.
For example,172.217.7.238 is an IP Address for one of Google’s servers.
With millions of computers online, all exchanging data, bottlenecks can appear and disappear
in milliseconds.
Network routers are constantly trying to balance the load across whatever routes they know
to ensure speedy and reliable delivery, which is called congestion control.
Sometimes different packets from the same message take different routes through a network.
This opens the possibility of packets arriving at their destination out of order, which is
a problem for some applications.
Fortunately, there are protocols that run on top of IP, like TCP/IP, that handle this
issue.
We’ll talk more about that next week.
Chopping up data into small packets, and passing these along flexible routes with spare capacity,
is so efficient and fault-tolerant, it’s what the whole internet runs on today.
This routing approach is called Packet Switching.
It also has the nice property of being decentralized, with no central authority or single point
of failure.
In fact, the threat of nuclear attack is why packet switching was developed during the
cold war!
Today, routers all over the globe work cooperatively to find efficient routings, exchanging information
with each other using special protocols, like the Internet Control Message Protocol (ICMP)
and the Border Gateway Protocol (BGP).
The world's first packet-switched network, and the ancestor to the modern internet, was
the ARPANET, named after the US agency that funded it, the Advanced Research Projects
Agency.
Here’s what the entire ARPANET looked like in 1974.
Each smaller circle is a location, like a university or research lab, that operated
a router.
They also plugged in one or more computers – you can see PDP-1’s, IBM System 360s,
and even an ATLAS in London connected over a satellite link.
Obviously the internet has grown by leaps and bounds in the decades since.
Today, instead of a few dozen computers online, it’s estimated to be nearing 10 billion.
And it continues to grow rapidly, especially with the advent of wifi-connected refrigerators
and other smart appliances, forming an “internet of things”.
So that’s part one – an overview of computer networks.
Is it a series of tubes?
Well, sort of.
Next week we’ll tackle some higher-level transmission protocols, slowly working our
way up to the World Wide Web.
I’ll see you then!
Browse More Related Video
![](https://i.ytimg.com/vi/AEaKrq3SpW8/hq720.jpg)
The Internet: Crash Course Computer Science #29
![](https://i.ytimg.com/vi/guvsH5OFizE/hq720.jpg)
The World Wide Web: Crash Course Computer Science #30
![](https://i.ytimg.com/vi/JwIXg_9lD10/hq720.jpg)
AI Boom Vs. Internet Boom
![](https://i.ytimg.com/vi/fOvTtapxa9c/hq720.jpg)
Natural Language Processing: Crash Course Computer Science #36
![](https://i.ytimg.com/vi/zl99IZvW7rE/hq720.jpg)
Geoffrey Hinton: The Foundations of Deep Learning
![](https://i.ytimg.com/vi/OVwEeSsSCHE/hqdefault.jpg?sqp=-oaymwEXCJADEOABSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLA-ug-Cn-hZJ1U9XcvNQ0mWM3OauQ)
Lecture 1.1 — Why do we need machine learning — [ Deep Learning | Geoffrey Hinton | UofT ]
5.0 / 5 (0 votes)