{"id":411,"date":"2026-03-15T21:11:27","date_gmt":"2026-03-15T13:11:27","guid":{"rendered":"https:\/\/0x0.pub\/?p=411"},"modified":"2026-03-15T21:11:27","modified_gmt":"2026-03-15T13:11:27","slug":"gre-over-ipsec%e9%85%8d%e7%bd%ae%e5%ae%9e%e9%aa%8c","status":"publish","type":"post","link":"https:\/\/0x0.pub\/?p=411","title":{"rendered":"GRE over IPSEC\u914d\u7f6e\u5b9e\u9a8c"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>GRE over IPSEC\u4f01\u4e1a\u5f02\u5730\u7ec4\u7f51\u642d\u914dOSPF\u65b9\u6848<\/p>\n\n\n\n<p class=\"has-small-font-size\"><strong>\u7b80\u5316\u7684\u62d3\u6251\u7ed3\u6784<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"551\" height=\"385\" src=\"https:\/\/0x0.pub\/wp-content\/uploads\/2026\/03\/image.png\" alt=\"\" class=\"wp-image-414\" style=\"width:540px;height:auto\" srcset=\"https:\/\/0x0.pub\/wp-content\/uploads\/2026\/03\/image.png 551w, https:\/\/0x0.pub\/wp-content\/uploads\/2026\/03\/image-300x210.png 300w\" sizes=\"auto, (max-width: 551px) 100vw, 551px\" \/><\/figure>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">1. \u914d\u7f6e\u94fe\u8def\u57fa\u7840\u4e92\u8054\u3002PC1\/PC2\u914d\u7f6e\u9759\u6001IP\uff0c\u7f51\u5173\u6307\u5411R1\/R3\u7684g0\/0\/2\u63a5\u53e3IP\u3002<\/pre>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>#R1\nsysname R1\nint g0\/0\/0\n ip addr 12.0.0.1 24\nint g0\/0\/2\n ip addr 192.168.1.254 24\nip route-static 23.0.0.0 24 12.0.0.2\n\n#R2\nint g0\/0\/0\n ip addr 12.0.0.2 24\nint g0\/0\/1\n ip addr 23.0.0.2 24\n\n#R3\nint g0\/0\/1\n ip addr 23.0.0.3 24\nint g0\/0\/2\n ip addr 192.168.2.254 24\nip route-static 12.0.0.0 24 23.0.0.2<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">2. \u914d\u7f6eR1-R3\u7684GRE\u96a7\u9053<\/pre>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>#R1\nint tun0\/0\/0\n ip addr 192.168.13.1 24\n tunnel-protocol gre\n source 12.0.0.1\n destination 23.0.0.3\n\n#R3\ninterface Tunnel0\/0\/0\n ip addr 192.168.13.3 24\n tunnel-protocol gre\n source 23.0.0.3\n destination 12.0.0.1<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">3. \u914d\u7f6eIPSec\u76f8\u5173<\/pre>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>#R1\n#\u914d\u7f6eIPSec\u5b89\u5168\u63d0\u8bae\nipsec proposal p1\n encapsulation-mode transport\n esp authentication-algorithm sha2-512\n esp encryption-algorithm aes-256\n\n#\u914d\u7f6eIKE\u63d0\u8bae\nike proposal 1\n encryption-algorithm aes-cbc-256\n dh group14\n authentication-algorithm aes-xcbc-mac-96\n\n#\u914d\u7f6eIKE\u5bf9\u7b49\u4f53\uff0c\u8c03\u7528IKE\u63d0\u8bae1\nike peer R3 v2\n pre-shared-key cipher huawei\n ike-proposal 1\n\n#\u914d\u7f6eIPSec\u914d\u7f6e\u6a21\u677f\uff0c\u8c03\u7528\u4e0a\u9762\u7684IKE\u5bf9\u7b49\u4f53\u548cIPSec\u5b89\u5168\u63d0\u8bae\nipsec profile s1\n ike-peer R3\n proposal p1\n\n#\u63a5\u53e3\u8c03\u7528IPSec\u7684\u914d\u7f6e\u6a21\u677f\nint tun0\/0\/0\nipsec profile s1\n\n#R3,\u914d\u7f6e\u76f8\u540c\uff0c\u5bf9\u7b49\u4f53\u540d\u79f0\u4e3a\u4e86\u533a\u522b\u4f7f\u7528R1<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">4. \u914d\u7f6eOSPF\u5e76\u53d1\u5e03\u5185\u7f51\u548c\u865a\u62df\u96a7\u9053\u7f51\u6bb5<\/pre>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>#R1\nospf 1 router-id 1.1.1.1\n area 0.0.0.0\n  network 192.168.1.0 0.0.0.255\n  network 192.168.13.1 0.0.0.0\n\n#R3\nospf 1 router-id 3.3.3.3\n area 0.0.0.0\n  network 192.168.2.0 0.0.0.255\n  network 192.168.13.3 0.0.0.0<\/code><\/pre>\n\n\n\n<p>\u6d4b\u8bd5\u7ed3\u679c\u6b63\u5e38<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"989\" height=\"912\" src=\"https:\/\/0x0.pub\/wp-content\/uploads\/2026\/03\/image-1.png\" alt=\"\" class=\"wp-image-415\" srcset=\"https:\/\/0x0.pub\/wp-content\/uploads\/2026\/03\/image-1.png 989w, https:\/\/0x0.pub\/wp-content\/uploads\/2026\/03\/image-1-300x277.png 300w, https:\/\/0x0.pub\/wp-content\/uploads\/2026\/03\/image-1-768x708.png 768w\" sizes=\"auto, (max-width: 989px) 100vw, 989px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>GRE over IPSEC\u4f01\u4e1a\u5f02\u5730\u7ec4\u7f51\u642d\u914dOSPF\u65b9\u6848 \u7b80\u5316\u7684\u62d3\u6251\u7ed3\u6784 1. \u914d\u7f6e\u94fe\u8def\u57fa\u7840\u4e92\u8054\u3002PC1\/PC [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[64,63],"class_list":["post-411","post","type-post","status-publish","format-standard","hentry","category-ensp","tag-gre-ospf","tag-gre-over-ipsec"],"_links":{"self":[{"href":"https:\/\/0x0.pub\/index.php?rest_route=\/wp\/v2\/posts\/411","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/0x0.pub\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/0x0.pub\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/0x0.pub\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/0x0.pub\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=411"}],"version-history":[{"count":2,"href":"https:\/\/0x0.pub\/index.php?rest_route=\/wp\/v2\/posts\/411\/revisions"}],"predecessor-version":[{"id":416,"href":"https:\/\/0x0.pub\/index.php?rest_route=\/wp\/v2\/posts\/411\/revisions\/416"}],"wp:attachment":[{"href":"https:\/\/0x0.pub\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=411"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/0x0.pub\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=411"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/0x0.pub\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=411"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}