{"schema":"article/1","id":"art_638c11f655","owner":"u_owner","status":"published","visibility":"public","version":1,"title":"外から読めるのは、外側の宛先と取り決めの番号だけ","rawTitle":"外から読めるのは、外側の宛先と取り決めの番号だけ","slug":"nw-basics-11-ipsec","file":"ネットワーク_11_IPsec","relPath":"content/published/ネットワーク_11_IPsec.md","aliases":[],"kind":"published","area":"tech","topic":"ネットワーク","category":"ネットワーク","tags":["ネットワーク","ipsec","vpn","暗号","concept"],"summary":"図 10 と同じ入れ子に ESP で封をして、途中の誰にも中身を読ませない。口に貼った組が守る通信を選び、送信用と受信用で別々の取り決めを使う","date":"2026-09-14","updated":"2026-09-14","links":["nw-basics-index","nw-basics-00-three-layers","nw-basics-10-gre","nw-basics-12-ike","nw-basics-09-acl"],"blocks":[{"id":"blk_15d3c4","type":"paragraph","markdown":"図 10 で、社内あてのパケットを別のパケットの中に入れて運べるようになりました。","text":"図 10 で、社内あてのパケットを別のパケットの中に入れて運べるようになりました。","line":2,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_7f60a8","type":"paragraph","markdown":"ただし、入れただけでは途中の機器が開けば中身が読めます。\n勉強会では、ping の中身が読める状態と、ESP に変わって読めない状態を並べて見ました。\nこの記事は、図 7 で挙げた 3 つの問題のうち、最後に残った「通信の中身は誰にでも読めます」を解きます。","text":"ただし、入れただけでは途中の機器が開けば中身が読めます。\n勉強会では、ping の中身が読める状態と、ESP に変わって読めない状態を並べて見ました。\nこの記事は、図 7 で挙げた 3 つの問題のうち、最後に残った「通信の中身は誰にでも読めます」を解きます。","line":4,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_bb713c","type":"paragraph","markdown":"この連載は、ネットワークの言葉を 3 つの層に置いて読みます。\nもの（物理か論理か）、結びつき（人が設定で付ける手動か、機器が学習する自動か、製造時に決まる固定か）、通信フロー（1 本の通信がそれらを順に通る道筋）の 3 つです。","text":"この連載は、ネットワークの言葉を 3 つの層に置いて読みます。\nもの（物理か論理か）、結びつき（人が設定で付ける手動か、機器が学習する自動か、製造時に決まる固定か）、通信フロー（1 本の通信がそれらを順に通る道筋）の 3 つです。","line":8,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_34ba84","type":"heading","depth":2,"markdown":"## 登場するもの","text":"登場するもの","line":11,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_07e6fa","type":"heading","depth":4,"markdown":"#### ESP ヘッダ","text":"ESP ヘッダ","line":13,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_dc2b97","type":"paragraph","markdown":"論理のもので、通信 1 つずつに付きます。\n中には SPI（取り決めの番号）と連番が入ります。\nESP を運ぶパケットは、外側 IP ヘッダのプロトコルの欄が 50 です。\n図 10 では 47 でした。","text":"論理のもので、通信 1 つずつに付きます。\n中には SPI（取り決めの番号）と連番が入ります。\nESP を運ぶパケットは、外側 IP ヘッダのプロトコルの欄が 50 です。\n図 10 では 47 でした。","line":15,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_b43297","type":"heading","depth":4,"markdown":"#### AH","text":"AH","line":20,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_7043b7","type":"paragraph","markdown":"改ざん検知だけで、暗号化しない封です。\n外側のプロトコル番号は 51 です。\nこの図では使いません。","text":"改ざん検知だけで、暗号化しない封です。\n外側のプロトコル番号は 51 です。\nこの図では使いません。","line":22,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_1002db","type":"heading","depth":4,"markdown":"#### SA（安全の取り決め）","text":"SA（安全の取り決め）","line":26,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_f541a7","type":"paragraph","markdown":"論理のもので、相手・暗号の方式・鍵・SPI・寿命の組です。\n片道に 1 つで、送る側用と受け取る側用は別物です。\nだからデータ用は 1 つの相手につき 2 本になります。\n勉強会で見た `Active SAs: 2` はこの 2 本です。\n打合せ用の取り決めは、これとは別にもう 1 つできます。","text":"論理のもので、相手・暗号の方式・鍵・SPI・寿命の組です。\n片道に 1 つで、送る側用と受け取る側用は別物です。\nだからデータ用は 1 つの相手につき 2 本になります。\n勉強会で見た Active SAs: 2 はこの 2 本です。\n打合せ用の取り決めは、これとは別にもう 1 つできます。","line":28,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_62cb13","type":"heading","depth":4,"markdown":"#### crypto map","text":"crypto map","line":34,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_4e5b44","type":"paragraph","markdown":"論理のもので、人が書きます。\n相手・守る通信の並び（図 9 の ACL）・暗号の組合せを 1 つに束ね、外向きの口に貼ります。","text":"論理のもので、人が書きます。\n相手・守る通信の並び（図 9 の ACL）・暗号の組合せを 1 つに束ね、外向きの口に貼ります。","line":36,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_30ff82","type":"heading","depth":4,"markdown":"#### 2 つのモード","text":"2 つのモード","line":39,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_272127","type":"paragraph","markdown":"トンネルモードは元の IP ヘッダごと包むので、社内の宛先も送信元も外から見えません。\nトランスポートモードは元の IP ヘッダを残し、中身だけを守ります。\nこの図の拠点間はトンネルモードです。","text":"トンネルモードは元の IP ヘッダごと包むので、社内の宛先も送信元も外から見えません。\nトランスポートモードは元の IP ヘッダを残し、中身だけを守ります。\nこの図の拠点間はトンネルモードです。","line":41,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_118c7a","type":"heading","depth":2,"markdown":"## 結びつき","text":"結びつき","line":45,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_e249c9","type":"list","markdown":"- crypto map ⇄ 外向きの口は手動です。貼った口を出入りする通信だけが判定にかかります。守りたい通信がその口から出る経路に乗っていることが前提で、この図では 0.0.0.0/0 → 203.0.113.1（Gi1）の行がその役をしています。経路が別の口を向いていれば、貼った組は一度も効きません。\n- crypto map ⇄ 守る通信の並び・相手・暗号の組合せも手動です。両側で同じものにしないと合いません。片側だけ直すと通らなくなります。\n- SA は自動でできます。ただし勝手に湧くのではなく、打合せ（図 12）の結果としてできます。","text":"crypto map ⇄ 外向きの口は手動です。貼った口を出入りする通信だけが判定にかかります。守りたい通信がその口から出る経路に乗っていることが前提で、この図では 0.0.0.0/0 → 203.0.113.1（Gi1）の行がその役をしています。経路が別の口を向いていれば、貼った組は一度も効きません。crypto map ⇄ 守る通信の並び・相手・暗号の組合せも手動です。両側で同じものにしないと合いません。片側だけ直すと通らなくなります。SA は自動でできます。ただし勝手に湧くのではなく、打合せ（図 12）の結果としてできます。","line":47,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_df21fc","type":"heading","depth":2,"markdown":"## 通信フロー","text":"通信フロー","line":51,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_0952be","type":"paragraph","markdown":"支店の A（192.168.10.10）から、データセンターの C（192.168.3.10）へ送ります。","text":"支店の A（192.168.10.10）から、データセンターの C（192.168.3.10）へ送ります。","line":53,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_f36488","type":"paragraph","markdown":"① A はデフォルトゲートウェイ（ルータ 1）へ送ります。図 10 の ① と同じで、PC 側は何も変わりません。","text":"① A はデフォルトゲートウェイ（ルータ 1）へ送ります。図 10 の ① と同じで、PC 側は何も変わりません。","line":55,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_caa6d2","type":"paragraph","markdown":"② ルータ 1 は、外向きの口に貼った組の中の「守る通信の並び」に、このパケットが一致するかを上から順に見ます。一致したので、送信用の SA に書かれた方式と鍵で元のパケットをまるごと暗号化し、ESP ヘッダと外側 IP ヘッダを付けます。一致しない通信はそのまま素通しで出ていきます。","text":"② ルータ 1 は、外向きの口に貼った組の中の「守る通信の並び」に、このパケットが一致するかを上から順に見ます。一致したので、送信用の SA に書かれた方式と鍵で元のパケットをまるごと暗号化し、ESP ヘッダと外側 IP ヘッダを付けます。一致しない通信はそのまま素通しで出ていきます。","line":57,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_899e8a","type":"paragraph","markdown":"③ プロバイダのルータは外側の宛先 198.51.100.20 だけを見て運びます。途中で開いても、暗号化された固まりと ESP の札しか見えません。","text":"③ プロバイダのルータは外側の宛先 198.51.100.20 だけを見て運びます。途中で開いても、暗号化された固まりと ESP の札しか見えません。","line":59,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_75680e","type":"paragraph","markdown":"④ ルータ 2 は ESP ヘッダの SPI でどの受信用 SA かを選び、改ざん検知をしてから復号します。出てくるのは ① と同じパケットです。","text":"④ ルータ 2 は ESP ヘッダの SPI でどの受信用 SA かを選び、改ざん検知をしてから復号します。出てくるのは ① と同じパケットです。","line":61,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_531710","type":"paragraph","markdown":"⑤ ルータ 2 は出てきたパケットを自分のテーブルで探し、Gi1 から C へ送ります。","text":"⑤ ルータ 2 は出てきたパケットを自分のテーブルで探し、Gi1 から C へ送ります。","line":63,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_318d8e","type":"heading","depth":2,"markdown":"## 図 11","text":"図 11","line":65,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_193212","type":"paragraph","markdown":"図の上半分が構成図と封の種類・モード・SA、下半分が各テーブルと設定・通信の中身の推移です。","text":"図の上半分が構成図と封の種類・モード・SA、下半分が各テーブルと設定・通信の中身の推移です。","line":67,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_b4c4a1","type":"html","markdown":"<svg viewBox=\"0 0 900 1620\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-label=\"IPsec：図 10 の入れ子に ESP で封をする\" style=\"max-width:100%;height:auto;font-family:sans-serif\">\n  <rect x=\"0\" y=\"0\" width=\"900\" height=\"1620\" fill=\"#fbfcfe\"/>\n  <text x=\"20\" y=\"30\" text-anchor=\"start\" font-size=\"14\" font-weight=\"700\" fill=\"#1f2937\">IPsec：図 10 の入れ子に封をして、途中の誰にも中身を読ませない</text>\n  <text x=\"20\" y=\"50\" text-anchor=\"start\" font-size=\"11\" fill=\"#6b7280\">図 7 の問題 3（途中は他人のルータなので中身が誰にでも読める）の解。包む形は図 10 と同じで、内側がまるごと暗号化される</text>\n  <rect x=\"20\" y=\"80\" width=\"250\" height=\"250\" rx=\"10\" fill=\"none\" stroke=\"#9aa7b5\" stroke-width=\"1.5\" stroke-dasharray=\"6 4\"/>\n  <text x=\"32\" y=\"100\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#6b7280\">支店（自分のもの）</text>\n  <rect x=\"290\" y=\"80\" width=\"320\" height=\"250\" rx=\"10\" fill=\"#fff7ed\" stroke=\"#d97706\" stroke-width=\"1.5\" stroke-dasharray=\"6 4\"/>\n  <text x=\"302\" y=\"100\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#b45309\">インターネット（他人のもの）</text>\n  <rect x=\"630\" y=\"80\" width=\"250\" height=\"250\" rx=\"10\" fill=\"none\" stroke=\"#9aa7b5\" stroke-width=\"1.5\" stroke-dasharray=\"6 4\"/>\n  <text x=\"642\" y=\"100\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#6b7280\">データセンター（自分のもの）</text>\n  <rect x=\"32\" y=\"206\" width=\"80\" height=\"56\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"72.0\" y=\"226\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">PC-A</text>\n  <text x=\"72.0\" y=\"244\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">192.168.10.10</text>\n  <text x=\"72.0\" y=\"259\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">GW 192.168.10.1</text>\n  <line x1=\"112\" y1=\"234\" x2=\"150\" y2=\"234\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"150\" y=\"192\" width=\"110\" height=\"84\" rx=\"8\" fill=\"#f2f5f9\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"205.0\" y=\"212\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1</text>\n  <text x=\"205.0\" y=\"230\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi0 192.168.10.1</text>\n  <text x=\"205.0\" y=\"245\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi1 203.0.113.10</text>\n  <text x=\"205.0\" y=\"260\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">（グローバル IP）</text>\n  <rect x=\"141\" y=\"225\" width=\"18\" height=\"18\" fill=\"#ffffff\" stroke=\"#6b7280\" stroke-width=\"1.5\"/><text x=\"150\" y=\"238\" text-anchor=\"middle\" font-size=\"8\" fill=\"#1f2937\">Gi0</text>\n  <rect x=\"251\" y=\"225\" width=\"18\" height=\"18\" fill=\"#ffffff\" stroke=\"#6b7280\" stroke-width=\"1.5\"/><text x=\"260\" y=\"238\" text-anchor=\"middle\" font-size=\"8\" fill=\"#1f2937\">Gi1</text>\n  <line x1=\"269\" y1=\"234\" x2=\"330\" y2=\"234\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"330\" y=\"206\" width=\"70\" height=\"56\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"365.0\" y=\"226\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ISP-1</text>\n  <text x=\"365.0\" y=\"244\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">他人の</text>\n  <text x=\"365.0\" y=\"259\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">ルータ</text>\n  <line x1=\"400\" y1=\"234\" x2=\"415\" y2=\"234\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"415\" y=\"206\" width=\"70\" height=\"56\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"450.0\" y=\"226\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ISP-2</text>\n  <text x=\"450.0\" y=\"244\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">他人の</text>\n  <text x=\"450.0\" y=\"259\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">ルータ</text>\n  <line x1=\"485\" y1=\"234\" x2=\"500\" y2=\"234\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"500\" y=\"206\" width=\"70\" height=\"56\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"535.0\" y=\"226\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ISP-3</text>\n  <text x=\"535.0\" y=\"244\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">他人の</text>\n  <text x=\"535.0\" y=\"259\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">ルータ</text>\n  <line x1=\"570\" y1=\"234\" x2=\"640\" y2=\"234\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"640\" y=\"192\" width=\"110\" height=\"84\" rx=\"8\" fill=\"#f2f5f9\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"695.0\" y=\"212\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ルータ 2</text>\n  <text x=\"695.0\" y=\"230\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi0 198.51.100.20</text>\n  <text x=\"695.0\" y=\"245\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">（グローバル IP）</text>\n  <text x=\"695.0\" y=\"260\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi1 192.168.3.1</text>\n  <rect x=\"631\" y=\"225\" width=\"18\" height=\"18\" fill=\"#ffffff\" stroke=\"#6b7280\" stroke-width=\"1.5\"/><text x=\"640\" y=\"238\" text-anchor=\"middle\" font-size=\"8\" fill=\"#1f2937\">Gi0</text>\n  <rect x=\"741\" y=\"225\" width=\"18\" height=\"18\" fill=\"#ffffff\" stroke=\"#6b7280\" stroke-width=\"1.5\"/><text x=\"750\" y=\"238\" text-anchor=\"middle\" font-size=\"8\" fill=\"#1f2937\">Gi1</text>\n  <line x1=\"759\" y1=\"234\" x2=\"790\" y2=\"234\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"790\" y=\"206\" width=\"80\" height=\"56\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"830.0\" y=\"226\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">PC-C</text>\n  <text x=\"830.0\" y=\"244\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">192.168.3.10</text>\n  <text x=\"830.0\" y=\"259\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">GW 192.168.3.1</text>\n  <rect x=\"150\" y=\"125\" width=\"110\" height=\"46\" rx=\"8\" fill=\"#fff1dc\" stroke=\"#d97706\" stroke-width=\"1.5\"/>\n  <text x=\"205.0\" y=\"145\" text-anchor=\"middle\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">crypto map</text>\n  <text x=\"205.0\" y=\"163\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi1 に貼る（手動）</text>\n  <rect x=\"640\" y=\"125\" width=\"110\" height=\"46\" rx=\"8\" fill=\"#fff1dc\" stroke=\"#d97706\" stroke-width=\"1.5\"/>\n  <text x=\"695.0\" y=\"145\" text-anchor=\"middle\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">crypto map</text>\n  <text x=\"695.0\" y=\"163\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi0 に貼る（手動）</text>\n  <line x1=\"205\" y1=\"192\" x2=\"205\" y2=\"171\" stroke=\"#d97706\" stroke-width=\"1.5\" stroke-dasharray=\"4 3\"/>\n  <line x1=\"695\" y1=\"192\" x2=\"695\" y2=\"171\" stroke=\"#d97706\" stroke-width=\"1.5\" stroke-dasharray=\"4 3\"/>\n  <line x1=\"260\" y1=\"143\" x2=\"640\" y2=\"143\" stroke=\"#d97706\" stroke-width=\"2.5\"/>\n  <line x1=\"260\" y1=\"153\" x2=\"640\" y2=\"153\" stroke=\"#d97706\" stroke-width=\"2.5\"/>\n  <rect x=\"410\" y=\"136\" width=\"80\" height=\"24\" rx=\"4\" fill=\"#fff7ed\" stroke=\"#d97706\" stroke-width=\"1.5\"/>\n  <text x=\"450\" y=\"152\" text-anchor=\"middle\" font-size=\"11\" font-weight=\"700\" fill=\"#b45309\">ESP で封</text>\n  <text x=\"450\" y=\"118\" text-anchor=\"middle\" font-size=\"11\" font-weight=\"700\" fill=\"#b45309\">図 10 と同じ入れ子。中の 1 枚が GRE から ESP に変わる</text>\n  <text x=\"450\" y=\"180\" text-anchor=\"middle\" font-size=\"10\" fill=\"#6b7280\">外から読めるのは、外側の宛先・送信元と取り決めの番号（SPI）だけ</text>\n  <text x=\"450\" y=\"194\" text-anchor=\"middle\" font-size=\"10\" fill=\"#6b7280\">相手・守る通信・暗号の方式を束ねたものを口に貼る（手動）</text>\n  <line x1=\"112\" y1=\"300\" x2=\"142\" y2=\"300\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"141,295 141,305 150,300\" fill=\"#0a7aff\"/>\n  <circle cx=\"131\" cy=\"300\" r=\"9\" fill=\"#0a7aff\"/><text x=\"131\" y=\"304\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">1</text>\n  <circle cx=\"205\" cy=\"300\" r=\"9\" fill=\"#0a7aff\"/><text x=\"205\" y=\"304\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">2</text>\n  <line x1=\"269\" y1=\"300\" x2=\"623\" y2=\"300\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"622,295 622,305 631,300\" fill=\"#0a7aff\"/>\n  <circle cx=\"450\" cy=\"300\" r=\"9\" fill=\"#0a7aff\"/><text x=\"450\" y=\"304\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">3</text>\n  <circle cx=\"695\" cy=\"300\" r=\"9\" fill=\"#0a7aff\"/><text x=\"695\" y=\"304\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">4</text>\n  <line x1=\"760\" y1=\"300\" x2=\"784\" y2=\"300\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"783,295 783,305 792,300\" fill=\"#0a7aff\"/>\n  <circle cx=\"745\" cy=\"300\" r=\"9\" fill=\"#0a7aff\"/><text x=\"745\" y=\"304\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">5</text>\n  <text x=\"205\" y=\"322\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#0a7aff\">封をする</text>\n  <text x=\"695\" y=\"322\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#0a7aff\">封を開ける</text>\n  <text x=\"450\" y=\"322\" text-anchor=\"middle\" font-size=\"10\" fill=\"#b45309\">途中で開いても「ESP」としか分からない</text>\n  <rect x=\"20\" y=\"348\" width=\"280\" height=\"124\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"32\" y=\"368\" text-anchor=\"start\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ESP と AH（封の種類）</text>\n  <text x=\"32\" y=\"386\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">ESP：暗号化（読めなくする）と改ざん検知</text>\n  <text x=\"32\" y=\"401\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　　 外側のプロトコル番号は 50</text>\n  <text x=\"32\" y=\"416\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">AH ：改ざん検知だけ。暗号化はしない</text>\n  <text x=\"32\" y=\"431\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　　 外側のプロトコル番号は 51</text>\n  <text x=\"32\" y=\"446\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">ESP と AH を重ねる使い方は</text>\n  <text x=\"32\" y=\"461\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">RFC 8221 で NOT RECOMMENDED</text>\n  <rect x=\"310\" y=\"348\" width=\"280\" height=\"124\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"322\" y=\"368\" text-anchor=\"start\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">2 つのモード（どこから包むか）</text>\n  <text x=\"322\" y=\"386\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">トンネルモード：元の IP ヘッダごと包む</text>\n  <text x=\"322\" y=\"401\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　→ 社内の宛先・送信元も隠れる。拠点間はこれ</text>\n  <text x=\"322\" y=\"416\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">トランスポートモード：元の IP ヘッダは残し、</text>\n  <text x=\"322\" y=\"431\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　中身だけ守る。端末同士で直接使うとき</text>\n  <text x=\"322\" y=\"446\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">この図はトンネルモード</text>\n  <rect x=\"600\" y=\"348\" width=\"280\" height=\"124\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"612\" y=\"368\" text-anchor=\"start\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">SA（安全の取り決め）</text>\n  <text x=\"612\" y=\"386\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">中身：相手・暗号の方式・鍵・SPI（取り決め番号）</text>\n  <text x=\"612\" y=\"401\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">片道に 1 つ。送る側用と受け取る側用で別物</text>\n  <text x=\"612\" y=\"416\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">だからデータ用は 1 つの相手につき 2 本</text>\n  <text x=\"612\" y=\"431\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">（勉強会の表示 Active SAs: 2 はこの 2 本）</text>\n  <text x=\"612\" y=\"446\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">打合せ用の SA は、これとは別にもう 1 つできる</text>\n  <text x=\"612\" y=\"461\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">作り方そのものは次の図（打合せ）</text>\n  <text x=\"20\" y=\"500\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">フロー</text>\n  <text x=\"20\" y=\"520\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">① PC-A は宛先 192.168.3.10 をデフォルトゲートウェイ（ルータ 1）へ送る。図 10 の ① と同じで、PC 側は何も変わらない</text>\n  <text x=\"20\" y=\"538\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">② ルータ 1 は、外向きの口に貼った組の中の「守る通信の並び」（図 9 の ACL）に、このパケットが一致するかを上から順に見る</text>\n  <text x=\"34\" y=\"556\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">一致したので、送信用の SA に書かれた方式と鍵で、元のパケットをまるごと暗号化し、ESP ヘッダと外側 IP ヘッダを付ける</text>\n  <text x=\"20\" y=\"574\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">③ プロバイダのルータは外側の宛先 198.51.100.20 だけを見て運ぶ。途中で中を開いても、暗号化された固まりと ESP の札しか見えない</text>\n  <text x=\"20\" y=\"592\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">④ ルータ 2 は ESP ヘッダの SPI（取り決めの番号）でどの受信用 SA かを選び、改ざん検知をしてから復号する。出てくるのは ① と同じパケット</text>\n  <text x=\"20\" y=\"610\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">⑤ ルータ 2 は出てきたパケットを自分のテーブルで探し、Gi1 から PC-C へ送る。PC-C 側も何も変わらない</text>\n  <text x=\"20\" y=\"640\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">増えたもの</text>\n  <text x=\"20\" y=\"660\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">SA（論理・自動でできる）：相手と交わした「この方式・この鍵で守る」という取り決め。送信用と受信用の 2 本</text>\n  <text x=\"20\" y=\"678\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">crypto map（論理・手動）：相手・守る通信の並び・暗号の組合せを 1 つに束ねて、外向きの口に貼るもの</text>\n  <text x=\"20\" y=\"706\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">3 層で見ると</text>\n  <text x=\"20\" y=\"726\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">もの：ESP ヘッダ（通信 1 つずつに付く札）・SA（取り決め）・crypto map（束ねたもの）。どれも論理</text>\n  <text x=\"20\" y=\"744\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">結びつき：crypto map ⇄ 外向きの口（手動）／crypto map ⇄ 守る通信の並び・相手・方式（手動）／SA は打合せの結果できる（自動）</text>\n  <text x=\"20\" y=\"762\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">フロー：図 10 の「包む」の前に「守る通信か見分ける」、包むときに「暗号化する」、外すときに「確かめて戻す」が入る</text>\n<line x1=\"20\" y1=\"790\" x2=\"880\" y2=\"790\" stroke=\"#d6dde5\" stroke-width=\"1\"/>\n<text x=\"20\" y=\"812\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">各テーブルと設定（②③④ の番号は上のフローに対応。青字）</text>\n  <rect x=\"20\" y=\"824\" width=\"280\" height=\"90\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"30\" y=\"840\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: 口に貼った組（手動）</text>\n  <text x=\"30\" y=\"856\" font-size=\"10\" fill=\"#374151\">相手：198.51.100.20（ルータ 2 の外側）</text>\n  <text x=\"30\" y=\"871\" font-size=\"10\" fill=\"#374151\">守る通信：下の並びで選ぶ</text>\n  <text x=\"30\" y=\"886\" font-size=\"10\" fill=\"#374151\">暗号の組合せ：ESP の暗号方式＋認証方式</text>\n  <text x=\"30\" y=\"901\" font-size=\"10\" fill=\"#374151\">貼る口：Gi1（外向き）</text>\n  <rect x=\"310\" y=\"824\" width=\"280\" height=\"90\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"320\" y=\"840\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: 守る通信の並び（図 9 の ACL）</text>\n  <text x=\"320\" y=\"856\" font-size=\"10\" fill=\"#374151\">許可 192.168.10.0/24 → 192.168.3.0/24</text>\n  <text x=\"320\" y=\"871\" font-size=\"10\" fill=\"#374151\">　＝この 1 行に一致した通信だけ封をする</text>\n  <text x=\"320\" y=\"886\" font-size=\"10\" fill=\"#0a7aff\">②一致しない通信はそのまま素通しで出る</text>\n  <text x=\"320\" y=\"901\" font-size=\"10\" fill=\"#374151\">両側でこの並びが食い違うと通らない</text>\n  <rect x=\"600\" y=\"824\" width=\"280\" height=\"90\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"610\" y=\"840\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: SA（打合せでできる・自動）</text>\n  <text x=\"610\" y=\"856\" font-size=\"10\" fill=\"#374151\">送信用 SA：SPI（番号）・方式・鍵・寿命</text>\n  <text x=\"610\" y=\"871\" font-size=\"10\" fill=\"#374151\">受信用 SA：SPI（番号）・方式・鍵・寿命</text>\n  <text x=\"610\" y=\"886\" font-size=\"10\" fill=\"#0a7aff\">④相手の送信用と自分の受信用が対になる</text>\n  <text x=\"610\" y=\"901\" font-size=\"10\" fill=\"#374151\">合わせて 2 本（Active SAs: 2）</text>\n  <rect x=\"20\" y=\"924\" width=\"280\" height=\"90\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"30\" y=\"940\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 2: 口に貼った組（手動）</text>\n  <text x=\"30\" y=\"956\" font-size=\"10\" fill=\"#374151\">相手：203.0.113.10（ルータ 1 の外側）</text>\n  <text x=\"30\" y=\"971\" font-size=\"10\" fill=\"#374151\">守る通信：向きが逆の 1 行</text>\n  <text x=\"30\" y=\"986\" font-size=\"10\" fill=\"#374151\">暗号の組合せ：ルータ 1 と同じでなければ合わない</text>\n  <text x=\"30\" y=\"1001\" font-size=\"10\" fill=\"#374151\">貼る口：Gi0（外向き）</text>\n  <rect x=\"310\" y=\"924\" width=\"280\" height=\"75\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"320\" y=\"940\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 2: SA</text>\n  <text x=\"320\" y=\"956\" font-size=\"10\" fill=\"#374151\">送信用 SA・受信用 SA の 2 本</text>\n  <text x=\"320\" y=\"971\" font-size=\"10\" fill=\"#374151\">ルータ 1 の送信用 ⇄ ルータ 2 の受信用</text>\n  <text x=\"320\" y=\"986\" font-size=\"10\" fill=\"#374151\">ルータ 2 の送信用 ⇄ ルータ 1 の受信用</text>\n  <rect x=\"600\" y=\"924\" width=\"280\" height=\"90\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"610\" y=\"940\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: ルーティングテーブル（図 7 のまま）</text>\n  <text x=\"610\" y=\"956\" font-size=\"10\" fill=\"#374151\">0.0.0.0/0 → 203.0.113.1（手動）</text>\n  <text x=\"610\" y=\"971\" font-size=\"10\" fill=\"#374151\">封をする仕組みは口に貼るので、</text>\n  <text x=\"610\" y=\"986\" font-size=\"10\" fill=\"#374151\">行の書き方は変わらない</text>\n  <text x=\"610\" y=\"1001\" font-size=\"10\" fill=\"#0a7aff\">③外側の宛先はテーブルどおり Gi1 から出る</text>\n<text x=\"20\" y=\"1064\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">通信の中身の推移（フローごとのフレーム／パケット）</text>\n  <text x=\"20\" y=\"1114\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">① PC-A → ルータ 1（図 10 の ① と同じ）</text>\n  <rect x=\"20\" y=\"1120\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1134\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1149\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R1-Gi0</text>\n  <rect x=\"138\" y=\"1120\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1134\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1149\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC A</text>\n  <rect x=\"256\" y=\"1120\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"315.0\" y=\"1134\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 IP</text>\n  <text x=\"315.0\" y=\"1149\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.168.3.10</text>\n  <rect x=\"374\" y=\"1120\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"433.0\" y=\"1134\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 IP</text>\n  <text x=\"433.0\" y=\"1149\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.168.10.10</text>\n  <rect x=\"492\" y=\"1120\" width=\"70\" height=\"36\" fill=\"#ffffff\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"527.0\" y=\"1134\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">データ</text>\n  <text x=\"527.0\" y=\"1149\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ping</text>\n  <line x1=\"20\" y1=\"1164\" x2=\"562\" y2=\"1164\" stroke=\"#374151\" stroke-width=\"1.5\"/><line x1=\"20\" y1=\"1160\" x2=\"20\" y2=\"1164\" stroke=\"#374151\" stroke-width=\"1.5\"/><line x1=\"562\" y1=\"1160\" x2=\"562\" y2=\"1164\" stroke=\"#374151\" stroke-width=\"1.5\"/>\n  <text x=\"291.0\" y=\"1177\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">フレーム＝全部。ただしスイッチが見るのは MAC とタグの部分だけ</text>\n  <line x1=\"256\" y1=\"1106\" x2=\"562\" y2=\"1106\" stroke=\"#0a7aff\" stroke-width=\"1.5\"/><line x1=\"256\" y1=\"1106\" x2=\"256\" y2=\"1110\" stroke=\"#0a7aff\" stroke-width=\"1.5\"/><line x1=\"562\" y1=\"1106\" x2=\"562\" y2=\"1110\" stroke=\"#0a7aff\" stroke-width=\"1.5\"/>\n  <text x=\"409.0\" y=\"1102\" text-anchor=\"middle\" font-size=\"10\" fill=\"#0a7aff\">パケット＝この部分。ルータはここ（IP）を見る</text>\n  <text x=\"20\" y=\"1210\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">② ルータ 1 の中</text>\n  <text x=\"20\" y=\"1230\" font-size=\"10\" fill=\"#6b7280\">守る通信の並びに一致するか見る → 一致 → 送信用 SA の方式と鍵で ① のパケットをまるごと暗号化 → ESP ヘッダと外側 IP ヘッダを付ける</text>\n  <text x=\"20\" y=\"1254\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">③ ルータ 1 → ISP-1（図 10 の ③ と同じ形。GRE だった 1 枚が ESP になり、内側が読めなくなった）</text>\n  <rect x=\"20\" y=\"1260\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC ISP-1</text>\n  <rect x=\"138\" y=\"1260\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R1-Gi1</text>\n  <rect x=\"256\" y=\"1260\" width=\"104\" height=\"36\" fill=\"#fff1dc\" stroke=\"#d97706\" stroke-width=\"1\"/>\n  <text x=\"308.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">外側 宛先 IP</text>\n  <text x=\"308.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">198.51.100.20</text>\n  <rect x=\"360\" y=\"1260\" width=\"104\" height=\"36\" fill=\"#fff1dc\" stroke=\"#d97706\" stroke-width=\"1\"/>\n  <text x=\"412.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">外側 送信元 IP</text>\n  <text x=\"412.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">203.0.113.10</text>\n  <rect x=\"464\" y=\"1260\" width=\"92\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#b45309\" stroke-width=\"1\"/>\n  <text x=\"510.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">ESP ヘッダ</text>\n  <text x=\"510.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">SPI・連番</text>\n  <rect x=\"556\" y=\"1260\" width=\"200\" height=\"36\" fill=\"#e9edf2\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"656.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">暗号化されて読めない部分</text>\n  <text x=\"656.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">内側 IP ヘッダ＋データ＋末尾</text>\n  <rect x=\"756\" y=\"1260\" width=\"76\" height=\"36\" fill=\"#ffffff\" stroke=\"#b45309\" stroke-width=\"1\"/>\n  <text x=\"794.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">認証データ</text>\n  <text x=\"794.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">改ざん検知用</text>\n  <text x=\"20\" y=\"1314\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">④ ルータ 2 の中</text>\n  <text x=\"20\" y=\"1334\" font-size=\"10\" fill=\"#6b7280\">ESP ヘッダの SPI で受信用 SA を選ぶ → 認証データで改ざんされていないか確かめる → 復号すると ① と同じパケットが出てくる</text>\n  <text x=\"20\" y=\"1358\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">⑤ ルータ 2 → PC-C（図 10 の ⑤ と同じ）</text>\n  <rect x=\"20\" y=\"1364\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1378\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1393\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC C</text>\n  <rect x=\"138\" y=\"1364\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1378\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1393\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R2-Gi1</text>\n  <rect x=\"256\" y=\"1364\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"315.0\" y=\"1378\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 IP</text>\n  <text x=\"315.0\" y=\"1393\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.168.3.10</text>\n  <rect x=\"374\" y=\"1364\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"433.0\" y=\"1378\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 IP</text>\n  <text x=\"433.0\" y=\"1393\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.168.10.10</text>\n  <rect x=\"492\" y=\"1364\" width=\"70\" height=\"36\" fill=\"#ffffff\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"527.0\" y=\"1378\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">データ</text>\n  <text x=\"527.0\" y=\"1393\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ping</text>\n<text x=\"20\" y=\"1418\" font-size=\"10\" fill=\"#6b7280\">ESP の並びは SPI（取り決めの番号）・連番・暗号化される部分・認証データ。SPI と連番は暗号化されない（受け取った側がどの取り決めかを選ぶために要る）</text>\n<text x=\"20\" y=\"1434\" font-size=\"10\" fill=\"#6b7280\">crypto map は口に貼るものなので、守りたい通信がその口から出る経路に乗っていることが前提。この図では 0.0.0.0/0 → 203.0.113.1（Gi1）の行がその役をしている</text>\n<text x=\"20\" y=\"1450\" font-size=\"10\" fill=\"#6b7280\">トンネルモードでは元の IP ヘッダごと暗号化される部分に入るので、社内の宛先・送信元は外から見えない。外に出ているのは両端のルータの外側 IP だけ</text>\n<text x=\"20\" y=\"1466\" font-size=\"10\" fill=\"#6b7280\">外側 IP ヘッダのプロトコルの欄は 50（ESP）。だから Wireshark で見ても「ESP」としか分からない。図 10 では内側の宛先まで見えていた</text>\n<text x=\"20\" y=\"1482\" font-size=\"10\" fill=\"#6b7280\">古い方式について: 3DES（勉強会で使った esp-3des）は RFC 8221 §5 で SHOULD NOT（使うべきでない）。今の必須は AES-GCM と AES-CBC</text>\n<text x=\"20\" y=\"1498\" font-size=\"10\" fill=\"#6b7280\">SHA-1（AUTH_HMAC_SHA1_96）は RFC 8221 §6 では MUST-（今はまだ必須だが、いずれ格下げという印）。「使うな」とまでは書かれていない。必須は HMAC-SHA2-256</text>\n<text x=\"20\" y=\"1514\" font-size=\"10\" fill=\"#6b7280\">AH について: RFC 8221 §4 が NOT RECOMMENDED と書いているのは「ESP と AH を重ねて使うこと」。AH 単体を非推奨とは書いていない</text>\n<text x=\"20\" y=\"1530\" font-size=\"10\" fill=\"#6b7280\">出典（ESP の並び・2 つのモード・プロトコル番号 50）: RFC 4303 https://www.rfc-editor.org/rfc/rfc4303</text>\n<text x=\"20\" y=\"1546\" font-size=\"10\" fill=\"#6b7280\">出典（IPsec 全体の枠組み・SA）: RFC 4301 https://www.rfc-editor.org/rfc/rfc4301 ／ AH のプロトコル番号 51: RFC 4302 §2</text>\n<text x=\"20\" y=\"1562\" font-size=\"10\" fill=\"#6b7280\">出典（暗号方式の新旧）: RFC 8221 https://www.rfc-editor.org/rfc/rfc8221</text>\n<text x=\"20\" y=\"1578\" font-size=\"10\" fill=\"#6b7280\">未検証: 勉強会で見た「Wireshark では ESP としか見えない」は本人の観察。SPI や連番などどこまで表示されるかは、この図では確かめていない</text>\n<text x=\"20\" y=\"1594\" font-size=\"10\" fill=\"#6b7280\">この図は GRE を使わず IPsec だけで包む形を描いている。GRE と IPsec を重ねて使う構成もあるが、この図では扱わない</text>\n</svg>\n## 図 10・図 12 との接続","text":"<svg viewBox=\"0 0 900 1620\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-label=\"IPsec：図 10 の入れ子に ESP で封をする\" style=\"max-width:100%;height:auto;font-family:sans-serif\">\n  <rect x=\"0\" y=\"0\" width=\"900\" height=\"1620\" fill=\"#fbfcfe\"/>\n  <text x=\"20\" y=\"30\" text-anchor=\"start\" font-size=\"14\" font-weight=\"700\" fill=\"#1f2937\">IPsec：図 10 の入れ子に封をして、途中の誰にも中身を読ませない</text>\n  <text x=\"20\" y=\"50\" text-anchor=\"start\" font-size=\"11\" fill=\"#6b7280\">図 7 の問題 3（途中は他人のルータなので中身が誰にでも読める）の解。包む形は図 10 と同じで、内側がまるごと暗号化される</text>\n  <rect x=\"20\" y=\"80\" width=\"250\" height=\"250\" rx=\"10\" fill=\"none\" stroke=\"#9aa7b5\" stroke-width=\"1.5\" stroke-dasharray=\"6 4\"/>\n  <text x=\"32\" y=\"100\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#6b7280\">支店（自分のもの）</text>\n  <rect x=\"290\" y=\"80\" width=\"320\" height=\"250\" rx=\"10\" fill=\"#fff7ed\" stroke=\"#d97706\" stroke-width=\"1.5\" stroke-dasharray=\"6 4\"/>\n  <text x=\"302\" y=\"100\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#b45309\">インターネット（他人のもの）</text>\n  <rect x=\"630\" y=\"80\" width=\"250\" height=\"250\" rx=\"10\" fill=\"none\" stroke=\"#9aa7b5\" stroke-width=\"1.5\" stroke-dasharray=\"6 4\"/>\n  <text x=\"642\" y=\"100\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#6b7280\">データセンター（自分のもの）</text>\n  <rect x=\"32\" y=\"206\" width=\"80\" height=\"56\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"72.0\" y=\"226\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">PC-A</text>\n  <text x=\"72.0\" y=\"244\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">192.168.10.10</text>\n  <text x=\"72.0\" y=\"259\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">GW 192.168.10.1</text>\n  <line x1=\"112\" y1=\"234\" x2=\"150\" y2=\"234\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"150\" y=\"192\" width=\"110\" height=\"84\" rx=\"8\" fill=\"#f2f5f9\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"205.0\" y=\"212\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1</text>\n  <text x=\"205.0\" y=\"230\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi0 192.168.10.1</text>\n  <text x=\"205.0\" y=\"245\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi1 203.0.113.10</text>\n  <text x=\"205.0\" y=\"260\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">（グローバル IP）</text>\n  <rect x=\"141\" y=\"225\" width=\"18\" height=\"18\" fill=\"#ffffff\" stroke=\"#6b7280\" stroke-width=\"1.5\"/><text x=\"150\" y=\"238\" text-anchor=\"middle\" font-size=\"8\" fill=\"#1f2937\">Gi0</text>\n  <rect x=\"251\" y=\"225\" width=\"18\" height=\"18\" fill=\"#ffffff\" stroke=\"#6b7280\" stroke-width=\"1.5\"/><text x=\"260\" y=\"238\" text-anchor=\"middle\" font-size=\"8\" fill=\"#1f2937\">Gi1</text>\n  <line x1=\"269\" y1=\"234\" x2=\"330\" y2=\"234\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"330\" y=\"206\" width=\"70\" height=\"56\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"365.0\" y=\"226\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ISP-1</text>\n  <text x=\"365.0\" y=\"244\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">他人の</text>\n  <text x=\"365.0\" y=\"259\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">ルータ</text>\n  <line x1=\"400\" y1=\"234\" x2=\"415\" y2=\"234\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"415\" y=\"206\" width=\"70\" height=\"56\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"450.0\" y=\"226\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ISP-2</text>\n  <text x=\"450.0\" y=\"244\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">他人の</text>\n  <text x=\"450.0\" y=\"259\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">ルータ</text>\n  <line x1=\"485\" y1=\"234\" x2=\"500\" y2=\"234\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"500\" y=\"206\" width=\"70\" height=\"56\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"535.0\" y=\"226\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ISP-3</text>\n  <text x=\"535.0\" y=\"244\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">他人の</text>\n  <text x=\"535.0\" y=\"259\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">ルータ</text>\n  <line x1=\"570\" y1=\"234\" x2=\"640\" y2=\"234\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"640\" y=\"192\" width=\"110\" height=\"84\" rx=\"8\" fill=\"#f2f5f9\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"695.0\" y=\"212\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ルータ 2</text>\n  <text x=\"695.0\" y=\"230\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi0 198.51.100.20</text>\n  <text x=\"695.0\" y=\"245\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">（グローバル IP）</text>\n  <text x=\"695.0\" y=\"260\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi1 192.168.3.1</text>\n  <rect x=\"631\" y=\"225\" width=\"18\" height=\"18\" fill=\"#ffffff\" stroke=\"#6b7280\" stroke-width=\"1.5\"/><text x=\"640\" y=\"238\" text-anchor=\"middle\" font-size=\"8\" fill=\"#1f2937\">Gi0</text>\n  <rect x=\"741\" y=\"225\" width=\"18\" height=\"18\" fill=\"#ffffff\" stroke=\"#6b7280\" stroke-width=\"1.5\"/><text x=\"750\" y=\"238\" text-anchor=\"middle\" font-size=\"8\" fill=\"#1f2937\">Gi1</text>\n  <line x1=\"759\" y1=\"234\" x2=\"790\" y2=\"234\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"790\" y=\"206\" width=\"80\" height=\"56\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"830.0\" y=\"226\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">PC-C</text>\n  <text x=\"830.0\" y=\"244\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">192.168.3.10</text>\n  <text x=\"830.0\" y=\"259\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">GW 192.168.3.1</text>\n  <rect x=\"150\" y=\"125\" width=\"110\" height=\"46\" rx=\"8\" fill=\"#fff1dc\" stroke=\"#d97706\" stroke-width=\"1.5\"/>\n  <text x=\"205.0\" y=\"145\" text-anchor=\"middle\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">crypto map</text>\n  <text x=\"205.0\" y=\"163\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi1 に貼る（手動）</text>\n  <rect x=\"640\" y=\"125\" width=\"110\" height=\"46\" rx=\"8\" fill=\"#fff1dc\" stroke=\"#d97706\" stroke-width=\"1.5\"/>\n  <text x=\"695.0\" y=\"145\" text-anchor=\"middle\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">crypto map</text>\n  <text x=\"695.0\" y=\"163\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi0 に貼る（手動）</text>\n  <line x1=\"205\" y1=\"192\" x2=\"205\" y2=\"171\" stroke=\"#d97706\" stroke-width=\"1.5\" stroke-dasharray=\"4 3\"/>\n  <line x1=\"695\" y1=\"192\" x2=\"695\" y2=\"171\" stroke=\"#d97706\" stroke-width=\"1.5\" stroke-dasharray=\"4 3\"/>\n  <line x1=\"260\" y1=\"143\" x2=\"640\" y2=\"143\" stroke=\"#d97706\" stroke-width=\"2.5\"/>\n  <line x1=\"260\" y1=\"153\" x2=\"640\" y2=\"153\" stroke=\"#d97706\" stroke-width=\"2.5\"/>\n  <rect x=\"410\" y=\"136\" width=\"80\" height=\"24\" rx=\"4\" fill=\"#fff7ed\" stroke=\"#d97706\" stroke-width=\"1.5\"/>\n  <text x=\"450\" y=\"152\" text-anchor=\"middle\" font-size=\"11\" font-weight=\"700\" fill=\"#b45309\">ESP で封</text>\n  <text x=\"450\" y=\"118\" text-anchor=\"middle\" font-size=\"11\" font-weight=\"700\" fill=\"#b45309\">図 10 と同じ入れ子。中の 1 枚が GRE から ESP に変わる</text>\n  <text x=\"450\" y=\"180\" text-anchor=\"middle\" font-size=\"10\" fill=\"#6b7280\">外から読めるのは、外側の宛先・送信元と取り決めの番号（SPI）だけ</text>\n  <text x=\"450\" y=\"194\" text-anchor=\"middle\" font-size=\"10\" fill=\"#6b7280\">相手・守る通信・暗号の方式を束ねたものを口に貼る（手動）</text>\n  <line x1=\"112\" y1=\"300\" x2=\"142\" y2=\"300\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"141,295 141,305 150,300\" fill=\"#0a7aff\"/>\n  <circle cx=\"131\" cy=\"300\" r=\"9\" fill=\"#0a7aff\"/><text x=\"131\" y=\"304\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">1</text>\n  <circle cx=\"205\" cy=\"300\" r=\"9\" fill=\"#0a7aff\"/><text x=\"205\" y=\"304\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">2</text>\n  <line x1=\"269\" y1=\"300\" x2=\"623\" y2=\"300\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"622,295 622,305 631,300\" fill=\"#0a7aff\"/>\n  <circle cx=\"450\" cy=\"300\" r=\"9\" fill=\"#0a7aff\"/><text x=\"450\" y=\"304\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">3</text>\n  <circle cx=\"695\" cy=\"300\" r=\"9\" fill=\"#0a7aff\"/><text x=\"695\" y=\"304\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">4</text>\n  <line x1=\"760\" y1=\"300\" x2=\"784\" y2=\"300\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"783,295 783,305 792,300\" fill=\"#0a7aff\"/>\n  <circle cx=\"745\" cy=\"300\" r=\"9\" fill=\"#0a7aff\"/><text x=\"745\" y=\"304\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">5</text>\n  <text x=\"205\" y=\"322\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#0a7aff\">封をする</text>\n  <text x=\"695\" y=\"322\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#0a7aff\">封を開ける</text>\n  <text x=\"450\" y=\"322\" text-anchor=\"middle\" font-size=\"10\" fill=\"#b45309\">途中で開いても「ESP」としか分からない</text>\n  <rect x=\"20\" y=\"348\" width=\"280\" height=\"124\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"32\" y=\"368\" text-anchor=\"start\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ESP と AH（封の種類）</text>\n  <text x=\"32\" y=\"386\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">ESP：暗号化（読めなくする）と改ざん検知</text>\n  <text x=\"32\" y=\"401\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　　 外側のプロトコル番号は 50</text>\n  <text x=\"32\" y=\"416\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">AH ：改ざん検知だけ。暗号化はしない</text>\n  <text x=\"32\" y=\"431\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　　 外側のプロトコル番号は 51</text>\n  <text x=\"32\" y=\"446\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">ESP と AH を重ねる使い方は</text>\n  <text x=\"32\" y=\"461\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">RFC 8221 で NOT RECOMMENDED</text>\n  <rect x=\"310\" y=\"348\" width=\"280\" height=\"124\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"322\" y=\"368\" text-anchor=\"start\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">2 つのモード（どこから包むか）</text>\n  <text x=\"322\" y=\"386\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">トンネルモード：元の IP ヘッダごと包む</text>\n  <text x=\"322\" y=\"401\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　→ 社内の宛先・送信元も隠れる。拠点間はこれ</text>\n  <text x=\"322\" y=\"416\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">トランスポートモード：元の IP ヘッダは残し、</text>\n  <text x=\"322\" y=\"431\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　中身だけ守る。端末同士で直接使うとき</text>\n  <text x=\"322\" y=\"446\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">この図はトンネルモード</text>\n  <rect x=\"600\" y=\"348\" width=\"280\" height=\"124\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"612\" y=\"368\" text-anchor=\"start\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">SA（安全の取り決め）</text>\n  <text x=\"612\" y=\"386\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">中身：相手・暗号の方式・鍵・SPI（取り決め番号）</text>\n  <text x=\"612\" y=\"401\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">片道に 1 つ。送る側用と受け取る側用で別物</text>\n  <text x=\"612\" y=\"416\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">だからデータ用は 1 つの相手につき 2 本</text>\n  <text x=\"612\" y=\"431\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">（勉強会の表示 Active SAs: 2 はこの 2 本）</text>\n  <text x=\"612\" y=\"446\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">打合せ用の SA は、これとは別にもう 1 つできる</text>\n  <text x=\"612\" y=\"461\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">作り方そのものは次の図（打合せ）</text>\n  <text x=\"20\" y=\"500\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">フロー</text>\n  <text x=\"20\" y=\"520\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">① PC-A は宛先 192.168.3.10 をデフォルトゲートウェイ（ルータ 1）へ送る。図 10 の ① と同じで、PC 側は何も変わらない</text>\n  <text x=\"20\" y=\"538\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">② ルータ 1 は、外向きの口に貼った組の中の「守る通信の並び」（図 9 の ACL）に、このパケットが一致するかを上から順に見る</text>\n  <text x=\"34\" y=\"556\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">一致したので、送信用の SA に書かれた方式と鍵で、元のパケットをまるごと暗号化し、ESP ヘッダと外側 IP ヘッダを付ける</text>\n  <text x=\"20\" y=\"574\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">③ プロバイダのルータは外側の宛先 198.51.100.20 だけを見て運ぶ。途中で中を開いても、暗号化された固まりと ESP の札しか見えない</text>\n  <text x=\"20\" y=\"592\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">④ ルータ 2 は ESP ヘッダの SPI（取り決めの番号）でどの受信用 SA かを選び、改ざん検知をしてから復号する。出てくるのは ① と同じパケット</text>\n  <text x=\"20\" y=\"610\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">⑤ ルータ 2 は出てきたパケットを自分のテーブルで探し、Gi1 から PC-C へ送る。PC-C 側も何も変わらない</text>\n  <text x=\"20\" y=\"640\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">増えたもの</text>\n  <text x=\"20\" y=\"660\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">SA（論理・自動でできる）：相手と交わした「この方式・この鍵で守る」という取り決め。送信用と受信用の 2 本</text>\n  <text x=\"20\" y=\"678\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">crypto map（論理・手動）：相手・守る通信の並び・暗号の組合せを 1 つに束ねて、外向きの口に貼るもの</text>\n  <text x=\"20\" y=\"706\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">3 層で見ると</text>\n  <text x=\"20\" y=\"726\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">もの：ESP ヘッダ（通信 1 つずつに付く札）・SA（取り決め）・crypto map（束ねたもの）。どれも論理</text>\n  <text x=\"20\" y=\"744\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">結びつき：crypto map ⇄ 外向きの口（手動）／crypto map ⇄ 守る通信の並び・相手・方式（手動）／SA は打合せの結果できる（自動）</text>\n  <text x=\"20\" y=\"762\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">フロー：図 10 の「包む」の前に「守る通信か見分ける」、包むときに「暗号化する」、外すときに「確かめて戻す」が入る</text>\n<line x1=\"20\" y1=\"790\" x2=\"880\" y2=\"790\" stroke=\"#d6dde5\" stroke-width=\"1\"/>\n<text x=\"20\" y=\"812\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">各テーブルと設定（②③④ の番号は上のフローに対応。青字）</text>\n  <rect x=\"20\" y=\"824\" width=\"280\" height=\"90\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"30\" y=\"840\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: 口に貼った組（手動）</text>\n  <text x=\"30\" y=\"856\" font-size=\"10\" fill=\"#374151\">相手：198.51.100.20（ルータ 2 の外側）</text>\n  <text x=\"30\" y=\"871\" font-size=\"10\" fill=\"#374151\">守る通信：下の並びで選ぶ</text>\n  <text x=\"30\" y=\"886\" font-size=\"10\" fill=\"#374151\">暗号の組合せ：ESP の暗号方式＋認証方式</text>\n  <text x=\"30\" y=\"901\" font-size=\"10\" fill=\"#374151\">貼る口：Gi1（外向き）</text>\n  <rect x=\"310\" y=\"824\" width=\"280\" height=\"90\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"320\" y=\"840\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: 守る通信の並び（図 9 の ACL）</text>\n  <text x=\"320\" y=\"856\" font-size=\"10\" fill=\"#374151\">許可 192.168.10.0/24 → 192.168.3.0/24</text>\n  <text x=\"320\" y=\"871\" font-size=\"10\" fill=\"#374151\">　＝この 1 行に一致した通信だけ封をする</text>\n  <text x=\"320\" y=\"886\" font-size=\"10\" fill=\"#0a7aff\">②一致しない通信はそのまま素通しで出る</text>\n  <text x=\"320\" y=\"901\" font-size=\"10\" fill=\"#374151\">両側でこの並びが食い違うと通らない</text>\n  <rect x=\"600\" y=\"824\" width=\"280\" height=\"90\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"610\" y=\"840\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: SA（打合せでできる・自動）</text>\n  <text x=\"610\" y=\"856\" font-size=\"10\" fill=\"#374151\">送信用 SA：SPI（番号）・方式・鍵・寿命</text>\n  <text x=\"610\" y=\"871\" font-size=\"10\" fill=\"#374151\">受信用 SA：SPI（番号）・方式・鍵・寿命</text>\n  <text x=\"610\" y=\"886\" font-size=\"10\" fill=\"#0a7aff\">④相手の送信用と自分の受信用が対になる</text>\n  <text x=\"610\" y=\"901\" font-size=\"10\" fill=\"#374151\">合わせて 2 本（Active SAs: 2）</text>\n  <rect x=\"20\" y=\"924\" width=\"280\" height=\"90\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"30\" y=\"940\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 2: 口に貼った組（手動）</text>\n  <text x=\"30\" y=\"956\" font-size=\"10\" fill=\"#374151\">相手：203.0.113.10（ルータ 1 の外側）</text>\n  <text x=\"30\" y=\"971\" font-size=\"10\" fill=\"#374151\">守る通信：向きが逆の 1 行</text>\n  <text x=\"30\" y=\"986\" font-size=\"10\" fill=\"#374151\">暗号の組合せ：ルータ 1 と同じでなければ合わない</text>\n  <text x=\"30\" y=\"1001\" font-size=\"10\" fill=\"#374151\">貼る口：Gi0（外向き）</text>\n  <rect x=\"310\" y=\"924\" width=\"280\" height=\"75\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"320\" y=\"940\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 2: SA</text>\n  <text x=\"320\" y=\"956\" font-size=\"10\" fill=\"#374151\">送信用 SA・受信用 SA の 2 本</text>\n  <text x=\"320\" y=\"971\" font-size=\"10\" fill=\"#374151\">ルータ 1 の送信用 ⇄ ルータ 2 の受信用</text>\n  <text x=\"320\" y=\"986\" font-size=\"10\" fill=\"#374151\">ルータ 2 の送信用 ⇄ ルータ 1 の受信用</text>\n  <rect x=\"600\" y=\"924\" width=\"280\" height=\"90\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"610\" y=\"940\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: ルーティングテーブル（図 7 のまま）</text>\n  <text x=\"610\" y=\"956\" font-size=\"10\" fill=\"#374151\">0.0.0.0/0 → 203.0.113.1（手動）</text>\n  <text x=\"610\" y=\"971\" font-size=\"10\" fill=\"#374151\">封をする仕組みは口に貼るので、</text>\n  <text x=\"610\" y=\"986\" font-size=\"10\" fill=\"#374151\">行の書き方は変わらない</text>\n  <text x=\"610\" y=\"1001\" font-size=\"10\" fill=\"#0a7aff\">③外側の宛先はテーブルどおり Gi1 から出る</text>\n<text x=\"20\" y=\"1064\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">通信の中身の推移（フローごとのフレーム／パケット）</text>\n  <text x=\"20\" y=\"1114\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">① PC-A → ルータ 1（図 10 の ① と同じ）</text>\n  <rect x=\"20\" y=\"1120\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1134\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1149\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R1-Gi0</text>\n  <rect x=\"138\" y=\"1120\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1134\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1149\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC A</text>\n  <rect x=\"256\" y=\"1120\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"315.0\" y=\"1134\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 IP</text>\n  <text x=\"315.0\" y=\"1149\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.168.3.10</text>\n  <rect x=\"374\" y=\"1120\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"433.0\" y=\"1134\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 IP</text>\n  <text x=\"433.0\" y=\"1149\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.168.10.10</text>\n  <rect x=\"492\" y=\"1120\" width=\"70\" height=\"36\" fill=\"#ffffff\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"527.0\" y=\"1134\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">データ</text>\n  <text x=\"527.0\" y=\"1149\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ping</text>\n  <line x1=\"20\" y1=\"1164\" x2=\"562\" y2=\"1164\" stroke=\"#374151\" stroke-width=\"1.5\"/><line x1=\"20\" y1=\"1160\" x2=\"20\" y2=\"1164\" stroke=\"#374151\" stroke-width=\"1.5\"/><line x1=\"562\" y1=\"1160\" x2=\"562\" y2=\"1164\" stroke=\"#374151\" stroke-width=\"1.5\"/>\n  <text x=\"291.0\" y=\"1177\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">フレーム＝全部。ただしスイッチが見るのは MAC とタグの部分だけ</text>\n  <line x1=\"256\" y1=\"1106\" x2=\"562\" y2=\"1106\" stroke=\"#0a7aff\" stroke-width=\"1.5\"/><line x1=\"256\" y1=\"1106\" x2=\"256\" y2=\"1110\" stroke=\"#0a7aff\" stroke-width=\"1.5\"/><line x1=\"562\" y1=\"1106\" x2=\"562\" y2=\"1110\" stroke=\"#0a7aff\" stroke-width=\"1.5\"/>\n  <text x=\"409.0\" y=\"1102\" text-anchor=\"middle\" font-size=\"10\" fill=\"#0a7aff\">パケット＝この部分。ルータはここ（IP）を見る</text>\n  <text x=\"20\" y=\"1210\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">② ルータ 1 の中</text>\n  <text x=\"20\" y=\"1230\" font-size=\"10\" fill=\"#6b7280\">守る通信の並びに一致するか見る → 一致 → 送信用 SA の方式と鍵で ① のパケットをまるごと暗号化 → ESP ヘッダと外側 IP ヘッダを付ける</text>\n  <text x=\"20\" y=\"1254\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">③ ルータ 1 → ISP-1（図 10 の ③ と同じ形。GRE だった 1 枚が ESP になり、内側が読めなくなった）</text>\n  <rect x=\"20\" y=\"1260\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC ISP-1</text>\n  <rect x=\"138\" y=\"1260\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R1-Gi1</text>\n  <rect x=\"256\" y=\"1260\" width=\"104\" height=\"36\" fill=\"#fff1dc\" stroke=\"#d97706\" stroke-width=\"1\"/>\n  <text x=\"308.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">外側 宛先 IP</text>\n  <text x=\"308.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">198.51.100.20</text>\n  <rect x=\"360\" y=\"1260\" width=\"104\" height=\"36\" fill=\"#fff1dc\" stroke=\"#d97706\" stroke-width=\"1\"/>\n  <text x=\"412.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">外側 送信元 IP</text>\n  <text x=\"412.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">203.0.113.10</text>\n  <rect x=\"464\" y=\"1260\" width=\"92\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#b45309\" stroke-width=\"1\"/>\n  <text x=\"510.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">ESP ヘッダ</text>\n  <text x=\"510.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">SPI・連番</text>\n  <rect x=\"556\" y=\"1260\" width=\"200\" height=\"36\" fill=\"#e9edf2\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"656.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">暗号化されて読めない部分</text>\n  <text x=\"656.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">内側 IP ヘッダ＋データ＋末尾</text>\n  <rect x=\"756\" y=\"1260\" width=\"76\" height=\"36\" fill=\"#ffffff\" stroke=\"#b45309\" stroke-width=\"1\"/>\n  <text x=\"794.0\" y=\"1274\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">認証データ</text>\n  <text x=\"794.0\" y=\"1289\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">改ざん検知用</text>\n  <text x=\"20\" y=\"1314\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">④ ルータ 2 の中</text>\n  <text x=\"20\" y=\"1334\" font-size=\"10\" fill=\"#6b7280\">ESP ヘッダの SPI で受信用 SA を選ぶ → 認証データで改ざんされていないか確かめる → 復号すると ① と同じパケットが出てくる</text>\n  <text x=\"20\" y=\"1358\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">⑤ ルータ 2 → PC-C（図 10 の ⑤ と同じ）</text>\n  <rect x=\"20\" y=\"1364\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1378\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1393\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC C</text>\n  <rect x=\"138\" y=\"1364\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1378\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1393\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R2-Gi1</text>\n  <rect x=\"256\" y=\"1364\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"315.0\" y=\"1378\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 IP</text>\n  <text x=\"315.0\" y=\"1393\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.168.3.10</text>\n  <rect x=\"374\" y=\"1364\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"433.0\" y=\"1378\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 IP</text>\n  <text x=\"433.0\" y=\"1393\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.168.10.10</text>\n  <rect x=\"492\" y=\"1364\" width=\"70\" height=\"36\" fill=\"#ffffff\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"527.0\" y=\"1378\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">データ</text>\n  <text x=\"527.0\" y=\"1393\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ping</text>\n<text x=\"20\" y=\"1418\" font-size=\"10\" fill=\"#6b7280\">ESP の並びは SPI（取り決めの番号）・連番・暗号化される部分・認証データ。SPI と連番は暗号化されない（受け取った側がどの取り決めかを選ぶために要る）</text>\n<text x=\"20\" y=\"1434\" font-size=\"10\" fill=\"#6b7280\">crypto map は口に貼るものなので、守りたい通信がその口から出る経路に乗っていることが前提。この図では 0.0.0.0/0 → 203.0.113.1（Gi1）の行がその役をしている</text>\n<text x=\"20\" y=\"1450\" font-size=\"10\" fill=\"#6b7280\">トンネルモードでは元の IP ヘッダごと暗号化される部分に入るので、社内の宛先・送信元は外から見えない。外に出ているのは両端のルータの外側 IP だけ</text>\n<text x=\"20\" y=\"1466\" font-size=\"10\" fill=\"#6b7280\">外側 IP ヘッダのプロトコルの欄は 50（ESP）。だから Wireshark で見ても「ESP」としか分からない。図 10 では内側の宛先まで見えていた</text>\n<text x=\"20\" y=\"1482\" font-size=\"10\" fill=\"#6b7280\">古い方式について: 3DES（勉強会で使った esp-3des）は RFC 8221 §5 で SHOULD NOT（使うべきでない）。今の必須は AES-GCM と AES-CBC</text>\n<text x=\"20\" y=\"1498\" font-size=\"10\" fill=\"#6b7280\">SHA-1（AUTH_HMAC_SHA1_96）は RFC 8221 §6 では MUST-（今はまだ必須だが、いずれ格下げという印）。「使うな」とまでは書かれていない。必須は HMAC-SHA2-256</text>\n<text x=\"20\" y=\"1514\" font-size=\"10\" fill=\"#6b7280\">AH について: RFC 8221 §4 が NOT RECOMMENDED と書いているのは「ESP と AH を重ねて使うこと」。AH 単体を非推奨とは書いていない</text>\n<text x=\"20\" y=\"1530\" font-size=\"10\" fill=\"#6b7280\">出典（ESP の並び・2 つのモード・プロトコル番号 50）: RFC 4303 https://www.rfc-editor.org/rfc/rfc4303</text>\n<text x=\"20\" y=\"1546\" font-size=\"10\" fill=\"#6b7280\">出典（IPsec 全体の枠組み・SA）: RFC 4301 https://www.rfc-editor.org/rfc/rfc4301 ／ AH のプロトコル番号 51: RFC 4302 §2</text>\n<text x=\"20\" y=\"1562\" font-size=\"10\" fill=\"#6b7280\">出典（暗号方式の新旧）: RFC 8221 https://www.rfc-editor.org/rfc/rfc8221</text>\n<text x=\"20\" y=\"1578\" font-size=\"10\" fill=\"#6b7280\">未検証: 勉強会で見た「Wireshark では ESP としか見えない」は本人の観察。SPI や連番などどこまで表示されるかは、この図では確かめていない</text>\n<text x=\"20\" y=\"1594\" font-size=\"10\" fill=\"#6b7280\">この図は GRE を使わず IPsec だけで包む形を描いている。GRE と IPsec を重ねて使う構成もあるが、この図では扱わない</text>\n</svg>\n## 図 10・図 12 との接続","line":69,"sources":["src_1","src_2","src_4"],"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_cca5e0","type":"paragraph","markdown":"図 10 の ③ と図 11 の ③ を並べると、箱の並びが同じ形のまま、GRE だった 1 枚が ESP に変わり、内側の宛先と送信元が読めない部分に飲み込まれているのが見えます。\n図 10 では内側の宛先まで外から見えていました。","text":"図 10 の ③ と図 11 の ③ を並べると、箱の並びが同じ形のまま、GRE だった 1 枚が ESP に変わり、内側の宛先と送信元が読めない部分に飲み込まれているのが見えます。\n図 10 では内側の宛先まで外から見えていました。","line":297,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_4ef350","type":"paragraph","markdown":"図 9 の行の並びは、ここでは「通す・通さない」ではなく「守る・守らない」の選別に使われます。\n同じ道具の別の使い方です。","text":"図 9 の行の並びは、ここでは「通す・通さない」ではなく「守る・守らない」の選別に使われます。\n同じ道具の別の使い方です。","line":300,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_d569d0","type":"paragraph","markdown":"図 5 の MAC の付け替えも、図 1 のルーティングテーブルもそのまま生きています。\n封をする仕組みは口に貼るもので、テーブルの行の書き方を変えません。","text":"図 5 の MAC の付け替えも、図 1 のルーティングテーブルもそのまま生きています。\n封をする仕組みは口に貼るもので、テーブルの行の書き方を変えません。","line":303,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_141db0","type":"paragraph","markdown":"SPI と連番が暗号化されないのは、受け取った側がどの取り決めかを選ぶために要るからです。\nその取り決めをどうやって作るかが、次の図 12 です。","text":"SPI と連番が暗号化されないのは、受け取った側がどの取り決めかを選ぶために要るからです。\nその取り決めをどうやって作るかが、次の図 12 です。","line":306,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_703626","type":"heading","depth":2,"markdown":"## 未検証・注意","text":"未検証・注意","line":309,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_6bc142","type":"list","markdown":"- 勉強会で使った 3DES は、RFC 8221 §5 で SHOULD NOT（使うべきでない）に置かれています。今の必須は AES-GCM と AES-CBC です。\n- SHA-1 を使う改ざん検知（AUTH\\_HMAC\\_SHA1\\_96）は、同 §6 で MUST-（今はまだ必須だが、いずれ格下げという印）です。「使うな」とまでは書かれていません。必須は HMAC-SHA2-256-128 のほうで、MUST NOT が付いているのは HMAC-MD5-96 です。\n- 同 §4 が NOT RECOMMENDED としているのは「ESP と AH を重ねて使うこと」です。AH 単体を非推奨とは書いていません。\n- 勉強会で見た「Wireshark では ESP としか見えない」は本人の観察です。SPI や連番がどこまで表示されるかは、この図では確かめていません。\n- この図は GRE を使わず IPsec だけで包む形です。GRE と IPsec を重ねて使う構成もありますが、この図では扱っていません。\n- 拠点間 VPN の相手は機器の種類を選びません。別の勉強会で扱ったファイアウォールの資料でも、ルータとファイアウォールの間、ファイアウォール同士で、この図と同じ組み立て（互いの認証・守る通信の選別・暗号の組合せ・外向きの口に貼る）を使っていました。これも本人の観察です。\n- SPI や鍵の実際の値、事前共有鍵の文字列は書いていません。","text":"勉強会で使った 3DES は、RFC 8221 §5 で SHOULD NOT（使うべきでない）に置かれています。今の必須は AES-GCM と AES-CBC です。SHA-1 を使う改ざん検知（AUTH_HMAC_SHA1_96）は、同 §6 で MUST-（今はまだ必須だが、いずれ格下げという印）です。「使うな」とまでは書かれていません。必須は HMAC-SHA2-256-128 のほうで、MUST NOT が付いているのは HMAC-MD5-96 です。同 §4 が NOT RECOMMENDED としているのは「ESP と AH を重ねて使うこと」です。AH 単体を非推奨とは書いていません。勉強会で見た「Wireshark では ESP としか見えない」は本人の観察です。SPI や連番がどこまで表示されるかは、この図では確かめていません。この図は GRE を使わず IPsec だけで包む形です。GRE と IPsec を重ねて使う構成もありますが、この図では扱っていません。拠点間 VPN の相手は機器の種類を選びません。別の勉強会で扱ったファイアウォールの資料でも、ルータとファイアウォールの間、ファイアウォール同士で、この図と同じ組み立て（互いの認証・守る通信の選別・暗号の組合せ・外向きの口に貼る）を使っていました。これも本人の観察です。SPI や鍵の実際の値、事前共有鍵の文字列は書いていません。","line":311,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_240080","type":"heading","depth":2,"markdown":"## 出典","text":"出典","line":319,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_406bf9","type":"list","markdown":"- 勉強会での本人の観察（2026-09-13 実機ハンズオン。資料は非公開）\n- [RFC 4303: IP Encapsulating Security Payload (ESP)](https://www.rfc-editor.org/rfc/rfc4303) — プロトコル番号 50。暗号化されるのはペイロードと ESP トレーラで、SPI・連番・ペイロード・トレーラが改ざん検知の対象。§3.1.1 のトランスポートモードと §3.1.2 のトンネルモードの違い\n- [RFC 4301: Security Architecture for the Internet Protocol](https://www.rfc-editor.org/rfc/rfc4301) — §4.1「An SA is a simplex 'connection' that affords security services to the traffic carried by it」。双方向には 1 対の SA が要る\n- [RFC 4302: IP Authentication Header](https://www.rfc-editor.org/rfc/rfc4302) — §2。AH の直前のヘッダはプロトコルの欄に 51 を入れる\n- [RFC 8221: Cryptographic Algorithm Implementation Requirements for ESP and AH](https://www.rfc-editor.org/rfc/rfc8221) — §5 で ENCR\\_3DES が SHOULD NOT、ENCR\\_AES\\_GCM\\_16 と ENCR\\_AES\\_CBC が MUST。§6 で AUTH\\_HMAC\\_SHA2\\_256\\_128 が MUST、AUTH\\_HMAC\\_SHA1\\_96 が MUST-、AUTH\\_HMAC\\_MD5\\_96 が MUST NOT。§4 で「ESP+AH. This method is NOT RECOMMENDED」","text":"勉強会での本人の観察（2026-09-13 実機ハンズオン。資料は非公開）RFC 4303: IP Encapsulating Security Payload (ESP) — プロトコル番号 50。暗号化されるのはペイロードと ESP トレーラで、SPI・連番・ペイロード・トレーラが改ざん検知の対象。§3.1.1 のトランスポートモードと §3.1.2 のトンネルモードの違いRFC 4301: Security Architecture for the Internet Protocol — §4.1「An SA is a simplex 'connection' that affords security services to the traffic carried by it」。双方向には 1 対の SA が要るRFC 4302: IP Authentication Header — §2。AH の直前のヘッダはプロトコルの欄に 51 を入れるRFC 8221: Cryptographic Algorithm Implementation Requirements for ESP and AH — §5 で ENCR_3DES が SHOULD NOT、ENCR_AES_GCM_16 と ENCR_AES_CBC が MUST。§6 で AUTH_HMAC_SHA2_256_128 が MUST、AUTH_HMAC_SHA1_96 が MUST-、AUTH_HMAC_MD5_96 が MUST NOT。§4 で「ESP+AH. This method is NOT RECOMMENDED」","line":321,"sources":["src_1","src_2","src_3","src_4"],"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_1f7c1f","type":"heading","depth":2,"markdown":"## 関連","text":"関連","line":327,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_e6c03c","type":"list","markdown":"- [ネットワーク\\_INDEX](/notes/nw-basics-index) — 連載の目次\n\n- 連載の入口: [ネットワーク\\_00\\_3層で言葉を置く](/notes/nw-basics-00-three-layers)（`/notes/nw-basics-00-three-layers`）\n\n- 前の記事（図 10）: [ネットワーク\\_10\\_GREトンネル](/notes/nw-basics-10-gre)（`/notes/nw-basics-10-gre`）\n\n- 次の記事（図 12）: [ネットワーク\\_12\\_IKE](/notes/nw-basics-12-ike)（`/notes/nw-basics-12-ike`）\n\n- 守る通信を選ぶ行の並び: [ネットワーク\\_09\\_ACL](/notes/nw-basics-09-acl)（`/notes/nw-basics-09-acl`）","text":"ネットワーク_INDEX — 連載の目次連載の入口: ネットワーク_00_3層で言葉を置く（/notes/nw-basics-00-three-layers）前の記事（図 10）: ネットワーク_10_GREトンネル（/notes/nw-basics-10-gre）次の記事（図 12）: ネットワーク_12_IKE（/notes/nw-basics-12-ike）守る通信を選ぶ行の並び: ネットワーク_09_ACL（/notes/nw-basics-09-acl）","line":329,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}}],"sources":[{"id":"src_1","url":"https://www.rfc-editor.org/rfc/rfc4303","title":"RFC 4303: IP Encapsulating Security Payload (ESP)","accessed":"2026-09-14","kind":"secondary"},{"id":"src_2","url":"https://www.rfc-editor.org/rfc/rfc4301","title":"RFC 4301: Security Architecture for the Internet Protocol","accessed":"2026-09-14","kind":"secondary"},{"id":"src_3","url":"https://www.rfc-editor.org/rfc/rfc4302","title":"RFC 4302: IP Authentication Header","accessed":"2026-09-14","kind":"secondary"},{"id":"src_4","url":"https://www.rfc-editor.org/rfc/rfc8221","title":"RFC 8221: Cryptographic Algorithm Implementation Requirements for ESP and AH","accessed":"2026-09-14","kind":"secondary"}],"errata":[]}