{"id":5844,"date":"2022-01-09T15:14:40","date_gmt":"2022-01-09T23:14:40","guid":{"rendered":"https:\/\/www.xh86.me\/?p=5844"},"modified":"2022-01-09T15:14:40","modified_gmt":"2022-01-09T23:14:40","slug":"routeros-v7%e9%85%8d%e7%bd%ae%e7%ad%96%e7%95%a5%e8%b7%af%e7%94%b1","status":"publish","type":"post","link":"https:\/\/www.xh86.me\/?p=5844","title":{"rendered":"Routeros V7\u914d\u7f6e\u7b56\u7565\u8def\u7531"},"content":{"rendered":"<p>\u5728\u4f7f\u7528Routeros V7 \u6d4b\u8bd5\u7248\u7684\u8fc7\u7a0b\u4e2d\u53d1\u73b0V7\u76f8\u6bd4\u4e8eV6\u7248\u5728\u8def\u7531\u914d\u7f6e\u65b9\u4fbf\u6709\u5f88\u5927\u53d8\u66f4\uff0c\u6240\u4ee5\u8fd9\u7bc7\u6587\u7ae0\u4f1a\u4ee5Routeros V7\u4e3a\u57fa\u7840\u4ecb\u7ecd\u7b56\u7565\u8def\u7531\u7684\u914d\u7f6e\u3002<\/p>\n<p>\u7f51\u7edc\u57fa\u672c\u60c5\u51b5<br \/>\nrouteros\u4f5c\u4e3a\u5bb6\u5ead\u552f\u4e00\u8def\u7531\uff0c\u901a\u8fc7pppoe\u63a5\u5165\u4e92\u8054\u7f51\uff0c\u901a\u8fc7wireguard\u8fde\u63a5\u9999\u6e2f\u7684routeros\u3002<\/p>\n<p>\u7b56\u7565\u8def\u7531\u76ee\u6807<br \/>\n1\uff0c\u9700\u8981\u7ffb\u5899\u7684\u5185\u7f51ip\uff1a\u76ee\u7684\u5730\u5740\u662f\u5883\u5185ip\u8d70pppoe\u9ed8\u8ba4\u8def\u7531\uff0c\u76ee\u7684\u5730\u5740\u662f\u5883\u5916IP\u8d70wireguard\u901a\u8fc7\u9999\u6e2frouteros\u8fdb\u5165\u5899\u5916\u4e92\u8054\u7f51<br \/>\n2\uff0c\u5176\u4ed6\u5185\u7f51ip\u5168\u90e8\u8d70pppoe\u9ed8\u8ba4\u8def\u7531<\/p>\n<p>IP\u5730\u5740\u5206\u914d\u53c2\u8003\u4e0a\u4e00\u7bc7\u6587\u7ae0Routeros \u914d\u7f6eWireGuard<\/p>\n<blockquote><p>\u672c\u5730lan\u7684\u5730\u5740\u662f192.168.1.1\/24,wg-access\u5730\u5740\u662f10.0.0.1\/24\uff0cwg-hk\u7684\u5730\u5740\u662f10.0.1.1\/30\uff0c\u624b\u673awireguard\u7684\u5730\u5740\u662f10.0.0.2\/32\uff0c\u7b14\u8bb0\u672c\u7535\u8111\u7684\u5730\u5740\u662f10.0.0.3\/32<br \/>\n\u9999\u6e2fwg0\u5730\u5740\u662f10.0.1.2\/30<\/p><\/blockquote>\n<p>\u914d\u7f6e\u6b65\u9aa4<br \/>\n1\uff0c\u4f7f\u7528ipip.net\u53d1\u5e03\u5728github\u7684\u5927\u9646ip\u5217\u8868\u751f\u6210\u5883\u5185IP\u5730\u5740\u5217\u8868\uff0c\u5e76\u5bfc\u5165routeros<br \/>\n\u5728mac\u6216\u8005linux\u7cfb\u7edf\u4e0a\u6267\u884c\u4e0b\u5217\u547d\u4ee4<\/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>\u628acnip.rsc\u4e0a\u4f20\u5230routeros\uff0c\u6267\u884c<\/p>\n<pre><code>\/import cnip.rsc\r\n<\/code><\/pre>\n<p>2\uff0c\u914d\u7f6e\u5206\u6d41\u8def\u7531\u8868<br \/>\n<del>Routeros V7\u53d6\u6d88\u4e86\u901a\u8fc7firewall\u7684mangle\u91cc\u6dfb\u52a0\u8def\u7531\u6807\u8bb0\u81ea\u52a8\u6dfb\u52a0\u8def\u7531\u8868\u529f\u80fd\uff0c\u6240\u6709\u8fd9\u91cc\u9700\u8981\u624b\u52a8\u6dfb\u52a0\u8def\u7531\u8868<\/del>\uff0cv7.1beta3\u5df2\u6062\u590d\u6b64\u529f\u80fd<\/p>\n<pre><code>\/routing\/table\/add name=\"gfw\" fib\r\n<\/code><\/pre>\n<p>\u6dfb\u52a0IP\u5206\u6d41\u7b56\u7565\u8def\u7531<\/p>\n<pre><code>\/ip\/route\/add dst-address=0.0.0.0\/0 routing-table=\"gfw\" gateway=10.0.1.2\r\n<\/code><\/pre>\n<p>3\uff0c\u65b0\u5efa\u9700\u8981\u7ffb\u5899\u7684\u5185\u7f51\u5730\u5740\u5217\u8868\uff0c\u5047\u5b9a192.168.1.100\u548c192.168.1.200\u9700\u8981\u7ffb\u5899<\/p>\n<pre><code>\/ip\/firewall\/address-list\/add list=gfw address=192.168.1.100\/32\r\n\/ip\/firewall\/address-list\/add list=gfw address=192.168.1.200\/32\r\n<\/code><\/pre>\n<p>4\uff0c\u7ed9\u9700\u8981\u7ffb\u5899\u7684\u5185\u7f51ip\u6dfb\u52a0\u6807\u8bb0<\/p>\n<pre><code>\/ip\/firewall\/mangle\/add chain=prerouting action=mark-routing new-routing-mark=gfw passthrough=yes dst-address-type=!local src-address-list=gfw dst-address-list=!CNIP log=no log-prefix=\"\"\r\n<\/code><\/pre>\n<p>5\uff0c\u914d\u7f6e\u65e0\u6c61\u67d3DNS\u670d\u52a1\u5668<br \/>\n\u53c2\u8003\u4f7f\u7528dnsmasq\u57fa\u4e8e\u5927\u9646\u57df\u540d\u767d\u540d\u5355\u5206\u6d41\u89e3\u6790\u57df\u540d\u548c\u4f7f\u7528overture\u66ff\u6362dnsmasq\u505a\u57df\u540d\u5206\u6d41\u89e3\u6790<\/p>\n<p>6\uff0c\u6d4b\u8bd5\u76ee\u7684IP\u5206\u6d41<br \/>\n\u5728192.168.1.100\u4e0a\u6267\u884ctraceroute\u547d\u4ee4<\/p>\n<pre><code>traceroute 8.8.4.4\r\n192.168.1.100---&gt;192.168.1.1---&gt;10.0.1.2---&gt;\u9999\u6e2f\u670d\u52a1\u5668\u516c\u7f51\u8def\u7531---&gt;8.8.4.4\r\ntraceroute 114.114.114.114\r\n192.168.1.100---&gt;192.168.1.1---&gt;PPPoE\u516c\u7f51\u8def\u7531----&gt;114.114.114.114<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4f7f\u7528Routeros V7 \u6d4b\u8bd5\u7248\u7684\u8fc7\u7a0b\u4e2d\u53d1\u73b0V7\u76f8\u6bd4\u4e8eV6\u7248\u5728\u8def\u7531\u914d\u7f6e\u65b9\u4fbf\u6709\u5f88\u5927\u53d8\u66f4\uff0c\u6240\u4ee5\u8fd9\u7bc7\u6587\u7ae0\u4f1a\u4ee5Ro [&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-5844","post","type-post","status-publish","format-standard","hentry","category-mikrotik"],"_links":{"self":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/5844","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=5844"}],"version-history":[{"count":1,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/5844\/revisions"}],"predecessor-version":[{"id":5845,"href":"https:\/\/www.xh86.me\/index.php?rest_route=\/wp\/v2\/posts\/5844\/revisions\/5845"}],"wp:attachment":[{"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xh86.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}