{"id":5840,"date":"2022-01-09T15:12:35","date_gmt":"2022-01-09T23:12:35","guid":{"rendered":"https:\/\/www.xh86.me\/?p=5840"},"modified":"2022-01-09T15:12:35","modified_gmt":"2022-01-09T23:12:35","slug":"routeros%e9%85%8d%e7%bd%aevpn%e5%88%86%e6%b5%81%e5%a4%a7%e9%99%86ip","status":"publish","type":"post","link":"https:\/\/www.xh86.me\/?p=5840","title":{"rendered":"Routeros\u914d\u7f6evpn\u5206\u6d41\u5927\u9646ip"},"content":{"rendered":"<p>ros\u4f7f\u7528pppoe\u8fde\u7f51\uff0cros\u4e0a\u914d\u7f6evpn\u8fde\u63a5\u9999\u6e2f\u670d\u52a1\u5668\u4e0a\u7684ros\u3002\u76ee\u6807\uff1a\u5185\u7f51\u9700\u8981\u7ffb\u5899\u7684ip\u901a\u8fc7\u5927\u9646ip\u5217\u8868\u5206\u6d41\uff0c\u5927\u9646ip\u8d70\u9ed8\u8ba4\u8def\u7531\uff0c\u5883\u5916ip\u8d70vpn\u3002\u5176\u4ed6\u5185\u7f51ip\u5168\u90e8\u8d70\u9ed8\u8ba4\u8def\u7531\u3002<br \/>\n\u9996\u5148\u4e0b\u8f7d\u5927\u9646ip\u5217\u8868\uff0c\u63a8\u8350\u65b9\u6cd52<br \/>\n\u65b9\u6cd51:<\/p>\n<pre><code>curl 'http:\/\/ftp.apnic.net\/apnic\/stats\/apnic\/delegated-apnic-latest' | grep ipv4 | grep CN | awk -F\\| '{ printf(\"%s\/%d\\n\", $4, 32-log($5)\/log(2)) }' &gt; chnroute.txt\r\n<\/code><\/pre>\n<p>\u751f\u6210\u7684txt\u6587\u4ef6\u4f7f\u7528sublime\u7684\u591a\u884c\u7f16\u8f91\u529f\u80fd\u6216\u5176\u4ed6\u65b9\u5f0f\u8f6c\u6362\u6210ros\u7684cn-ip.rsc\u811a\u672c\u683c\u5f0f\u3002<\/p>\n<pre><code>\/ip firewall address-list\r\nadd list=cn-ip address=1.0.1.0\/24\r\nadd list=cn-ip address=1.0.2.0\/23<\/code><\/pre>\n<p>\u65b9\u6cd52:\u4f7f\u7528<a href=\"https:\/\/github.com\/17mon\/china_ip_list\">ipip.net\u53d1\u5e03\u5728github\u7684\u5927\u9646ip\u5217\u8868<\/a>\u751f\u6210<\/p>\n<pre><code>curl -s https:\/\/raw.githubusercontent.com\/17mon\/china_ip_list\/master\/china_ip_list.txt |sed -e 's\/^\/add address=\/g' -e 's\/$\/ list=CNIP\/g'|sed -e $'1i\\\\\\n\/ip firewall address-list' -e $'1i\\\\\\nremove [\/ip firewall address-list find list=CNIP]' -e $'1i\\\\\\nadd address=10.0.0.0\/8 list=CNIP comment=private-network' -e $'1i\\\\\\nadd address=172.16.0.0\/12 list=CNIP comment=private-network' -e $'1i\\\\\\nadd address=192.168.0.0\/16 list=CNIP comment=private-network'&gt;cnip.rsc\r\n<\/code><\/pre>\n<p>\u4ee5\u4e0a\u811a\u672c\u5728CNIP\u5217\u8868\u91cc\u6dfb\u52a0\u4e86\u79c1\u6709ip\u5730\u5740192.168.0.0\/16\uff0c172.16.0.0\/12\u548c10.0.0.0\/8<\/p>\n<p>\u65b9\u6cd53:\u4e0b\u8f7d\u522b\u4eba\u5236\u4f5c\u597d\u7684\u811a\u672c<br \/>\n<a href=\"http:\/\/www.iwik.org\/ipcountry\/mikrotik\/CN\">http:\/\/www.iwik.org\/ipcountry\/mikrotik\/CN<\/a><\/p>\n<p>\u4f7f\u7528import cnip.rsc\u5bfc\u5165ros\u3002\u6dfb\u52a0\u5185\u7f51\u9700\u8981\u7ffb\u5899\u7684ip\u5217\u8868\u3002<br \/>\n\u914d\u7f6eip firewall\u7684mangle<br \/>\nprerouting,source address list,destination address list\u53d6\u53cd\uff0cdestination address type,address type local,invert,mark routing,cross-gfw\u3002<br \/>\n\u914d\u7f6eip routes\u7684\u7f51\u5173<br \/>\n0.0.0.0\/0\uff0cgateway\u8bbe\u7f6e\u4e3avpn\u5bf9\u7aef\u5730\u5740\uff0crouting mark \u4f7f\u7528\u4e0a\u9762\u7684cross-gfw\u3002<\/p>\n<p>\u73b0\u5728\u89e3\u51b3dns\u95ee\u9898\uff0c\u7531\u4e8eros\u7684dns\u529f\u80fd\u6bd4\u8f83\u5f31\uff0c\u8fd9\u91cc\u4f7f\u7528dnsmasq<br \/>\n\u5185\u7f51\u4e00\u53f0linux\u7cfb\u7edf\uff0c\u53ef\u4ee5\u662f\u865a\u62df\u673a\uff0c\u53ef\u4ee5\u662f\u5bb9\u5668\uff0c\u5b89\u88c5dnsmasq\u3002\u914d\u7f6ednsmasq\u7684\u6e90dns\u4e3agoogle dns\uff0c\u7136\u540e\u4f7f\u7528github\u4e0a\u7684\u5927\u9646\u7f51\u5740\u767d\u540d\u5355\u751f\u6210\u811a\u672c\u6dfb\u52a0\u9700\u8981\u4f7f\u7528\u5927\u9646\u89e3\u6790\u7684\u57df\u540d\u3002<a href=\"https:\/\/github.com\/felixonmars\/dnsmasq-china-list\">https:\/\/github.com\/felixonmars\/dnsmasq-china-list<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ros\u4f7f\u7528pppoe\u8fde\u7f51\uff0cros\u4e0a\u914d\u7f6evpn\u8fde\u63a5\u9999\u6e2f\u670d\u52a1\u5668\u4e0a\u7684ros\u3002\u76ee\u6807\uff1a\u5185\u7f51\u9700\u8981\u7ffb\u5899\u7684ip\u901a\u8fc7\u5927\u9646ip\u5217\u8868 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-5840","post","type-post","status-publish","format-standard","hentry","category-mikrotik"],"_links":{"self":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/5840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5840"}],"version-history":[{"count":1,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/5840\/revisions"}],"predecessor-version":[{"id":5841,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/5840\/revisions\/5841"}],"wp:attachment":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}