
ネットワークの仕組みを「困りごと」の順に辿る①つなぐ|ケーブル1本からIPアドレスとサブネットまで
ネットワークの動画を1本見た。約23分で、情報量が多すぎて途中で頭が追いつかなくなった。なので、自分用に噛み砕き直した記録を残しておく。全5本の1本目で、今回は「つなぐ」の話。
I watched a video on how networks work. It runs about 23 minutes, and the information density was more than my brain could keep up with somewhere in the middle. So I'm keeping a record of chewing it up again, for myself. This is the first of five posts, and it covers "connecting."
元の動画はYouTubeの「【入門】ネットワークの仕組み。Ethernet、TCP/IP、TLS、DNS。」だ(https://www.youtube.com/watch?v=t0tVQkIAfos)。動画の説明をそのまま並べるのではなく、自分が引っかかったところで立ち止まって、補足とツッコミを足しながら書く。私は専門家ではないので、間違いがあれば教えてほしい。
The original video is the YouTube video "【入門】ネットワークの仕組み。Ethernet、TCP/IP、TLS、DNS。" (an introduction to how networks work): https://www.youtube.com/watch?v=t0tVQkIAfos. Instead of just lining up what the video says, I'll stop wherever I got stuck, and add some background and a few comments of my own. I'm not an expert, so please tell me if I got something wrong.
全体の読み方:部品は全部「困りごと」から生まれた
動画の冒頭で、いちばん刺さった一言がある。ネットワークの部品はどれも、先に困りごとがあって作られた、という話だ。スイッチもIPアドレスもTLSも、何かが不便だったから足されたものだという。用語を1つずつ暗記するより、その順番で辿るほうが早い。
The line that stuck with me most came right at the start of the video: every piece of a network was built because a problem came first. Switches, IP addresses, TLS, all of them were added because something was inconvenient. Following that order is faster than memorizing the terms one by one.
そもそもの前提知識や基礎的なこともわかっていないので、おそらく何回も見返す必要があると思うけど、人は、ストーリーがあったほうが覚えやすいので、これはありがたい考え方。
I don't have the background knowledge or the basics down to begin with, so I will probably need to come back to this many times. But people remember things better when there is a story, so this way of thinking is a welcome one.
1台のコンピューターは、自分の中のことしか知らない
ネットワークにつながっていないコンピューターが1台ある。この状態では、その機械は自分の中の情報しか扱えない。何かと話をさせたいなら、まず物理的につながないといけない。
Imagine one computer that isn't connected to any network. It can only deal with the information inside itself. If you want it to talk to something, you first have to connect it physically.
ここは当たり前に見える。ただ、「話し相手が1台もいない状態から始める」という出発点がよかった。ここから先の部品は全部、この状態を抜け出すための工夫だ。
This looks obvious, but I liked the starting point: begin from a state where there is nobody to talk to. Every part after this is a trick for getting out of that state.
Ethernetは「線でつなぐ」ための取り決め
2台目のコンピューターを置いて、線でつなぐ。有線でつなぐときの規格がEthernet(イーサネット)だ。銅線や光ファイバーといった実際のケーブルでデータを運ぶ。同じことを電波でやるのがWi-Fiで、考え方は同じ、データを運ぶ手段が違うだけだという。この先の説明では、わかりやすいようにケーブルでつないだことにして進める。
Next we put down a second computer and connect the two with a wire. The standard for wired connections is Ethernet. It carries data over real cables such as copper wire or optical fiber. Wi-Fi does the same thing over radio waves; the idea is the same, only the way of carrying data differs. From here on I'll pretend everything is connected by cable, to keep things simple.
Ethernetを作ったのは、ゼロックスのパロアルト研究所(PARC)にいたロバート・メトカーフだ。1973年5月22日に、同じ建物のコンピューターをつなぐ「ブロードキャスト通信ネットワーク」のメモを書いている。のちに3Comという会社を作って製品として広めた(3Comは1979年創業)。
Ethernet was created by Robert Metcalfe at Xerox's Palo Alto Research Center (PARC). On May 22, 1973, he wrote a memo about a "broadcast communication network" for connecting computers in the same building. He later founded a company called 3Com and spread it as a product (3Com was founded in 1979).

(Figure description) The Xerox Palo Alto Research Center (PARC) building in Palo Alto, California, photographed in 1977. A low, cream-colored building sits on a hill under a blue sky, with a road and lawn in front and young trees on both sides.
出典:Wikimedia Commons「Xerox PARC in 1977」(作者:Dicklyon、ライセンス:CC BY-SA 4.0)
Source: Wikimedia Commons "Xerox PARC in 1977" (author: Dicklyon, license: CC BY-SA 4.0)

(Figure description) A photo of Robert Metcalfe. At a 2005 ceremony of the U.S. Department of Commerce, he speaks at a lectern wearing the National Medal of Technology. He has gray hair and wears a dark suit, and the lectern bears the Department of Commerce seal.
出典:Wikimedia Commons「Robert Metcalfe National Medal of Technology」(米国商務省技術局の写真、パブリックドメイン)
Source: Wikimedia Commons "Robert Metcalfe National Medal of Technology" (photo by the U.S. Technology Administration, Department of Commerce; public domain)

(Figure description) The first two pages of Bob Metcalfe's internal Xerox memo dated May 22, 1973. The left page is addressed to "ALTO ALOHA DISTRIBUTION" from "BOB METCALFE," with the subject "ETHER ACQUISITION," and proposes dropping the name "ALTO ALOHA NETWORK" in favor of "THE ETHER NETWORK." The right page, headed "THE ETHER NETWORK," describes a plan to build a broadcast communication network for connecting minicomputers inside a building. Hand-drawn diagrams at the top and bottom of the page show machines such as ALTOs joined by coaxial cable.
出典:Wikimedia Commons「Metcalfe Memo Establishing Basic Principles of Ethernet (Cover + 1st page)」(作者:Robert Metcalfe、パブリックドメイン)
Source: Wikimedia Commons "Metcalfe Memo Establishing Basic Principles of Ethernet (Cover + 1st page)" (author: Robert Metcalfe; public domain)

(Figure description) A photo of a small black metal box seen from above. The label on its side reads "3Com Corporation" and "MODEL 3C100," and there is a metal connector for a cable at each end of the box. On the top, Bob Metcalfe's signature and a date are written in green pen. It is an early piece of Ethernet equipment.
出典:Wikimedia Commons「Early Ethernet connector - signed by Bob Metcalfe」(作者:Daderot、CC0)
Source: Wikimedia Commons "Early Ethernet connector - signed by Bob Metcalfe" (author: Daderot; CC0)
MACアドレス:線の向こうの「誰」を指す番号
線でつないだだけでは、まだ問題が残っている。どちらも、線の向こうにいるのが誰なのかを知らない。宛先を書けなければ、データを送り出せない。
Just connecting a wire leaves a problem. Neither side knows who is at the other end. Without a destination, you can't send data out.
そこで使うのがMACアドレスだ。ネットワークにつながる機器は、製造の時点で固有の番号を持っている。48ビットの番号で、前半がメーカー、後半が個体の連番になっている。機器同士が直接つながっているときは、このMACアドレスで相手を指定する。この番号を宛先として書いて、線に流す。
That's where MAC addresses come in. Every device that connects to a network gets a unique number at the time it is manufactured. It's a 48-bit number: the first half identifies the maker, and the second half is a serial number for that individual unit. When devices are connected directly, you specify the other side by its MAC address. You write that number as the destination and send it down the wire.
要するに、機械の「製造番号つき名札」だ。工場で名札をつけられて出荷されるので、本人の意思とは関係なく、すでに名前が決まっている。ちょっと不思議な話だ。
In short, it's a name tag with a serial number. The device is tagged at the factory and shipped, so its name is already decided regardless of its own wishes. Kind of strange when you think about it.

(Figure description) Two computers are connected by a cable, left and right. Each has a name tag showing its MAC address. The left one, computer A, is 3C:22:FB:A1:5E:09, and the right one, computer B, is 3C:22:FB:7D:10:C4. The first 24 bits (3C:22:FB) identify the maker, shown in blue, and are the same on both. The last 24 bits are a serial number for each unit, shown in teal, and differ between the two. The total is 48 bits. Below the figure it says: "On the same wire, you specify the other side by this number." The numbers are made-up values for illustration. The heading reads: "A MAC address is a name tag a machine has from the start."
スイッチ:10台つなぐとケーブルが45本になる
MACアドレスで相手を指定する方法は、2台だから成り立つ。台数が増えて、全部を直接つなごうとするとどうなるか。10台なら、ケーブルは45本必要になる。台数が増えるほど、線の数はどんどん増える。
Specifying the other side by MAC address works because there are only two devices. What happens when the number grows and you try to connect all of them directly? With 10 devices you need 45 cables, and the number of lines keeps ballooning as devices increase.
Claudeが計算してみた。n台を全部つなぐと、n×(n−1)÷2本になる。10台なら10×9÷2で45本。20台にしたら190本。配線しながら人生を見つめ直すレベルだ。
Claude did the math. Connecting n devices in full takes n × (n − 1) ÷ 2 cables. For 10 devices, that's 10 × 9 ÷ 2 = 45. For 20 devices it's 190. You'd be reevaluating your life choices while plugging things in.
そこで真ん中に置くのがスイッチだ。同じネットワークの中の機器をまとめてつなぐための装置で、全員がスイッチに1本ずつつなげばそれで足りる。10台なら10本でいい。45本が10本になる。
So we put a switch in the middle. It's a device that connects the machines in the same network together, and everyone only needs one cable to the switch. For 10 devices, 10 cables are enough. 45 becomes 10.

(Figure description) Two diagrams sit side by side. On the left, 10 computers are arranged in a circle with every pair connected by a gray line, 45 lines in total, labeled "45" in large type. The formula is 10 × 9 ÷ 2 = 45. On the right, the same 10 computers are each connected by one blue line to a switch in the center, 10 lines in total, labeled "10" in large type. The heading reads: "Connect 10 machines to each other and you need 45 cables. Put a switch in the middle and you need 10." The number of pairs is n × (n − 1) ÷ 2.
スイッチはもう1つ仕事をしている。どのポートの先に、どのMACアドレスの機器がいるのかを、表にして覚えているのだ。届いたデータの宛先を読んで、その機器だけに送る。全員にばらまかないので、無駄な通信が減る。
The switch does one more job. It remembers, in a table, which MAC address is behind which port. It reads the destination of incoming data and sends it only to that device. Since it doesn't spray it to everyone, useless traffic goes down.

(Figure description) A photo of a small silver-and-black box-shaped switch, taken from diagonally above. The oval black label on top reads "5-Port 10/100Mbps Ethernet Switch," with a "POWER" light and lamps for ports 1 to 5. It has five ports.
出典:Wikimedia Commons「Ethernet switch Atlantis A02-F5P 5 ports frontend」(作者:Sub、パブリックドメイン)
Source: Wikimedia Commons "Ethernet switch Atlantis A02-F5P 5 ports frontend" (author: Sub; public domain)
余談:スイッチを何台もつなぐと、データが回り続ける
スイッチを何台もつなぐと、予備の線が輪っか(ループ)になって、データが回り続けることがある。これを防ぐ仕組みがスパニングツリー(STP)で、考えたのはDECにいたラディア・パールマンだ。予備の線は残しつつ、普段は使わないようにしておく仕組みだと理解した。ここは詳しく調べていないので、概略だけにしておく。
When you connect many switches, the spare cables can form a loop, and data can circle forever. The mechanism that prevents this is the Spanning Tree Protocol (STP), designed by Radia Perlman, who worked at DEC. My understanding is that it keeps the spare cables in place but leaves them unused during normal operation. I haven't looked into this in detail, so I'll leave it at the outline.

(Figure description) A photo of Radia Perlman (2009). A woman with long hair, wearing a blue and navy jacket, sits in a chair and smiles toward the camera. On her lap she holds an open, thick book with a blue cover, "Interconnections, Second Edition."
出典:Wikimedia Commons「Radia Perlman 2009」(作者:Scientist-100、パブリックドメイン)
Source: Wikimedia Commons "Radia Perlman 2009" (author: Scientist-100; public domain)
IPアドレス:ネットワークをまたぐための別の住所
MACアドレスには大きな制限がある。同じネットワークの中でしか使えず、別のネットワークにいる機器にはMACアドレスでは届かない。つまり、ネットワークをまたいで使える別の住所が必要になる。
MAC addresses have a big limitation. They only work inside the same network. A device on another network can't be reached by its MAC address. In other words, we need another kind of address that works across networks.
それがIPアドレスだ。機器を見つけるために割り当てる、論理的な住所のこと。0から255までの数字を4つ並べた形をしている。全体で32ビットの番号だ。
That's the IP address: a logical address assigned for finding a device. It looks like four numbers from 0 to 255 lined up, and the whole thing is a 32-bit number.
MACアドレスとの違いは、変わるかどうかだ。MACアドレスは機械に焼きついていて、基本的に変わらない。IPアドレスは、つなぐネットワークが変われば別の番号になる。私の頭の中では、MACは「本籍」、IPは「今住んでいる場所」という感じで整理した。
The difference from a MAC address is whether it changes. A MAC address is burned into the machine and basically never changes. An IP address becomes a different number when you connect to a different network. In my head I sorted it out like this: the MAC address is the permanent registered address, and the IP address is where you live right now.
IPアドレスには大きく2つのバージョンがある。今説明したのがIPv4で、32ビット、およそ43億個だ。43億と聞くと多く感じるが、世界中がつながる時代には足りなくなった。1人が何台も端末を持つようになって、割り当てる番号が尽きたのだ。
There are two main versions of IP addresses. What I just described is IPv4: 32 bits, about 4.3 billion addresses. 4.3 billion sounds like a lot, but it wasn't enough once the whole world got connected. People started owning several devices each, and the numbers ran out.
そこで作られたのがIPv6で、128ビットのアドレスを使う。個数は約3.4×10の38乗で、動画は「地球上の砂粒の数と比べられる」と言っていたが、砂粒は多めに見積もっても10の19乗個くらいなので、比べるのが失礼なレベルで多い。しばらく足りなくなる心配はない。43億では足りなかったので、いきなり砂粒をぶっちぎる数まで盛った、というふうに見える。
So IPv6 was created, using 128-bit addresses. The count is about 3.4 × 10^38. The video said it is comparable to the number of grains of sand on Earth, but even a generous estimate of sand grains is around 10^19, so it's more than that by an almost insulting margin. There's no worry of running out for a while. It looks like they went from "4.3 billion wasn't enough" to a number that leaves the grains of sand far behind.
DHCP:IPアドレスを自動で貸してくれる仕組み
IPアドレスをもらう方法は大きく2つある。1つは、設定画面を開いて自分で入力する方法で、固定IPアドレス(スタティックIP)と呼ぶ。もう1つがDHCPで、ダイナミック・ホスト・コンフィギュレーション・プロトコルの略だ。設定を自動で配る仕組みになっている。
There are two main ways to get an IP address. One is opening a settings screen and typing it in yourself, called a static IP address. The other is DHCP, short for Dynamic Host Configuration Protocol, which hands out settings automatically.
DHCPは、4つのやり取りでIPアドレスを決める。まず、端末が「誰かいますか?」と全体に呼びかける。これがDiscover(ディスカバー)。サーバーが「このアドレスはどうですか?」と返すのがOffer(オファー)。端末が「それをください」と返すのがRequest(リクエスト)。最後にサーバーが「どうぞ」と確定するのがAck(アック)だ。頭文字をとってDORA(ドラ)と呼ぶらしい。
DHCP decides an IP address through four exchanges. First, the device calls out to everyone: "Is anyone there?" That's Discover. The server replies, "How about this address?" That's Offer. The device answers, "I'll take it," which is Request. Finally the server confirms with "here you go," which is Ack. Taking the initials, it's called DORA.
DORA(ドラ)と聞いて、私はドラえもんよりも、アニメ『Dora the Explorer』のドーラが先に浮かんだ。
Hearing "DORA," I thought of Dora the Explorer, the cartoon, before I thought of Doraemon.

(Figure description) Your computer (the client) stands on the left and the DHCP server on the right, with four exchanges lined up from top to bottom. First, Discover: from the computer to the server, "Is anyone there?" (a call to everyone). Second, Offer: from the server to the computer, "How about this address?" Third, Request: from the computer to the server, "I'll take it." Fourth, Ack: from the server to the computer, "Here you go. This is final." Arrows from the computer to the server are blue, and arrows from the server to the computer are teal. The gray box at the bottom lists four things handed out together: the IP address, the subnet mask, the default gateway and the DNS server, with a note: "Only lent. When the lease expires, borrow again." The heading reads: "DHCP lends you an IP address in four exchanges." Taking the initials gives DORA.
DHCPが配るのはIPアドレスだけではない。サブネットマスク、デフォルトゲートウェイ、DNSサーバーもまとめて渡される。この4つがそろうと、端末は何も設定せずに通信を始められる。
DHCP hands out more than just the IP address. It also passes along the subnet mask, the default gateway, and the DNS server. With all four in hand, a device can start communicating without any manual setup.
もう1つ大事なのは、配られたIPアドレスは「あげたもの」ではなく「貸したもの」だという点だ。リース時間が決まっていて、期限が来たら借り直す。これで使われていない番号が回収されて、重複も防げる。
One more important point: the IP address you receive is not given but lent. There's a lease time, and when it expires, the device borrows again. That way unused numbers get reclaimed and duplicates are avoided.
サブネット:自分のネットワークの「広さ」を表す数字
次はサブネットだ。IPアドレスは、前半が「どのネットワークか」、後半が「その中の何番目か」を表す。どこで区切るかを決めるのが、スラッシュの後ろの数字だ。たとえば「/24」なら、前から24ビットがネットワーク部になる。残りは8ビットなので、同じネットワークに入れる機器は254台になる。
Next is the subnet. The first half of an IP address says which network, and the second half says which number inside it. The number after the slash decides where to split. For example, with "/24" the first 24 bits are the network part. The remaining 8 bits mean 254 devices can fit in the same network.
ここで「256ではなく254なのはなぜ?」と引っかかる意識は、私には全く出なかった。そんなところに思考がいくような頭の良さはない。ちなみに、8ビットなら2の8乗で256通りあるが、最初の1つ(ネットワーク自体を指す番号)と最後の1つ(全員宛ての番号)は機器に割り当てられないので、254台になる。これはClaudeが動画の説明に補った部分なので、念のため。
Here, the thought "why 254 and not 256?" never even registered with me. I'm not smart enough for my thinking to go to a place like that. For the record, eight bits give 2 to the power of 8, which is 256 patterns, but the first one (the number that refers to the network itself) and the last one (the number for sending to everyone) can't be assigned to devices, so 254 remain. Claude added this part to the video's explanation, just so you know.

(Figure description) The address 192.168.1.0/24 is shown as a band of 32 small squares. The band is split into four groups of eight, with "192", "168", "1" and "0" written above them and "8 bits" under each. The first three groups (192, 168 and 1, 24 bits in total) are blue and mean "network part (first 24 bits): which network." The last group (0, 8 bits) is teal and means "device number (last 8 bits): which one inside that network." Below it says "2 to the power of 8 is 256; subtract the first and last numbers," and a gray box says "254 devices fit in the same network (the first and last numbers are reserved)." The heading reads: "With /24, the first 24 of the 32 bits are the network."
つまりサブネットとは、自分のネットワークの広さを表す情報だ。端末は、送りたい相手が自分と同じネットワークにいるかどうかを、毎回判定している。同じ中ならスイッチに直接渡し、外なら別の場所に渡す。この判定にサブネットの情報を使う。
So a subnet is information that expresses how big your own network is. A device checks every time whether the party it wants to reach is on the same network as itself. If it's inside, it hands the data directly to the switch; if outside, it hands it to somewhere else. The subnet information is used for that check.
「別の場所に渡す」の続きは、次の記事で書く。
How "hand it to somewhere else" works is the topic of the next post.
今回のまとめ:困りごとの順に並べると
最後に、今回の内容を「困りごと→部品」の順に並べておく。
Finally, here is this post lined up in the order of problem and then part.
2台をつなぎたい → Ethernet(Wi-Fiは電波版)
Want to connect two machines → Ethernet (Wi-Fi is the radio version)
相手が誰かわからない → MACアドレス
Don't know who the other side is → MAC address
台数が増えると線が爆発する → スイッチ
Cables explode as devices grow → switch
ネットワークをまたげない → IPアドレス
Can't cross networks → IP address
手入力が面倒 → DHCP
Typing settings by hand is tedious → DHCP
相手が同じネットワークかわからない → サブネット
Can't tell if the other side is on the same network → subnet
次回は「届ける」。別のネットワークへ出る出口(ルーター)から、経路の決め方(OSPFとBGP)、届くか試すpingまで。
Next time is "delivering": from the exit to other networks (the router), through how routes get decided (OSPF and BGP), to ping, which tests whether anything arrives.