{"id":156083,"date":"2020-09-13T16:33:52","date_gmt":"2020-09-13T08:33:52","guid":{"rendered":"http:\/\/4563.org\/?p=156083"},"modified":"2020-09-13T16:33:52","modified_gmt":"2020-09-13T08:33:52","slug":"%e7%94%a8%e5%8a%a8%e6%80%81%e8%b7%af%e7%94%b1%e6%89%93%e9%80%9a%e5%90%84-virtual-l2%ef%bc%88zerotier%ef%bc%89%e7%bd%91%e7%bb%9c","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=156083","title":{"rendered":"\u7528\u52a8\u6001\u8def\u7531\u6253\u901a\u5404 Virtual L2\uff08Zerotier\uff09\u7f51\u7edc"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u7528\u52a8\u6001\u8def\u7531\u6253\u901a\u5404 Virtual L2\uff08Zerotier\uff09\u7f51\u7edc               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hiplon <\/span>  <span><i><\/i> 5<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u672c\u6587\u4e3b\u8981\u4ee5 Zerotier \u7ec4\u597d\u7684\u5404 Virtual L2 \u7f51\u7edc\u8282\u70b9 + \u52a8\u6001\u8def\u7531 RIP \u4e3a\u4f8b\uff0c\u6700\u7ec8\u6548\u679c\u5c31\u662f\u8ba9\u7f51\u5173\u5efa\u7acb Zerotier \u7684 Virtual L2 \u7f51\u7edc\uff0c\u7f51\u5173\u4e0b\u7684\u5176\u5b83\u7f51\u6bb5\u5c31\u80fd\u76f8\u4e92\u901a\u4fe1\u3002<\/p>\n<p>\u62d3\u6251\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/09\/20200917_5f6392a75327a.png\" alt=\"\u7528\u52a8\u6001\u8def\u7531\u6253\u901a\u5404 Virtual L2\uff08Zerotier\uff09\u7f51\u7edc\" \/><\/p>\n<p>\u4f8b\u5982\u5982\u4e0a\u62d3\u6251\uff0cZerotier \u5efa\u7acb\u4e86 192.168.193.0\/24 \u7684\u4e92\u8054\u865a\u62df\u4e8c\u5c42\uff0c\u6709 192.168.193.6 \u3001192.168.193.11 \u3001192.168.193.21 \u7684\u7f51\u5173\u4e0b\u9762\u6709 172.16.0.0\/23 \u3001192.168.2.0\/24 \u3001192.168.11.0\/24 \u4e09\u4e2a\u7f51\u6bb5\uff0c\u90a3\u4e48\u901a\u8fc7\u5efa\u7acb rip \u52a8\u6001\u8def\u7531\uff0c\u8ba9\u8fd9\u4e09\u4e2a\u7f51\u6bb5\u53ef\u4ee5\u4e92\u901a\u3002<\/p>\n<p>\u7f51\u5173\u8bbe\u5907\u9ed8\u8ba4\u662f OpenWRT \u8bbe\u5907\uff0c\u524d\u63d0\u662f\u5df2\u7ecf\u901a\u8fc7\u4f8b\u5982 VPN\/Tinc\/Zerotier \u7b49\u65b9\u6cd5\u5efa\u7acb\u4e86\u4e92\u8054\u6bb5\u3002<\/p>\n<p>\u5982\u679c\u8fd8\u6ca1\u5efa\u7acb\u7684\u8bdd\u53ef\u4ee5\u53c2\u8003\uff1a \/t\/649829<\/p>\n<p>https:\/\/vnf.cc\/2019\/12\/zerotier-sd-lan\/<\/p>\n<p>\u5148\u5efa\u597d\u4e92\u8054\u7684\u6bb5\uff0c<\/p>\n<p>\u4e0b\u9762\u5f00\u59cb\u505a\u52a8\u6001\u8def\u7531\u7684\u914d\u7f6e<\/p>\n<p>\u5148\u5b89\u88c5 quagga-zebra \u548c quagga-ripd \u7ec4\u4ef6\uff1a<\/p>\n<pre><code># opkg install quagga-zebra quagga-ripd <\/code><\/pre>\n<p>\u5982\u679c\u60f3\u8981\u6709\u64cd\u4f5c\u7ec8\u7aef\u754c\u9762\u53ef\u4ee5\u5b89\u88c5<code>quagga-vtysh<\/code><\/p>\n<p>\u5206\u522b\u7f16\u8f91 rip \u8def\u7531 <code>\/etc\/quagga\/ripd.conf<\/code><\/p>\n<p><code>192.168.193.6 \u3001172.16.0.0\/23<\/code><\/p>\n<pre><code>password zebra ! router rip  network 192.168.193.0\/24  route 172.16.0.0\/23 ! access-list vty permit 127.0.0.0\/8 access-list vty deny any ! line vty  access-class vty <\/code><\/pre>\n<p><code>192.168.193.11 \u3001192.168.2.0\/24<\/code><\/p>\n<pre><code>password zebra ! router rip  network 192.168.193.0\/24  route 192.168.2.0\/24 ! access-list vty permit 127.0.0.0\/8 access-list vty deny any ! line vty  access-class vty <\/code><\/pre>\n<p><code>192.168.193.21 \u3001192.168.11.0\/24<\/code><\/p>\n<pre><code>password zebra ! router rip  network 192.168.193.0\/24  route 192.168.11.0\/24 ! access-list vty permit 127.0.0.0\/8 access-list vty deny any ! line vty  access-class vty <\/code><\/pre>\n<p>\u7136\u540e\u91cd\u542f quagga \u8fdb\u7a0b <code>\/etc\/init.d\/quagga restart<\/code><\/p>\n<p>\u5728\u6709\u88c5 vtysh \u7684\u8bbe\u5907\u53ef\u4ee5\u8fdb\u7ec8\u7aef\u770b\u770b rip \u72b6\u6001<\/p>\n<pre><code># vtysh  Hello, this is Quagga (version 1.1.1). Copyright 1996-2005 Kunihiro Ishiguro, et al.  nRouter# show ip rip status Routing Protocol is \"rip\"   Sending updates every 30 seconds with +\/-50%, next due in 28 seconds   Timeout after 180 seconds, garbage collect after 120 seconds   Outgoing update filter list for all interface is not set   Incoming update filter list for all interface is not set   Default redistribution metric is 1   Redistributing:   Default version control: send version 2, receive any version     Interface        Send  Recv   Key-chain     ztuku6smag       2     1 2   Routing for Networks:     192.168.193.0\/24   Routing Information Sources:     Gateway          BadPackets BadRoutes  Distance Last Update     192.168.193.21           0         0       120   00:00:19     192.168.193.11           0         0       120   00:00:07     192.168.193.14           0         0       120   00:00:10   Distance: (default is 120) nRouter#  <\/code><\/pre>\n<p>\u5728\u5176\u5b83\u8bbe\u5907\u53ef\u4ee5\u770b\u770b\u8def\u7531<\/p>\n<pre><code># ip route | grep zebra 172.16.0.0\/23 via 192.168.193.6 dev ztuku6smag proto zebra metric 20 192.168.11.0\/24 via 192.168.193.21 dev ztuku6smag proto zebra metric 20 192.168.12.0\/24 via 192.168.193.14 dev ztuku6smag proto zebra metric 20  <\/code><\/pre>\n<p>\u8fd9\u6837\u5b50\u8fd9\u4e09\u4e2a\u7f51\u6bb5\u5c31\u80fd\u591f\u4e92\u901a\u4e86\uff0c<\/p>\n<p>\u6bd4\u5982\u4ece 172.16.1.99 \u53ef\u4ee5\u901a 192.168.11.8<\/p>\n<pre><code>[email&#160;protected]:\/etc\/apt# ip addr | grep inet     inet 127.0.0.1\/8 scope host lo     inet6 ::1\/128 scope host      inet 172.16.1.99\/23 brd 172.16.1.255 scope global eth0     inet6 fe80::38a9:fcff:fe1d:b7f6\/64 scope link  [email&#160;protected]:\/etc\/apt# ping 192.168.11.8 PING 192.168.11.8 (192.168.11.8) 56(84) bytes of data. 64 bytes from 192.168.11.8: icmp_seq=1 ttl=62 time=19.0 ms 64 bytes from 192.168.11.8: icmp_seq=2 ttl=62 time=14.6 ms 64 bytes from 192.168.11.8: icmp_seq=3 ttl=62 time=15.0 ms 64 bytes from 192.168.11.8: icmp_seq=4 ttl=62 time=16.1 ms 64 bytes from 192.168.11.8: icmp_seq=5 ttl=62 time=16.9 ms ^C --- 192.168.11.8 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 4004ms rtt min\/avg\/max\/mdev = 14.592\/16.344\/19.022\/1.572 ms [email&#160;protected]:\/etc\/apt#  <\/code><\/pre>\n<p>refer: https:\/\/vnf.cc\/2020\/09\/zerotier-l3-rip\/<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>10<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3313867\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : burndown <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8d5e\uff0c\u9759\u6001\u8def\u7531\u662f\u4e0d\u662f\u4e5f\u53ef\u4ee5\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3313868\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : hiplon <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @burndown \u9759\u6001\u8def\u7531\u4e5f\u53ef\u4ee5\u7684\uff0c\u4e0d\u8fc7\u8282\u70b9\u4e00\u591a\u8981\u4eba\u5de5\u7ef4\u62a4\u8d77\u6765\u5c31\u5f88\u9ebb\u70e6\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3313869\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mason961125 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             quagga \u592a\u8001\u4e86\uff0c\u57fa\u672c\u5904\u4e8e\u4e0d\u7ef4\u62a4\u72b6\u6001\u4e86\uff0c\u5efa\u8bae\u6362 frrouting \u3002<br \/>IGP \u8fd8\u53ef\u4ee5\u9009\u62e9 OSPF \u7b49\u522b\u7684\u534f\u8bae\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3313870\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hello365 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             zerotier \u4e0d\u662f\u652f\u6301\u9875\u9762\u914d\u7f6e\u7684\u561b\uff0c\u66f4\u65b9\u4fbf\u4e00\u4e9b\uff0cquagga \u6216\u662f frrouting \u662f\u53ea\u914d\u7f6e\u4e00\u53f0\u673a\u5668\u7684\u5c31\u80fd\u8fdc\u7a0b\u5168\u90e8\u66f4\u65b0\u6240\u6709\u8282\u70b9\u8def\u7531\u8868\u7684\u8f6f\u4ef6\uff1f\u6700\u8fd1\u4e00\u76f4\u5728\u597d\u5947\u662f\u4e0d\u662f\u6709\u8fd9\u79cd\u8f6f\u4ef6\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3313871\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : vbcity <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             OSPF \u641e\u5b9a\u4e00\u5207\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3313872\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : hiplon <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @vbcity \u6709\u4e9b\u96a7\u9053\u534f\u8bae\u4f1a\u8fc7\u6ee4 OSPF \u8fd9\u79cd IP RAW \u7684\u62a5\u6587                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3313873\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : hiplon <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @hello365 \u8fd9\u79cd\u90fd\u662f\u52a8\u6001\u8def\u7531\uff0c\u6bcf\u4e2a\u8282\u70b9\u90fd\u8981\u914d\u7f6e\uff0c\u56e0\u4e3a\u8fd9\u79cd\u65b9\u6cd5\u6bd4\u8f83\u901a\u7528\uff0c\u7528 VPN \u6216\u8005\u5176\u5b83\u96a7\u9053\u7ec4\u4e92\u8054\u7f51\u6bb5\u90fd\u80fd\u901a\u7528                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3313874\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : hiplon <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @mason961125 \u597d\u50cf openwrt \u8fd8\u6ca1\u6709 frr \u7684\u4e8c\u8fdb\u5236-_-k, \u4e0d\u8fc7\u53ef\u4ee5\u7528 bird1cl-ipv4 \u66ff\u6362 quagga, \u4e0d\u8fc7\u5d4c\u5165\u5f0f\u8bbe\u5907\u8dd1\u4e2a\u8def\u7531\u534f\u8bae\u54ea\u4e2a\u8d44\u6e90\u5360\u7528\u5c11\u5c31\u7528\u54ea\u4e2a\u4e86^^                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3313875\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hello365 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @hiplon \u55ef\uff0c\u53c8 get \u5230\u65b0\u7684\u4e1c\u897f\uff0c\u56de\u5934\u5b66\u4e60\u4e00\u4e0b\uff0c\u611f\u8c22\u5206\u4eab\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3313876\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : samondlee <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5199\u7684\u5f88\u8be6\u7ec6\uff0c\u4f46\u662f\u8fd8\u662f\u770b\u4e0d\u61c2\u54ed\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u7528\u52a8\u6001\u8def\u7531\u6253\u901a\u5404 Virtual &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/156083"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=156083"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/156083\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=156083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=156083"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=156083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}