{"schema":"article/1","id":"art_8b7aea1255","owner":"u_owner","status":"published","visibility":"public","version":1,"title":"書き換えた住所は、戻せるように覚えておく","rawTitle":"書き換えた住所は、戻せるように覚えておく","slug":"nw-basics-08-nat","file":"ネットワーク_08_NAT","relPath":"content/published/ネットワーク_08_NAT.md","aliases":[],"kind":"published","area":"tech","topic":"ネットワーク","category":"ネットワーク","tags":["ネットワーク","nat","インターネット","concept"],"summary":"支店の PC が外のサーバを見に行くとき、ルータが送信元の住所とポート番号を書き換えて変換表に 1 行覚え、帰りに書き戻すまでを 1 枚の図で追う","date":"2026-09-14","updated":"2026-09-14","links":["nw-basics-index","nw-basics-00-three-layers","nw-basics-07-internet","nw-basics-09-acl","nw-basics-10-gre","nw-basics-11-ipsec"],"blocks":[{"id":"blk_5629df","type":"paragraph","markdown":"図 7 では、支店からデータセンターへ社内の住所のまま送ると、プロバイダのルータで止まりました。","text":"図 7 では、支店からデータセンターへ社内の住所のまま送ると、プロバイダのルータで止まりました。","line":2,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_d64811","type":"paragraph","markdown":"それなのに、同じ支店の PC は普通にウェブを見られます。\n図 7 の注では、その理由をルータの書き換えとして 1 行だけ置きました。\nこの記事は、その書き換えを扱います。\n図 7 で挙げた 3 つの問題のうち、解けるのは「社内専用の住所はインターネットでは運ばれません」の、外のサーバへ行く分だけです。","text":"それなのに、同じ支店の PC は普通にウェブを見られます。\n図 7 の注では、その理由をルータの書き換えとして 1 行だけ置きました。\nこの記事は、その書き換えを扱います。\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":9,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_34ba84","type":"heading","depth":2,"markdown":"## 登場するもの","text":"登場するもの","line":12,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_d82840","type":"heading","depth":4,"markdown":"#### 変換表（NAT テーブル）","text":"変換表（NAT テーブル）","line":14,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_6e01d7","type":"paragraph","markdown":"論理のものです。\nルータの中にできる、もう 1 つの表です。\n書いてあるのは「内側の住所とポート番号」と「書き換えた後の外側の住所とポート番号」の対応で、帰りの通信をこの表で逆に引いて書き戻します。","text":"論理のものです。\nルータの中にできる、もう 1 つの表です。\n書いてあるのは「内側の住所とポート番号」と「書き換えた後の外側の住所とポート番号」の対応で、帰りの通信をこの表で逆に引いて書き戻します。","line":16,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_f9ccc9","type":"heading","depth":4,"markdown":"#### 内側ローカルと内側グローバル","text":"内側ローカルと内側グローバル","line":20,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_51b19f","type":"paragraph","markdown":"内側ローカルは、社内で実際に使っている住所です。\n内側グローバルは、書き換えた後の外向けの住所です。\n外のサーバに見えるのは後者だけです。","text":"内側ローカルは、社内で実際に使っている住所です。\n内側グローバルは、書き換えた後の外向けの住所です。\n外のサーバに見えるのは後者だけです。","line":22,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_19fe54","type":"heading","depth":4,"markdown":"#### ポート番号","text":"ポート番号","line":26,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_dd4b8c","type":"paragraph","markdown":"TCP や UDP が持つ番号で、1 台の機器の中でどの通信かを見分けるために使います。\nウェブの既定は 80 です。\n図 5 では、ルータが見るのは IP の部分だけだと書きました。\nNAT はその後ろのポート番号まで見て書き換えます。","text":"TCP や UDP が持つ番号で、1 台の機器の中でどの通信かを見分けるために使います。\nウェブの既定は 80 です。\n図 5 では、ルータが見るのは IP の部分だけだと書きました。\nNAT はその後ろのポート番号まで見て書き換えます。","line":28,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_529da1","type":"heading","depth":4,"markdown":"#### 内側の送信元を書き換える NAT の 3 種","text":"内側の送信元を書き換える NAT の 3 種","line":33,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_1c1ee8","type":"list","markdown":"- 静的 NAT は、住所だけを 1 対 1 で置き換えます。人が 1 行書き、その行はずっと残ります（ポート番号まで固定で結ぶ書き方もありますが、この図では扱いません）。\n- 動的 NAT は、用意しておいた外側の住所の集まりから 1 つ割り当てます。行は通信の開始でできて、終了で消えます。同時に使えるのは住所の数までです。\n- PAT は、1 つの外側の住所をポート番号で共用します。ポート番号が違えば何台でも同じ外側の住所を使えます。この図の ② はこれです。","text":"静的 NAT は、住所だけを 1 対 1 で置き換えます。人が 1 行書き、その行はずっと残ります（ポート番号まで固定で結ぶ書き方もありますが、この図では扱いません）。動的 NAT は、用意しておいた外側の住所の集まりから 1 つ割り当てます。行は通信の開始でできて、終了で消えます。同時に使えるのは住所の数までです。PAT は、1 つの外側の住所をポート番号で共用します。ポート番号が違えば何台でも同じ外側の住所を使えます。この図の ② はこれです。","line":35,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_118c7a","type":"heading","depth":2,"markdown":"## 結びつき","text":"結びつき","line":39,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_8b89f0","type":"list","markdown":"- インターフェース ⇄ 内側と外側の役は手動です。どちらの口が内側でどちらが外側かを人が指定します。この指定が無いと変換は起きません。\n- 内側の住所とポート番号 ⇄ 外側の住所とポート番号は、静的 NAT では手動です。動的 NAT と PAT では、通信の開始で自動に行ができます。\n- ルーティングテーブルとは結び付きません。NAT で行が増えるのは変換表だけで、経路の行は図 7 のままです。","text":"インターフェース ⇄ 内側と外側の役は手動です。どちらの口が内側でどちらが外側かを人が指定します。この指定が無いと変換は起きません。内側の住所とポート番号 ⇄ 外側の住所とポート番号は、静的 NAT では手動です。動的 NAT と PAT では、通信の開始で自動に行ができます。ルーティングテーブルとは結び付きません。NAT で行が増えるのは変換表だけで、経路の行は図 7 のままです。","line":41,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_df21fc","type":"heading","depth":2,"markdown":"## 通信フロー","text":"通信フロー","line":45,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_c03732","type":"paragraph","markdown":"支店の A（192.168.10.10）から、外のサーバ（192.0.2.50）のウェブを見に行き、返事が戻るまでです。","text":"支店の A（192.168.10.10）から、外のサーバ（192.0.2.50）のウェブを見に行き、返事が戻るまでです。","line":47,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_bd8732","type":"paragraph","markdown":"① A は宛先 192.0.2.50 が自分のネットワーク外なので、デフォルトゲートウェイ（ルータ 1）へ送ります。図 5・図 7 の ① と同じです。","text":"① A は宛先 192.0.2.50 が自分のネットワーク外なので、デフォルトゲートウェイ（ルータ 1）へ送ります。図 5・図 7 の ① と同じです。","line":49,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_66d19d","type":"paragraph","markdown":"② ルータ 1 は外側の口から出すときに、送信元を 192.168.10.10 のポート番号 50000 から 203.0.113.10 のポート番号 51001 に書き換え、変換表に 1 行書きます。","text":"② ルータ 1 は外側の口から出すときに、送信元を 192.168.10.10 のポート番号 50000 から 203.0.113.10 のポート番号 51001 に書き換え、変換表に 1 行書きます。","line":51,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_f466d6","type":"paragraph","markdown":"③ 宛先も送信元もグローバル IP なので、インターネットは運べます。図 7 の ③ で捨てられたのは、宛先が社内専用の住所だったからです。","text":"③ 宛先も送信元もグローバル IP なので、インターネットは運べます。図 7 の ③ で捨てられたのは、宛先が社内専用の住所だったからです。","line":53,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_349032","type":"paragraph","markdown":"④ サーバは返事を 203.0.113.10 のポート番号 51001 あてに返します。サーバが知っているのは書き換えた後の住所だけです。","text":"④ サーバは返事を 203.0.113.10 のポート番号 51001 あてに返します。サーバが知っているのは書き換えた後の住所だけです。","line":55,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_98eeef","type":"paragraph","markdown":"⑤ ルータ 1 は変換表を逆に引いて、宛先を 192.168.10.10 のポート番号 50000 に書き戻し、内側へ転送します。","text":"⑤ ルータ 1 は変換表を逆に引いて、宛先を 192.168.10.10 のポート番号 50000 に書き戻し、内側へ転送します。","line":57,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_3617e1","type":"heading","depth":2,"markdown":"## 図 8","text":"図 8","line":59,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_91016a","type":"paragraph","markdown":"図の上半分が構成図と 3 種の分け方、下半分が各テーブルの推移と通信の中身の推移です。","text":"図の上半分が構成図と 3 種の分け方、下半分が各テーブルの推移と通信の中身の推移です。","line":61,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_8f7bf7","type":"html","markdown":"<svg viewBox=\"0 0 900 1622\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-label=\"NAT：送信元の住所を書き換えて外へ出る\" style=\"max-width:100%;height:auto;font-family:sans-serif\">\n  <rect x=\"0\" y=\"0\" width=\"900\" height=\"1622\" fill=\"#fbfcfe\"/>\n  <text x=\"20\" y=\"30\" text-anchor=\"start\" font-size=\"14\" font-weight=\"700\" fill=\"#1f2937\">NAT：外へ出るときに送信元の住所を書き換え、戻せるように覚えておく</text>\n  <text x=\"20\" y=\"50\" text-anchor=\"start\" font-size=\"11\" fill=\"#6b7280\">図 7 の問題 2（社内専用の住所はインターネットで運ばれない）のうち、外のサーバへ行く分だけを解く</text>\n  <rect x=\"20\" y=\"80\" width=\"280\" height=\"220\" 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=\"320\" y=\"80\" width=\"250\" height=\"220\" rx=\"10\" fill=\"#fff7ed\" stroke=\"#d97706\" stroke-width=\"1.5\" stroke-dasharray=\"6 4\"/>\n  <text x=\"332\" y=\"100\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#b45309\">インターネット（他人のもの）</text>\n  <rect x=\"590\" y=\"80\" width=\"290\" height=\"220\" rx=\"10\" fill=\"none\" stroke=\"#9aa7b5\" stroke-width=\"1.5\" stroke-dasharray=\"6 4\"/>\n  <text x=\"602\" y=\"100\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#6b7280\">外のサーバ（相手のもの）</text>\n  <rect x=\"32\" y=\"160\" width=\"88\" height=\"60\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"76.0\" y=\"180\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">PC-A</text>\n  <text x=\"76.0\" y=\"198\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">192.168.10.10</text>\n  <text x=\"76.0\" y=\"213\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">GW 192.168.10.1</text>\n  <line x1=\"120\" y1=\"190\" x2=\"150\" y2=\"190\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"150\" y=\"146\" width=\"140\" height=\"100\" rx=\"8\" fill=\"#f2f5f9\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"220.0\" y=\"166\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1</text>\n  <text x=\"220.0\" y=\"184\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi0 192.168.10.1</text>\n  <text x=\"220.0\" y=\"199\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">（内側 ip nat inside）</text>\n  <text x=\"220.0\" y=\"214\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi1 203.0.113.10</text>\n  <text x=\"220.0\" y=\"229\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">（外側 ip nat outside）</text>\n  <rect x=\"141\" y=\"181\" width=\"18\" height=\"18\" fill=\"#ffffff\" stroke=\"#6b7280\" stroke-width=\"1.5\"/><text x=\"150\" y=\"194\" text-anchor=\"middle\" font-size=\"8\" fill=\"#1f2937\">Gi0</text>\n  <rect x=\"281\" y=\"181\" width=\"18\" height=\"18\" fill=\"#ffffff\" stroke=\"#6b7280\" stroke-width=\"1.5\"/><text x=\"290\" y=\"194\" text-anchor=\"middle\" font-size=\"8\" fill=\"#1f2937\">Gi1</text>\n  <line x1=\"299\" y1=\"190\" x2=\"340\" y2=\"190\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"340\" y=\"160\" width=\"100\" height=\"60\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"390.0\" y=\"180\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ISP-1</text>\n  <text x=\"390.0\" y=\"198\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">プロバイダのルータ</text>\n  <text x=\"390.0\" y=\"213\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">203.0.113.1</text>\n  <line x1=\"440\" y1=\"190\" x2=\"470\" y2=\"190\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"470\" y=\"160\" width=\"90\" height=\"60\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"515.0\" y=\"180\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ISP-2</text>\n  <text x=\"515.0\" y=\"198\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">他人の</text>\n  <text x=\"515.0\" y=\"213\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">ルータ</text>\n  <line x1=\"560\" y1=\"190\" x2=\"620\" y2=\"190\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"620\" y=\"155\" width=\"190\" height=\"70\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"715.0\" y=\"175\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">外のサーバ</text>\n  <text x=\"715.0\" y=\"193\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">192.0.2.50</text>\n  <text x=\"715.0\" y=\"208\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">ウェブ（ポート番号 80）</text>\n  <line x1=\"100\" y1=\"126\" x2=\"152\" y2=\"126\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"151,121 151,131 160,126\" fill=\"#0a7aff\"/>\n  <circle cx=\"130\" cy=\"126\" r=\"9\" fill=\"#0a7aff\"/><text x=\"130\" y=\"130\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">1</text>\n  <line x1=\"280\" y1=\"126\" x2=\"342\" y2=\"126\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"341,121 341,131 350,126\" fill=\"#0a7aff\"/>\n  <circle cx=\"315\" cy=\"126\" r=\"9\" fill=\"#0a7aff\"/><text x=\"315\" y=\"130\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">2</text>\n  <line x1=\"450\" y1=\"126\" x2=\"622\" y2=\"126\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"621,121 621,131 630,126\" fill=\"#0a7aff\"/>\n  <circle cx=\"540\" cy=\"126\" r=\"9\" fill=\"#0a7aff\"/><text x=\"540\" y=\"130\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">3</text>\n  <line x1=\"630\" y1=\"262\" x2=\"308\" y2=\"262\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"309,257 309,267 300,262\" fill=\"#0a7aff\"/>\n  <circle cx=\"465\" cy=\"262\" r=\"9\" fill=\"#0a7aff\"/><text x=\"465\" y=\"266\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">4</text>\n  <line x1=\"280\" y1=\"262\" x2=\"118\" y2=\"262\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"119,257 119,267 110,262\" fill=\"#0a7aff\"/>\n  <circle cx=\"195\" cy=\"262\" r=\"9\" fill=\"#0a7aff\"/><text x=\"195\" y=\"266\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">5</text>\n  <text x=\"190\" y=\"288\" text-anchor=\"start\" font-size=\"10\" font-weight=\"700\" fill=\"#0a7aff\">② ここで送信元を書き換える</text>\n  <text x=\"445\" y=\"288\" text-anchor=\"start\" font-size=\"10\" fill=\"#b45309\">送信元も宛先もグローバル IP なので運べる</text>\n  <text x=\"715\" y=\"288\" text-anchor=\"start\" font-size=\"10\" fill=\"#6b7280\">サーバに社内の住所は見えない</text>\n  <text x=\"20\" y=\"326\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">内側の送信元を書き換える NAT の 3 種（この図の ② でどれを使うか）</text>\n  <rect x=\"20\" y=\"336\" width=\"280\" height=\"126\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"32\" y=\"356\" text-anchor=\"start\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">静的 NAT（1 対 1・固定）</text>\n  <text x=\"32\" y=\"374\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">人が 1 行書く（手動）</text>\n  <text x=\"32\" y=\"389\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">住所だけを 1 対 1 で置き換える</text>\n  <text x=\"32\" y=\"404\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">（ポート番号まで固定で結ぶ書き方</text>\n  <text x=\"32\" y=\"419\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　もあるが、この図では扱わない）</text>\n  <text x=\"32\" y=\"434\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">行はずっと残る</text>\n  <text x=\"32\" y=\"449\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">外から中へ入る用途にも使える</text>\n  <rect x=\"310\" y=\"336\" width=\"280\" height=\"126\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"322\" y=\"356\" text-anchor=\"start\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">動的 NAT（プール）</text>\n  <text x=\"322\" y=\"374\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">外側の住所を何個か用意しておく</text>\n  <text x=\"322\" y=\"389\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">通信の開始で 1 つ割り当てる</text>\n  <text x=\"322\" y=\"404\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">行は自動でできて、通信が</text>\n  <text x=\"322\" y=\"419\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　終わると消える</text>\n  <text x=\"322\" y=\"434\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">同時に使えるのは住所の数まで</text>\n  <rect x=\"600\" y=\"336\" width=\"280\" height=\"126\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"612\" y=\"356\" text-anchor=\"start\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">PAT（1 つの外側 IP を共用）</text>\n  <text x=\"612\" y=\"374\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">住所とポート番号の組で覚える</text>\n  <text x=\"612\" y=\"389\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">ポート番号が違えば、同じ外側 IP</text>\n  <text x=\"612\" y=\"404\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　を何台でも共用できる</text>\n  <text x=\"612\" y=\"419\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">行は通信の開始で自動にできる</text>\n  <text x=\"612\" y=\"434\" text-anchor=\"start\" font-size=\"10\" fill=\"#0a7aff\">この図の ② はこれ</text>\n  <text x=\"20\" y=\"482\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">フロー</text>\n  <text x=\"20\" y=\"502\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">① A は宛先 192.0.2.50 が自分のネットワーク外なので、デフォルトゲートウェイ（ルータ 1）へ送る　＝図 5・図 7 の ① と同じ</text>\n  <text x=\"20\" y=\"520\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">② ルータ 1 は外側の口（Gi1）から出すときに、送信元を 192.168.10.10:50000 から 203.0.113.10:51001 に書き換え、変換表に 1 行書く</text>\n  <text x=\"20\" y=\"538\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">③ 宛先も送信元もグローバル IP なので、インターネットは運べる。図 7 の ③ で捨てられたのは、宛先が社内専用の住所だったから</text>\n  <text x=\"20\" y=\"556\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">④ サーバは返事を 203.0.113.10:51001 あてに返す。サーバが知っているのは書き換えた後の住所だけで、192.168.10.10 は見えない</text>\n  <text x=\"20\" y=\"574\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">⑤ ルータ 1 は変換表を逆に引いて、宛先を 192.168.10.10:50000 に書き戻し、内側へ転送する</text>\n  <text x=\"20\" y=\"602\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">3 層で見ると</text>\n  <text x=\"20\" y=\"622\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">もの：変換表（NAT テーブル。論理）。内側ローカル＝社内の実際の住所、内側グローバル＝書き換えた後の外向けの住所</text>\n  <text x=\"20\" y=\"640\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">結びつき：インターフェース ⇄ 内側／外側の役（手動）。内側の住所＋ポート番号 ⇄ 外側の住所＋ポート番号（静的は手動、動的と PAT は通信で自動）</text>\n  <text x=\"20\" y=\"658\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">フロー：図 5 の「宛先 IP・送信元 IP は端から端まで変わらない」が、NAT を通す区間で崩れる。MAC の付け替えは図 5 のまま</text>\n  <text x=\"20\" y=\"684\" text-anchor=\"start\" font-size=\"10\" fill=\"#6b7280\">図 7 の 3 つの問題のうち、解けるのは問題 2 の「外向き」だけ。支店とデータセンターの社内住所同士をつなぐ話（図 10 の GRE・図 11 の IPsec）は別の道具</text>\n  <text x=\"20\" y=\"700\" text-anchor=\"start\" font-size=\"10\" fill=\"#6b7280\">図の 192.0.2.50 も説明用に予約された番地（RFC 5737）。203.0.113.x は図 7 と同じ</text>\n<line x1=\"20\" y1=\"724\" x2=\"880\" y2=\"724\" stroke=\"#d6dde5\" stroke-width=\"1\"/>\n<text x=\"20\" y=\"746\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">各テーブルの推移（変換表だけは、人が書く行と通信でできる行の両方がある）</text>\n<text x=\"20\" y=\"758\" font-size=\"10\" fill=\"#6b7280\">前提: ルータ 1 に PAT（1 つの外側 IP を共用）が設定してあり、Gi0 を内側・Gi1 を外側と指定済み</text>\n  <rect x=\"20\" y=\"772\" width=\"280\" height=\"105\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"30\" y=\"788\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: 変換表（NAT テーブル）</text>\n  <text x=\"30\" y=\"804\" font-size=\"10\" fill=\"#0a7aff\">② 追加: 内側 192.168.10.10:50000</text>\n  <text x=\"30\" y=\"819\" font-size=\"10\" fill=\"#374151\">　　　　⇄ 外側 203.0.113.10:51001</text>\n  <text x=\"30\" y=\"834\" font-size=\"10\" fill=\"#374151\">　　　　（相手 192.0.2.50:80）</text>\n  <text x=\"30\" y=\"849\" font-size=\"10\" fill=\"#0a7aff\">⑤ この行を逆に引いて書き戻す</text>\n  <text x=\"30\" y=\"864\" font-size=\"10\" fill=\"#374151\">通信が終わると消える（動的・PAT）</text>\n  <rect x=\"310\" y=\"772\" width=\"280\" height=\"90\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"320\" y=\"788\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: ルーティングテーブル</text>\n  <text x=\"320\" y=\"804\" font-size=\"10\" fill=\"#374151\">192.168.10.0/24 → Gi0（自動）</text>\n  <text x=\"320\" y=\"819\" font-size=\"10\" fill=\"#374151\">203.0.113.0/24 → Gi1（自動）</text>\n  <text x=\"320\" y=\"834\" font-size=\"10\" fill=\"#374151\">0.0.0.0/0 → 203.0.113.1（手動）</text>\n  <text x=\"320\" y=\"849\" font-size=\"10\" fill=\"#374151\">図 7 と同じ。NAT では行は増えない</text>\n  <rect x=\"600\" y=\"772\" width=\"280\" height=\"60\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"610\" y=\"788\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: ARP テーブル</text>\n  <text x=\"610\" y=\"804\" font-size=\"10\" fill=\"#0a7aff\">① 追加: 192.168.10.10 → MAC A</text>\n  <text x=\"610\" y=\"819\" font-size=\"10\" fill=\"#0a7aff\">② 追加: 203.0.113.1 → MAC ISP-1</text>\n  <rect x=\"20\" y=\"887\" width=\"280\" height=\"75\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"30\" y=\"903\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">インターフェースの役（手動で指定）</text>\n  <text x=\"30\" y=\"919\" font-size=\"10\" fill=\"#374151\">Gi0（内側）: ip nat inside</text>\n  <text x=\"30\" y=\"934\" font-size=\"10\" fill=\"#374151\">Gi1（外側）: ip nat outside</text>\n  <text x=\"30\" y=\"949\" font-size=\"10\" fill=\"#374151\">この指定が無いと変換は起きない</text>\n  <rect x=\"310\" y=\"887\" width=\"280\" height=\"75\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"320\" y=\"903\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">外のサーバから見えるもの</text>\n  <text x=\"320\" y=\"919\" font-size=\"10\" fill=\"#374151\">相手の IP は 203.0.113.10</text>\n  <text x=\"320\" y=\"934\" font-size=\"10\" fill=\"#374151\">相手のポート番号は 51001</text>\n  <text x=\"320\" y=\"949\" font-size=\"10\" fill=\"#374151\">192.168.10.10 は見えない</text>\n<text x=\"20\" y=\"1002\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">通信の中身の推移（フローごとのフレーム／パケット）</text>\n  <text x=\"20\" y=\"1052\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">① PC-A → ルータ 1（内側の区間）</text>\n  <rect x=\"20\" y=\"1058\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R1-Gi0</text>\n  <rect x=\"138\" y=\"1058\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC A</text>\n  <rect x=\"256\" y=\"1058\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"315.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 IP</text>\n  <text x=\"315.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.0.2.50</text>\n  <rect x=\"374\" y=\"1058\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"433.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 IP</text>\n  <text x=\"433.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.168.10.10</text>\n  <rect x=\"492\" y=\"1058\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"544.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元ポート番号</text>\n  <text x=\"544.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">50000</text>\n  <rect x=\"596\" y=\"1058\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"648.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先ポート番号</text>\n  <text x=\"648.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">80</text>\n  <rect x=\"700\" y=\"1058\" width=\"70\" height=\"36\" fill=\"#ffffff\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"735.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">データ</text>\n  <text x=\"735.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ウェブ</text>\n  <line x1=\"20\" y1=\"1102\" x2=\"770\" y2=\"1102\" stroke=\"#374151\" stroke-width=\"1.5\"/><line x1=\"20\" y1=\"1098\" x2=\"20\" y2=\"1102\" stroke=\"#374151\" stroke-width=\"1.5\"/><line x1=\"770\" y1=\"1098\" x2=\"770\" y2=\"1102\" stroke=\"#374151\" stroke-width=\"1.5\"/>\n  <text x=\"395.0\" y=\"1115\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">フレーム＝全部。ただしスイッチが見るのは MAC とタグの部分だけ</text>\n  <line x1=\"256\" y1=\"1044\" x2=\"770\" y2=\"1044\" stroke=\"#0a7aff\" stroke-width=\"1.5\"/><line x1=\"256\" y1=\"1044\" x2=\"256\" y2=\"1048\" stroke=\"#0a7aff\" stroke-width=\"1.5\"/><line x1=\"770\" y1=\"1044\" x2=\"770\" y2=\"1048\" stroke=\"#0a7aff\" stroke-width=\"1.5\"/>\n  <text x=\"513.0\" y=\"1040\" text-anchor=\"middle\" font-size=\"10\" fill=\"#0a7aff\">パケット＝この部分。NAT を使うルータは、IP とその後ろのポート番号まで見る</text>\n  <text x=\"20\" y=\"1148\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">② ルータ 1 → ISP-1（外側の区間・送信元 IP と送信元ポート番号が書き換わる）</text>\n  <rect x=\"20\" y=\"1154\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC ISP-1</text>\n  <rect x=\"138\" y=\"1154\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R1-Gi1</text>\n  <rect x=\"256\" y=\"1154\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"315.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 IP</text>\n  <text x=\"315.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.0.2.50</text>\n  <rect x=\"374\" y=\"1154\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"433.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 IP</text>\n  <text x=\"433.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">203.0.113.10</text>\n  <rect x=\"492\" y=\"1154\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"544.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元ポート番号</text>\n  <text x=\"544.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">51001</text>\n  <rect x=\"596\" y=\"1154\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"648.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先ポート番号</text>\n  <text x=\"648.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">80</text>\n  <rect x=\"700\" y=\"1154\" width=\"70\" height=\"36\" fill=\"#ffffff\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"735.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">データ</text>\n  <text x=\"735.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ウェブ</text>\n  <text x=\"20\" y=\"1208\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">③ インターネットの中</text>\n  <text x=\"20\" y=\"1228\" font-size=\"10\" fill=\"#6b7280\">宛先がグローバル IP なので運ばれる。送信元も書き換え済みなので、返事の宛先もグローバル IP になり、戻ってこられる</text>\n  <text x=\"20\" y=\"1252\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">④ サーバ → ルータ 1（外側の区間・返事）</text>\n  <rect x=\"20\" y=\"1258\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R1-Gi1</text>\n  <rect x=\"138\" y=\"1258\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC ISP-1</text>\n  <rect x=\"256\" y=\"1258\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"315.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 IP</text>\n  <text x=\"315.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">203.0.113.10</text>\n  <rect x=\"374\" y=\"1258\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"433.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 IP</text>\n  <text x=\"433.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.0.2.50</text>\n  <rect x=\"492\" y=\"1258\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"544.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元ポート番号</text>\n  <text x=\"544.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">80</text>\n  <rect x=\"596\" y=\"1258\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"648.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先ポート番号</text>\n  <text x=\"648.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">51001</text>\n  <rect x=\"700\" y=\"1258\" width=\"70\" height=\"36\" fill=\"#ffffff\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"735.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">データ</text>\n  <text x=\"735.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">返事</text>\n  <text x=\"20\" y=\"1312\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">⑤ ルータ 1 → PC-A（内側の区間・宛先 IP と宛先ポート番号が書き戻る）</text>\n  <rect x=\"20\" y=\"1318\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC A</text>\n  <rect x=\"138\" y=\"1318\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R1-Gi0</text>\n  <rect x=\"256\" y=\"1318\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"315.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 IP</text>\n  <text x=\"315.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.168.10.10</text>\n  <rect x=\"374\" y=\"1318\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"433.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 IP</text>\n  <text x=\"433.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.0.2.50</text>\n  <rect x=\"492\" y=\"1318\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"544.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元ポート番号</text>\n  <text x=\"544.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">80</text>\n  <rect x=\"596\" y=\"1318\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"648.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先ポート番号</text>\n  <text x=\"648.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">50000</text>\n  <rect x=\"700\" y=\"1318\" width=\"70\" height=\"36\" fill=\"#ffffff\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"735.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">データ</text>\n  <text x=\"735.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">返事</text>\n<text x=\"20\" y=\"1372\" font-size=\"10\" fill=\"#6b7280\">NAT は IP の部分だけでなく、その後ろの TCP/UDP のポート番号まで見て書き換える。IP だけを見ていた図 5 との違い</text>\n<text x=\"20\" y=\"1388\" font-size=\"10\" fill=\"#6b7280\">図 5 では「宛先 IP・送信元 IP は端から端まで変わらない」と書いた。NAT を通す区間では、行きで送信元側が、帰りで宛先側が書き換わる</text>\n<text x=\"20\" y=\"1404\" font-size=\"10\" fill=\"#6b7280\">外側のポート番号はルータが選ぶ。内側と同じ番号をそのまま使おうとする実装もある（RFC 4787 4.2.1）。</text>\n<text x=\"20\" y=\"1420\" font-size=\"10\" fill=\"#6b7280\">　ただし、ぶつかったときも同じ番号にし続ける使い方（ポート多重）は禁止されている（同 REQ-3）</text>\n<text x=\"20\" y=\"1436\" font-size=\"10\" fill=\"#6b7280\">ルータの中の順序（内側 → 外側）: 入口の ACL → 経路探し → 変換 → 出口の ACL</text>\n<text x=\"20\" y=\"1452\" font-size=\"10\" fill=\"#6b7280\">　帰り（外側 → 内側）は 入口の ACL → 変換 → 経路探し → 出口の ACL で、変換のほうが先に来る</text>\n<text x=\"20\" y=\"1468\" font-size=\"10\" fill=\"#6b7280\">未検証: プールを使い切ったときの挙動（infraexpert の動的 NAT ページに記述なし）</text>\n<text x=\"20\" y=\"1484\" font-size=\"10\" fill=\"#6b7280\">出典（NAT と NAPT の定義）: RFC 3022 https://www.rfc-editor.org/rfc/rfc3022.html</text>\n<text x=\"20\" y=\"1500\" font-size=\"10\" fill=\"#6b7280\">出典（NAPT はポート番号も変換するので 1 つのグローバル IP を共用できる）: https://www.infraexpert.com/study/ip11.5.html</text>\n<text x=\"20\" y=\"1516\" font-size=\"10\" fill=\"#6b7280\">出典（内部ローカル・内部グローバル、ip nat inside / ip nat outside）: https://www.infraexpert.com/study/natz0.html</text>\n<text x=\"20\" y=\"1532\" font-size=\"10\" fill=\"#6b7280\">出典（動的 NAT の行は通信の開始ででき、終了で消える）: https://www.infraexpert.com/study/natz1.html</text>\n<text x=\"20\" y=\"1548\" font-size=\"10\" fill=\"#6b7280\">出典（外側ポート番号の選び方・ポート多重の禁止）: RFC 4787 4.2.1 / REQ-3 https://www.rfc-editor.org/rfc/rfc4787.html</text>\n<text x=\"20\" y=\"1564\" font-size=\"10\" fill=\"#6b7280\">出典（ルータの中の順序）: Cisco Understand the NAT Order of Operation</text>\n<text x=\"20\" y=\"1580\" font-size=\"10\" fill=\"#6b7280\">　https://www.cisco.com/c/en/us/support/docs/ip/network-address-translation-nat/6209-5.html</text>\n<text x=\"20\" y=\"1596\" font-size=\"10\" fill=\"#6b7280\">出典（ウェブの既定のポート番号が 80）: RFC 9110 4.2.1 https://www.rfc-editor.org/rfc/rfc9110.html</text>\n</svg>\n## 図 7・図 9 との接続","text":"<svg viewBox=\"0 0 900 1622\" xmlns=\"http://www.w3.org/2000/svg\" role=\"img\" aria-label=\"NAT：送信元の住所を書き換えて外へ出る\" style=\"max-width:100%;height:auto;font-family:sans-serif\">\n  <rect x=\"0\" y=\"0\" width=\"900\" height=\"1622\" fill=\"#fbfcfe\"/>\n  <text x=\"20\" y=\"30\" text-anchor=\"start\" font-size=\"14\" font-weight=\"700\" fill=\"#1f2937\">NAT：外へ出るときに送信元の住所を書き換え、戻せるように覚えておく</text>\n  <text x=\"20\" y=\"50\" text-anchor=\"start\" font-size=\"11\" fill=\"#6b7280\">図 7 の問題 2（社内専用の住所はインターネットで運ばれない）のうち、外のサーバへ行く分だけを解く</text>\n  <rect x=\"20\" y=\"80\" width=\"280\" height=\"220\" 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=\"320\" y=\"80\" width=\"250\" height=\"220\" rx=\"10\" fill=\"#fff7ed\" stroke=\"#d97706\" stroke-width=\"1.5\" stroke-dasharray=\"6 4\"/>\n  <text x=\"332\" y=\"100\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#b45309\">インターネット（他人のもの）</text>\n  <rect x=\"590\" y=\"80\" width=\"290\" height=\"220\" rx=\"10\" fill=\"none\" stroke=\"#9aa7b5\" stroke-width=\"1.5\" stroke-dasharray=\"6 4\"/>\n  <text x=\"602\" y=\"100\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#6b7280\">外のサーバ（相手のもの）</text>\n  <rect x=\"32\" y=\"160\" width=\"88\" height=\"60\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"76.0\" y=\"180\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">PC-A</text>\n  <text x=\"76.0\" y=\"198\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">192.168.10.10</text>\n  <text x=\"76.0\" y=\"213\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">GW 192.168.10.1</text>\n  <line x1=\"120\" y1=\"190\" x2=\"150\" y2=\"190\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"150\" y=\"146\" width=\"140\" height=\"100\" rx=\"8\" fill=\"#f2f5f9\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"220.0\" y=\"166\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1</text>\n  <text x=\"220.0\" y=\"184\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi0 192.168.10.1</text>\n  <text x=\"220.0\" y=\"199\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">（内側 ip nat inside）</text>\n  <text x=\"220.0\" y=\"214\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">Gi1 203.0.113.10</text>\n  <text x=\"220.0\" y=\"229\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">（外側 ip nat outside）</text>\n  <rect x=\"141\" y=\"181\" width=\"18\" height=\"18\" fill=\"#ffffff\" stroke=\"#6b7280\" stroke-width=\"1.5\"/><text x=\"150\" y=\"194\" text-anchor=\"middle\" font-size=\"8\" fill=\"#1f2937\">Gi0</text>\n  <rect x=\"281\" y=\"181\" width=\"18\" height=\"18\" fill=\"#ffffff\" stroke=\"#6b7280\" stroke-width=\"1.5\"/><text x=\"290\" y=\"194\" text-anchor=\"middle\" font-size=\"8\" fill=\"#1f2937\">Gi1</text>\n  <line x1=\"299\" y1=\"190\" x2=\"340\" y2=\"190\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"340\" y=\"160\" width=\"100\" height=\"60\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"390.0\" y=\"180\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ISP-1</text>\n  <text x=\"390.0\" y=\"198\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">プロバイダのルータ</text>\n  <text x=\"390.0\" y=\"213\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">203.0.113.1</text>\n  <line x1=\"440\" y1=\"190\" x2=\"470\" y2=\"190\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"470\" y=\"160\" width=\"90\" height=\"60\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"515.0\" y=\"180\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">ISP-2</text>\n  <text x=\"515.0\" y=\"198\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">他人の</text>\n  <text x=\"515.0\" y=\"213\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">ルータ</text>\n  <line x1=\"560\" y1=\"190\" x2=\"620\" y2=\"190\" stroke=\"#374151\" stroke-width=\"2\"/>\n  <rect x=\"620\" y=\"155\" width=\"190\" height=\"70\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"715.0\" y=\"175\" text-anchor=\"middle\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">外のサーバ</text>\n  <text x=\"715.0\" y=\"193\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">192.0.2.50</text>\n  <text x=\"715.0\" y=\"208\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">ウェブ（ポート番号 80）</text>\n  <line x1=\"100\" y1=\"126\" x2=\"152\" y2=\"126\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"151,121 151,131 160,126\" fill=\"#0a7aff\"/>\n  <circle cx=\"130\" cy=\"126\" r=\"9\" fill=\"#0a7aff\"/><text x=\"130\" y=\"130\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">1</text>\n  <line x1=\"280\" y1=\"126\" x2=\"342\" y2=\"126\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"341,121 341,131 350,126\" fill=\"#0a7aff\"/>\n  <circle cx=\"315\" cy=\"126\" r=\"9\" fill=\"#0a7aff\"/><text x=\"315\" y=\"130\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">2</text>\n  <line x1=\"450\" y1=\"126\" x2=\"622\" y2=\"126\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"621,121 621,131 630,126\" fill=\"#0a7aff\"/>\n  <circle cx=\"540\" cy=\"126\" r=\"9\" fill=\"#0a7aff\"/><text x=\"540\" y=\"130\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">3</text>\n  <line x1=\"630\" y1=\"262\" x2=\"308\" y2=\"262\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"309,257 309,267 300,262\" fill=\"#0a7aff\"/>\n  <circle cx=\"465\" cy=\"262\" r=\"9\" fill=\"#0a7aff\"/><text x=\"465\" y=\"266\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">4</text>\n  <line x1=\"280\" y1=\"262\" x2=\"118\" y2=\"262\" stroke=\"#0a7aff\" stroke-width=\"2\"/><polygon points=\"119,257 119,267 110,262\" fill=\"#0a7aff\"/>\n  <circle cx=\"195\" cy=\"262\" r=\"9\" fill=\"#0a7aff\"/><text x=\"195\" y=\"266\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#ffffff\">5</text>\n  <text x=\"190\" y=\"288\" text-anchor=\"start\" font-size=\"10\" font-weight=\"700\" fill=\"#0a7aff\">② ここで送信元を書き換える</text>\n  <text x=\"445\" y=\"288\" text-anchor=\"start\" font-size=\"10\" fill=\"#b45309\">送信元も宛先もグローバル IP なので運べる</text>\n  <text x=\"715\" y=\"288\" text-anchor=\"start\" font-size=\"10\" fill=\"#6b7280\">サーバに社内の住所は見えない</text>\n  <text x=\"20\" y=\"326\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">内側の送信元を書き換える NAT の 3 種（この図の ② でどれを使うか）</text>\n  <rect x=\"20\" y=\"336\" width=\"280\" height=\"126\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"32\" y=\"356\" text-anchor=\"start\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">静的 NAT（1 対 1・固定）</text>\n  <text x=\"32\" y=\"374\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">人が 1 行書く（手動）</text>\n  <text x=\"32\" y=\"389\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">住所だけを 1 対 1 で置き換える</text>\n  <text x=\"32\" y=\"404\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">（ポート番号まで固定で結ぶ書き方</text>\n  <text x=\"32\" y=\"419\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　もあるが、この図では扱わない）</text>\n  <text x=\"32\" y=\"434\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">行はずっと残る</text>\n  <text x=\"32\" y=\"449\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">外から中へ入る用途にも使える</text>\n  <rect x=\"310\" y=\"336\" width=\"280\" height=\"126\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"322\" y=\"356\" text-anchor=\"start\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">動的 NAT（プール）</text>\n  <text x=\"322\" y=\"374\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">外側の住所を何個か用意しておく</text>\n  <text x=\"322\" y=\"389\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">通信の開始で 1 つ割り当てる</text>\n  <text x=\"322\" y=\"404\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">行は自動でできて、通信が</text>\n  <text x=\"322\" y=\"419\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　終わると消える</text>\n  <text x=\"322\" y=\"434\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">同時に使えるのは住所の数まで</text>\n  <rect x=\"600\" y=\"336\" width=\"280\" height=\"126\" rx=\"8\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"612\" y=\"356\" text-anchor=\"start\" font-size=\"13\" font-weight=\"700\" fill=\"#1f2937\">PAT（1 つの外側 IP を共用）</text>\n  <text x=\"612\" y=\"374\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">住所とポート番号の組で覚える</text>\n  <text x=\"612\" y=\"389\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">ポート番号が違えば、同じ外側 IP</text>\n  <text x=\"612\" y=\"404\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">　を何台でも共用できる</text>\n  <text x=\"612\" y=\"419\" text-anchor=\"start\" font-size=\"10\" fill=\"#374151\">行は通信の開始で自動にできる</text>\n  <text x=\"612\" y=\"434\" text-anchor=\"start\" font-size=\"10\" fill=\"#0a7aff\">この図の ② はこれ</text>\n  <text x=\"20\" y=\"482\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">フロー</text>\n  <text x=\"20\" y=\"502\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">① A は宛先 192.0.2.50 が自分のネットワーク外なので、デフォルトゲートウェイ（ルータ 1）へ送る　＝図 5・図 7 の ① と同じ</text>\n  <text x=\"20\" y=\"520\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">② ルータ 1 は外側の口（Gi1）から出すときに、送信元を 192.168.10.10:50000 から 203.0.113.10:51001 に書き換え、変換表に 1 行書く</text>\n  <text x=\"20\" y=\"538\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">③ 宛先も送信元もグローバル IP なので、インターネットは運べる。図 7 の ③ で捨てられたのは、宛先が社内専用の住所だったから</text>\n  <text x=\"20\" y=\"556\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">④ サーバは返事を 203.0.113.10:51001 あてに返す。サーバが知っているのは書き換えた後の住所だけで、192.168.10.10 は見えない</text>\n  <text x=\"20\" y=\"574\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">⑤ ルータ 1 は変換表を逆に引いて、宛先を 192.168.10.10:50000 に書き戻し、内側へ転送する</text>\n  <text x=\"20\" y=\"602\" text-anchor=\"start\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">3 層で見ると</text>\n  <text x=\"20\" y=\"622\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">もの：変換表（NAT テーブル。論理）。内側ローカル＝社内の実際の住所、内側グローバル＝書き換えた後の外向けの住所</text>\n  <text x=\"20\" y=\"640\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">結びつき：インターフェース ⇄ 内側／外側の役（手動）。内側の住所＋ポート番号 ⇄ 外側の住所＋ポート番号（静的は手動、動的と PAT は通信で自動）</text>\n  <text x=\"20\" y=\"658\" text-anchor=\"start\" font-size=\"11\" fill=\"#374151\">フロー：図 5 の「宛先 IP・送信元 IP は端から端まで変わらない」が、NAT を通す区間で崩れる。MAC の付け替えは図 5 のまま</text>\n  <text x=\"20\" y=\"684\" text-anchor=\"start\" font-size=\"10\" fill=\"#6b7280\">図 7 の 3 つの問題のうち、解けるのは問題 2 の「外向き」だけ。支店とデータセンターの社内住所同士をつなぐ話（図 10 の GRE・図 11 の IPsec）は別の道具</text>\n  <text x=\"20\" y=\"700\" text-anchor=\"start\" font-size=\"10\" fill=\"#6b7280\">図の 192.0.2.50 も説明用に予約された番地（RFC 5737）。203.0.113.x は図 7 と同じ</text>\n<line x1=\"20\" y1=\"724\" x2=\"880\" y2=\"724\" stroke=\"#d6dde5\" stroke-width=\"1\"/>\n<text x=\"20\" y=\"746\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">各テーブルの推移（変換表だけは、人が書く行と通信でできる行の両方がある）</text>\n<text x=\"20\" y=\"758\" font-size=\"10\" fill=\"#6b7280\">前提: ルータ 1 に PAT（1 つの外側 IP を共用）が設定してあり、Gi0 を内側・Gi1 を外側と指定済み</text>\n  <rect x=\"20\" y=\"772\" width=\"280\" height=\"105\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"30\" y=\"788\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: 変換表（NAT テーブル）</text>\n  <text x=\"30\" y=\"804\" font-size=\"10\" fill=\"#0a7aff\">② 追加: 内側 192.168.10.10:50000</text>\n  <text x=\"30\" y=\"819\" font-size=\"10\" fill=\"#374151\">　　　　⇄ 外側 203.0.113.10:51001</text>\n  <text x=\"30\" y=\"834\" font-size=\"10\" fill=\"#374151\">　　　　（相手 192.0.2.50:80）</text>\n  <text x=\"30\" y=\"849\" font-size=\"10\" fill=\"#0a7aff\">⑤ この行を逆に引いて書き戻す</text>\n  <text x=\"30\" y=\"864\" font-size=\"10\" fill=\"#374151\">通信が終わると消える（動的・PAT）</text>\n  <rect x=\"310\" y=\"772\" width=\"280\" height=\"90\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"320\" y=\"788\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: ルーティングテーブル</text>\n  <text x=\"320\" y=\"804\" font-size=\"10\" fill=\"#374151\">192.168.10.0/24 → Gi0（自動）</text>\n  <text x=\"320\" y=\"819\" font-size=\"10\" fill=\"#374151\">203.0.113.0/24 → Gi1（自動）</text>\n  <text x=\"320\" y=\"834\" font-size=\"10\" fill=\"#374151\">0.0.0.0/0 → 203.0.113.1（手動）</text>\n  <text x=\"320\" y=\"849\" font-size=\"10\" fill=\"#374151\">図 7 と同じ。NAT では行は増えない</text>\n  <rect x=\"600\" y=\"772\" width=\"280\" height=\"60\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"610\" y=\"788\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ルータ 1: ARP テーブル</text>\n  <text x=\"610\" y=\"804\" font-size=\"10\" fill=\"#0a7aff\">① 追加: 192.168.10.10 → MAC A</text>\n  <text x=\"610\" y=\"819\" font-size=\"10\" fill=\"#0a7aff\">② 追加: 203.0.113.1 → MAC ISP-1</text>\n  <rect x=\"20\" y=\"887\" width=\"280\" height=\"75\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"30\" y=\"903\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">インターフェースの役（手動で指定）</text>\n  <text x=\"30\" y=\"919\" font-size=\"10\" fill=\"#374151\">Gi0（内側）: ip nat inside</text>\n  <text x=\"30\" y=\"934\" font-size=\"10\" fill=\"#374151\">Gi1（外側）: ip nat outside</text>\n  <text x=\"30\" y=\"949\" font-size=\"10\" fill=\"#374151\">この指定が無いと変換は起きない</text>\n  <rect x=\"310\" y=\"887\" width=\"280\" height=\"75\" rx=\"6\" fill=\"#ffffff\" stroke=\"#b9c4d0\" stroke-width=\"1.5\"/>\n  <text x=\"320\" y=\"903\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">外のサーバから見えるもの</text>\n  <text x=\"320\" y=\"919\" font-size=\"10\" fill=\"#374151\">相手の IP は 203.0.113.10</text>\n  <text x=\"320\" y=\"934\" font-size=\"10\" fill=\"#374151\">相手のポート番号は 51001</text>\n  <text x=\"320\" y=\"949\" font-size=\"10\" fill=\"#374151\">192.168.10.10 は見えない</text>\n<text x=\"20\" y=\"1002\" font-size=\"12\" font-weight=\"700\" fill=\"#1f2937\">通信の中身の推移（フローごとのフレーム／パケット）</text>\n  <text x=\"20\" y=\"1052\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">① PC-A → ルータ 1（内側の区間）</text>\n  <rect x=\"20\" y=\"1058\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R1-Gi0</text>\n  <rect x=\"138\" y=\"1058\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC A</text>\n  <rect x=\"256\" y=\"1058\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"315.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 IP</text>\n  <text x=\"315.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.0.2.50</text>\n  <rect x=\"374\" y=\"1058\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"433.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 IP</text>\n  <text x=\"433.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.168.10.10</text>\n  <rect x=\"492\" y=\"1058\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"544.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元ポート番号</text>\n  <text x=\"544.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">50000</text>\n  <rect x=\"596\" y=\"1058\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"648.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先ポート番号</text>\n  <text x=\"648.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">80</text>\n  <rect x=\"700\" y=\"1058\" width=\"70\" height=\"36\" fill=\"#ffffff\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"735.0\" y=\"1072\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">データ</text>\n  <text x=\"735.0\" y=\"1087\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ウェブ</text>\n  <line x1=\"20\" y1=\"1102\" x2=\"770\" y2=\"1102\" stroke=\"#374151\" stroke-width=\"1.5\"/><line x1=\"20\" y1=\"1098\" x2=\"20\" y2=\"1102\" stroke=\"#374151\" stroke-width=\"1.5\"/><line x1=\"770\" y1=\"1098\" x2=\"770\" y2=\"1102\" stroke=\"#374151\" stroke-width=\"1.5\"/>\n  <text x=\"395.0\" y=\"1115\" text-anchor=\"middle\" font-size=\"10\" fill=\"#374151\">フレーム＝全部。ただしスイッチが見るのは MAC とタグの部分だけ</text>\n  <line x1=\"256\" y1=\"1044\" x2=\"770\" y2=\"1044\" stroke=\"#0a7aff\" stroke-width=\"1.5\"/><line x1=\"256\" y1=\"1044\" x2=\"256\" y2=\"1048\" stroke=\"#0a7aff\" stroke-width=\"1.5\"/><line x1=\"770\" y1=\"1044\" x2=\"770\" y2=\"1048\" stroke=\"#0a7aff\" stroke-width=\"1.5\"/>\n  <text x=\"513.0\" y=\"1040\" text-anchor=\"middle\" font-size=\"10\" fill=\"#0a7aff\">パケット＝この部分。NAT を使うルータは、IP とその後ろのポート番号まで見る</text>\n  <text x=\"20\" y=\"1148\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">② ルータ 1 → ISP-1（外側の区間・送信元 IP と送信元ポート番号が書き換わる）</text>\n  <rect x=\"20\" y=\"1154\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC ISP-1</text>\n  <rect x=\"138\" y=\"1154\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R1-Gi1</text>\n  <rect x=\"256\" y=\"1154\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"315.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 IP</text>\n  <text x=\"315.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.0.2.50</text>\n  <rect x=\"374\" y=\"1154\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"433.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 IP</text>\n  <text x=\"433.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">203.0.113.10</text>\n  <rect x=\"492\" y=\"1154\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"544.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元ポート番号</text>\n  <text x=\"544.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">51001</text>\n  <rect x=\"596\" y=\"1154\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"648.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先ポート番号</text>\n  <text x=\"648.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">80</text>\n  <rect x=\"700\" y=\"1154\" width=\"70\" height=\"36\" fill=\"#ffffff\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"735.0\" y=\"1168\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">データ</text>\n  <text x=\"735.0\" y=\"1183\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">ウェブ</text>\n  <text x=\"20\" y=\"1208\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">③ インターネットの中</text>\n  <text x=\"20\" y=\"1228\" font-size=\"10\" fill=\"#6b7280\">宛先がグローバル IP なので運ばれる。送信元も書き換え済みなので、返事の宛先もグローバル IP になり、戻ってこられる</text>\n  <text x=\"20\" y=\"1252\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">④ サーバ → ルータ 1（外側の区間・返事）</text>\n  <rect x=\"20\" y=\"1258\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R1-Gi1</text>\n  <rect x=\"138\" y=\"1258\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC ISP-1</text>\n  <rect x=\"256\" y=\"1258\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"315.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 IP</text>\n  <text x=\"315.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">203.0.113.10</text>\n  <rect x=\"374\" y=\"1258\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"433.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 IP</text>\n  <text x=\"433.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.0.2.50</text>\n  <rect x=\"492\" y=\"1258\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"544.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元ポート番号</text>\n  <text x=\"544.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">80</text>\n  <rect x=\"596\" y=\"1258\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"648.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先ポート番号</text>\n  <text x=\"648.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">51001</text>\n  <rect x=\"700\" y=\"1258\" width=\"70\" height=\"36\" fill=\"#ffffff\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"735.0\" y=\"1272\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">データ</text>\n  <text x=\"735.0\" y=\"1287\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">返事</text>\n  <text x=\"20\" y=\"1312\" font-size=\"11\" font-weight=\"700\" fill=\"#1f2937\">⑤ ルータ 1 → PC-A（内側の区間・宛先 IP と宛先ポート番号が書き戻る）</text>\n  <rect x=\"20\" y=\"1318\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"79.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 MAC</text>\n  <text x=\"79.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC A</text>\n  <rect x=\"138\" y=\"1318\" width=\"118\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"197.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 MAC</text>\n  <text x=\"197.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">MAC R1-Gi0</text>\n  <rect x=\"256\" y=\"1318\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"315.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先 IP</text>\n  <text x=\"315.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.168.10.10</text>\n  <rect x=\"374\" y=\"1318\" width=\"118\" height=\"36\" fill=\"#e6f0ff\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"433.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元 IP</text>\n  <text x=\"433.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">192.0.2.50</text>\n  <rect x=\"492\" y=\"1318\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"544.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">送信元ポート番号</text>\n  <text x=\"544.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">80</text>\n  <rect x=\"596\" y=\"1318\" width=\"104\" height=\"36\" fill=\"#f2f5f9\" stroke=\"#0a7aff\" stroke-width=\"1\"/>\n  <text x=\"648.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">宛先ポート番号</text>\n  <text x=\"648.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">50000</text>\n  <rect x=\"700\" y=\"1318\" width=\"70\" height=\"36\" fill=\"#ffffff\" stroke=\"#9aa7b5\" stroke-width=\"1\"/>\n  <text x=\"735.0\" y=\"1332\" text-anchor=\"middle\" font-size=\"9\" fill=\"#6b7280\">データ</text>\n  <text x=\"735.0\" y=\"1347\" text-anchor=\"middle\" font-size=\"10\" font-weight=\"700\" fill=\"#1f2937\">返事</text>\n<text x=\"20\" y=\"1372\" font-size=\"10\" fill=\"#6b7280\">NAT は IP の部分だけでなく、その後ろの TCP/UDP のポート番号まで見て書き換える。IP だけを見ていた図 5 との違い</text>\n<text x=\"20\" y=\"1388\" font-size=\"10\" fill=\"#6b7280\">図 5 では「宛先 IP・送信元 IP は端から端まで変わらない」と書いた。NAT を通す区間では、行きで送信元側が、帰りで宛先側が書き換わる</text>\n<text x=\"20\" y=\"1404\" font-size=\"10\" fill=\"#6b7280\">外側のポート番号はルータが選ぶ。内側と同じ番号をそのまま使おうとする実装もある（RFC 4787 4.2.1）。</text>\n<text x=\"20\" y=\"1420\" font-size=\"10\" fill=\"#6b7280\">　ただし、ぶつかったときも同じ番号にし続ける使い方（ポート多重）は禁止されている（同 REQ-3）</text>\n<text x=\"20\" y=\"1436\" font-size=\"10\" fill=\"#6b7280\">ルータの中の順序（内側 → 外側）: 入口の ACL → 経路探し → 変換 → 出口の ACL</text>\n<text x=\"20\" y=\"1452\" font-size=\"10\" fill=\"#6b7280\">　帰り（外側 → 内側）は 入口の ACL → 変換 → 経路探し → 出口の ACL で、変換のほうが先に来る</text>\n<text x=\"20\" y=\"1468\" font-size=\"10\" fill=\"#6b7280\">未検証: プールを使い切ったときの挙動（infraexpert の動的 NAT ページに記述なし）</text>\n<text x=\"20\" y=\"1484\" font-size=\"10\" fill=\"#6b7280\">出典（NAT と NAPT の定義）: RFC 3022 https://www.rfc-editor.org/rfc/rfc3022.html</text>\n<text x=\"20\" y=\"1500\" font-size=\"10\" fill=\"#6b7280\">出典（NAPT はポート番号も変換するので 1 つのグローバル IP を共用できる）: https://www.infraexpert.com/study/ip11.5.html</text>\n<text x=\"20\" y=\"1516\" font-size=\"10\" fill=\"#6b7280\">出典（内部ローカル・内部グローバル、ip nat inside / ip nat outside）: https://www.infraexpert.com/study/natz0.html</text>\n<text x=\"20\" y=\"1532\" font-size=\"10\" fill=\"#6b7280\">出典（動的 NAT の行は通信の開始ででき、終了で消える）: https://www.infraexpert.com/study/natz1.html</text>\n<text x=\"20\" y=\"1548\" font-size=\"10\" fill=\"#6b7280\">出典（外側ポート番号の選び方・ポート多重の禁止）: RFC 4787 4.2.1 / REQ-3 https://www.rfc-editor.org/rfc/rfc4787.html</text>\n<text x=\"20\" y=\"1564\" font-size=\"10\" fill=\"#6b7280\">出典（ルータの中の順序）: Cisco Understand the NAT Order of Operation</text>\n<text x=\"20\" y=\"1580\" font-size=\"10\" fill=\"#6b7280\">　https://www.cisco.com/c/en/us/support/docs/ip/network-address-translation-nat/6209-5.html</text>\n<text x=\"20\" y=\"1596\" font-size=\"10\" fill=\"#6b7280\">出典（ウェブの既定のポート番号が 80）: RFC 9110 4.2.1 https://www.rfc-editor.org/rfc/rfc9110.html</text>\n</svg>\n## 図 7・図 9 との接続","line":63,"sources":["src_1","src_2","src_3","src_4","src_5","src_6","src_7"],"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_a8fac9","type":"paragraph","markdown":"図 5 では「宛先 IP・送信元 IP は端から端まで変わらない」と書きました。\nNAT を通す区間では、この約束が崩れます。\n行きで送信元の側が、帰りで宛先の側が書き換わります。\nMAC の付け替えは図 5 のままで、変わるのは IP とポート番号の欄だけです。","text":"図 5 では「宛先 IP・送信元 IP は端から端まで変わらない」と書きました。\nNAT を通す区間では、この約束が崩れます。\n行きで送信元の側が、帰りで宛先の側が書き換わります。\nMAC の付け替えは図 5 のままで、変わるのは IP とポート番号の欄だけです。","line":292,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_311250","type":"paragraph","markdown":"図 7 の ③ で通信が止まったのは、宛先が社内専用の住所で、途中に一致する行が無かったからです。\n図 8 の ③ は宛先も送信元もグローバル IP なので運ばれます。\nただし解けたのは外向きの分だけです。\n支店とデータセンターの社内住所同士をつなぐ話は図 10 の GRE、中身が読める話は図 11 の IPsec が扱います。","text":"図 7 の ③ で通信が止まったのは、宛先が社内専用の住所で、途中に一致する行が無かったからです。\n図 8 の ③ は宛先も送信元もグローバル IP なので運ばれます。\nただし解けたのは外向きの分だけです。\n支店とデータセンターの社内住所同士をつなぐ話は図 10 の GRE、中身が読める話は図 11 の IPsec が扱います。","line":297,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_f25975","type":"paragraph","markdown":"次の図 9 では、ルータの口に「通す・通さない」の行の並びを付けます。\nルータの中で、その判定が経路探しや変換とどの順で来るかは、この図と同じ出典で確かめられます。","text":"次の図 9 では、ルータの口に「通す・通さない」の行の並びを付けます。\nルータの中で、その判定が経路探しや変換とどの順で来るかは、この図と同じ出典で確かめられます。","line":302,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_703626","type":"heading","depth":2,"markdown":"## 未検証・注意","text":"未検証・注意","line":305,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_85b39e","type":"list","markdown":"- 外側のポート番号はルータが選びます。内側と同じ番号をそのまま使おうとする実装もあります（RFC 4787 4.2.1）。ただし、ぶつかったときも同じ番号を使い続ける使い方（ポート多重）は禁止されています（同 REQ-3）。図では別の番号（50000 から 51001）で描いてあり、番号が変わり得ることを見せています。\n- 動的 NAT でプールを使い切ったときの挙動は未検証です。引用したページに記述がありません。\n- 静的 NAT について「ポート番号は使わない」とは書けません。ポート番号まで固定で結ぶ書き方があります。この図では扱っていません。\n- ルータの中の処理順序は、内側から外側が「入口の ACL → 経路探し → 変換 → 出口の ACL」、外側から内側が「入口の ACL → 変換 → 経路探し → 出口の ACL」です。帰りだけ変換が先に来ます。\n- 図の 192.0.2.50 と 203.0.113.x は、説明用に予約された番地です（図 7 から引き継ぎ）。","text":"外側のポート番号はルータが選びます。内側と同じ番号をそのまま使おうとする実装もあります（RFC 4787 4.2.1）。ただし、ぶつかったときも同じ番号を使い続ける使い方（ポート多重）は禁止されています（同 REQ-3）。図では別の番号（50000 から 51001）で描いてあり、番号が変わり得ることを見せています。動的 NAT でプールを使い切ったときの挙動は未検証です。引用したページに記述がありません。静的 NAT について「ポート番号は使わない」とは書けません。ポート番号まで固定で結ぶ書き方があります。この図では扱っていません。ルータの中の処理順序は、内側から外側が「入口の ACL → 経路探し → 変換 → 出口の ACL」、外側から内側が「入口の ACL → 変換 → 経路探し → 出口の ACL」です。帰りだけ変換が先に来ます。図の 192.0.2.50 と 203.0.113.x は、説明用に予約された番地です（図 7 から引き継ぎ）。","line":307,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_240080","type":"heading","depth":2,"markdown":"## 出典","text":"出典","line":313,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_670088","type":"list","markdown":"- 勉強会での本人の観察（2026-09-13 実機ハンズオン。資料は非公開）\n- [RFC 3022: Traditional IP Network Address Translator](https://www.rfc-editor.org/rfc/rfc3022.html) — Basic NAT は IP アドレスだけを変換し、NAPT は「内側の IP とポート番号」の組を「外側の IP と割り当てたポート番号」の組に対応づける。外向きは送信元のポート番号、内向きは宛先のポート番号を変換する\n- [RFC 4787: NAT Behavioral Requirements for Unicast UDP](https://www.rfc-editor.org/rfc/rfc4787.html) — 4.2.1 に内側と同じポート番号を使おうとする実装の説明。REQ-3「A NAT MUST NOT have a 'Port assignment' behavior of 'Port overloading'」\n- [RFC 9110: HTTP Semantics](https://www.rfc-editor.org/rfc/rfc9110.html) — 4.2.1。ポート番号が書かれていなければ TCP の 80 が既定\n- [Cisco: Understand the NAT Order of Operation](https://www.cisco.com/c/en/us/support/docs/ip/network-address-translation-nat/6209-5.html) — 内側から外側は入口の ACL・経路探し・変換・出口の ACL の順。外側から内側は変換が経路探しより先\n- [インフラエキスパート: NAPT](https://www.infraexpert.com/study/ip11.5.html) — ポート番号も変換することで 1 つのグローバル IP を複数の端末で共有できる\n- [インフラエキスパート: スタティック NAT](https://www.infraexpert.com/study/natz0.html) — 内部ローカルアドレスと内部グローバルアドレスの 1 対 1 の対応。`ip nat inside` / `ip nat outside` の指定\n- [インフラエキスパート: ダイナミック NAT](https://www.infraexpert.com/study/natz1.html) — アドレスプールから割り当てる。行は通信の開始のときにできる","text":"勉強会での本人の観察（2026-09-13 実機ハンズオン。資料は非公開）RFC 3022: Traditional IP Network Address Translator — Basic NAT は IP アドレスだけを変換し、NAPT は「内側の IP とポート番号」の組を「外側の IP と割り当てたポート番号」の組に対応づける。外向きは送信元のポート番号、内向きは宛先のポート番号を変換するRFC 4787: NAT Behavioral Requirements for Unicast UDP — 4.2.1 に内側と同じポート番号を使おうとする実装の説明。REQ-3「A NAT MUST NOT have a 'Port assignment' behavior of 'Port overloading'」RFC 9110: HTTP Semantics — 4.2.1。ポート番号が書かれていなければ TCP の 80 が既定Cisco: Understand the NAT Order of Operation — 内側から外側は入口の ACL・経路探し・変換・出口の ACL の順。外側から内側は変換が経路探しより先インフラエキスパート: NAPT — ポート番号も変換することで 1 つのグローバル IP を複数の端末で共有できるインフラエキスパート: スタティック NAT — 内部ローカルアドレスと内部グローバルアドレスの 1 対 1 の対応。ip nat inside / ip nat outside の指定インフラエキスパート: ダイナミック NAT — アドレスプールから割り当てる。行は通信の開始のときにできる","line":315,"sources":["src_1","src_2","src_3","src_4","src_5","src_6","src_7"],"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_1f7c1f","type":"heading","depth":2,"markdown":"## 関連","text":"関連","line":324,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}},{"id":"blk_bed0bf","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- 前の記事（図 7）: [ネットワーク\\_07\\_インターネットを挟む](/notes/nw-basics-07-internet)（`/notes/nw-basics-07-internet`）\n\n- 次の記事（図 9）: [ネットワーク\\_09\\_ACL](/notes/nw-basics-09-acl)（`/notes/nw-basics-09-acl`）\n\n- 同じ 3 つの問題を解く記事: [ネットワーク\\_10\\_GREトンネル](/notes/nw-basics-10-gre)（`/notes/nw-basics-10-gre`） ／ [ネットワーク\\_11\\_IPsec](/notes/nw-basics-11-ipsec)（`/notes/nw-basics-11-ipsec`）","text":"ネットワーク_INDEX — 連載の目次連載の入口: ネットワーク_00_3層で言葉を置く（/notes/nw-basics-00-three-layers）前の記事（図 7）: ネットワーク_07_インターネットを挟む（/notes/nw-basics-07-internet）次の記事（図 9）: ネットワーク_09_ACL（/notes/nw-basics-09-acl）同じ 3 つの問題を解く記事: ネットワーク_10_GREトンネル（/notes/nw-basics-10-gre） ／ ネットワーク_11_IPsec（/notes/nw-basics-11-ipsec）","line":326,"lineage":[],"authoredBy":{"kind":"human","id":"owner","label":"ぴぐお"}}],"sources":[{"id":"src_1","url":"https://www.rfc-editor.org/rfc/rfc3022.html","title":"RFC 3022: Traditional IP Network Address Translator","accessed":"2026-09-14","kind":"secondary"},{"id":"src_2","url":"https://www.rfc-editor.org/rfc/rfc4787.html","title":"RFC 4787: NAT Behavioral Requirements for Unicast UDP","accessed":"2026-09-14","kind":"secondary"},{"id":"src_3","url":"https://www.rfc-editor.org/rfc/rfc9110.html","title":"RFC 9110: HTTP Semantics","accessed":"2026-09-14","kind":"secondary"},{"id":"src_4","url":"https://www.cisco.com/c/en/us/support/docs/ip/network-address-translation-nat/6209-5.html","title":"Cisco: Understand the NAT Order of Operation","accessed":"2026-09-14","kind":"secondary"},{"id":"src_5","url":"https://www.infraexpert.com/study/ip11.5.html","title":"インフラエキスパート: NAPT","accessed":"2026-09-14","kind":"secondary"},{"id":"src_6","url":"https://www.infraexpert.com/study/natz0.html","title":"インフラエキスパート: スタティック NAT","accessed":"2026-09-14","kind":"secondary"},{"id":"src_7","url":"https://www.infraexpert.com/study/natz1.html","title":"インフラエキスパート: ダイナミック NAT","accessed":"2026-09-14","kind":"secondary"}],"errata":[]}