作者: 张无忌 時間: 2024-11-27 18:30 標題: Mainland China VPN Hong Kong via MikroTik and WireGuard
本帖最後由 张无忌 於 2024-12-28 09:52 編輯
RouterOS machine IP address = 192.168.88.0/24. After installation please remember to carry out "syetem reboot". All ethernets and (wireless lans) of router are ported Hong Kong network (HK-Gateway).
Cautions:
1. Line 73 (in the following script) abc.xyz.org should be modified to a right one.
2. Lines 47-49, the firewall filter code should be placed before the drop line.
3. Hong Kong MikroTik router listen-port=22555.
4. Mainland China MikroTik router listen-port=13231.
5. If 192.168.88.0/24 is changed to other value, please check line 90.
6. If the router does not start correctly, you have to wait for few minutes.
7. Line 77, "persistent-keepalive=25" may be removed to keep traffic clean.
#
- ########################################
- # Step One: Wireguard Tunnel Setup
- ########################################
- # On HK MikroTik
- # Set up wireguard interface. This will also generate private/public keypair.
- #/interface wireguard
- #add listen-port=22555 mtu=1420 name=wg-china comment="WG China"
- #/interface wireguard print
- #0 R ;;; WG China
- # name="wg-china" mtu=1420 listen-port=22555
- # private-key="iBrbTYwkIK30+lDHMXlDWu9n3KUeA1XFJx+BjsbEHnA="
- # public-key="mE1t7D3LBfeJ8SkvVRyRsEuZhTo4gl59cgKFstYm92E="
- /interface wireguard
- add listen-port=22555 mtu=1420 name=wg-china private-key=\
- "iBrbTYwkIK30+lDHMXlDWu9n3KUeA1XFJx+BjsbEHnA=" \
- comment="WG China"
- ############################################################
- # On China MikroTik
- # Set up Wireguard interface. This will also generate private/public keypair.
- #/interface wireguard
- #add listen-port=13231 mtu=1420 name=wg-hk
- #/interface wireguard print
- #0 R name="wg-hk" mtu=1420 listen-port=13231
- # private-key="MADwYW6QTh77/z0fXN6kRdQIA+J7Q4dZURWHeoyi1GM="
- # public-key="+l7EoWoM3JIIRw2cKWZMPc/IdI4Qjrjt1YScZJ0ObmM="
- /interface wireguard
- add listen-port=13231 mtu=1420 name=wg-hk private-key=\
- "MADwYW6QTh77/z0fXN6kRdQIA+J7Q4dZURWHeoyi1GM=" \
- comment="WG HK"
- ######################################################
- ######################################################
- # On HK MikroTik
- /ip address
- add address=10.1.200.1/24 comment="WG China" interface=wg-china \
- network=10.1.200.0
- # The firewall filter must be placed before the drop line
- /ip firewall filter
- add action=accept chain=input comment="WG China" dst-port=22555 \
- in-interface=ether1 protocol=udp
- # Set up China peer.
- /interface wireguard peers
- add name=china allowed-address=10.1.200.2/32 comment="WG China" \
- interface=wg-china public-key=\
- "+l7EoWoM3JIIRw2cKWZMPc/IdI4Qjrjt1YScZJ0ObmM=" \
- preshared-key="qAnHo8uMf5CrgqFP0XzyFHsG1EZW8+BWG8I3GW/rPUQ="
- #######################################################
- # On China MikroTik
- # Assign address to the router on the new interface.
- /ip address
- add address=10.1.200.2/32 comment="Wireguard" interface=wg-hk \
- network=10.1.200.0
- #/ip firewall filter
- #add action=accept chain=input comment="Wireguard" dst-port=13231 \
- # protocol=udp
- # Set up HK peer
- /interface wireguard peers
- add name=hk allowed-address=0.0.0.0/0 comment="hk" \
- endpoint-address=abc.xyz.org endpoint-port=22555 \
- interface=wg-hk public-key=\
- "mE1t7D3LBfeJ8SkvVRyRsEuZhTo4gl59cgKFstYm92E=" \
- preshared-key="qAnHo8uMf5CrgqFP0XzyFHsG1EZW8+BWG8I3GW/rPUQ=" \
- persistent-keepalive=25
- ##########################################################
- # Step Two: Routing the Traffic
- ##########################################################
- # On China MikroTik
- /routing table
- add comment="For use by local clients" disabled=no fib name=wg-vpn
- /routing rule
- add action=lookup-only-in-table \
- comment="Local clients should use (only) Wireguard routing table" \
- disabled=no interface=bridge src-address=192.168.88.0/24 table=wg-vpn
- /ip route
- add dst-address=0.0.0.0/0 gateway=wg-hk routing-table=wg-vpn
- /ip firewall nat \
- add chain=srcnat out-interface=wg-hk action=masquerade
- ### Open MSDOS window input "curl http://myip.dnsomatic.com" to display HK IP address ###
- #############################################
- # Step Three: DNS
- #############################################
- # On China MikroTik
- /ip dns
- set allow-remote-requests=yes servers=1.1.1.1,8.8.8.8
- /ip dhcp-server network
- set 0 dns-server=1.1.1.1,8.8.8.8
- #must reboot once
- # /system reboot
- #################################################
- # Step Four
- #################################################
- /ip firewall mangle
- add action=change-mss chain=forward new-mss=clamp-to-pmtu passthrough=yes protocol=tcp tcp-flags=syn
- add action=change-mss chain=output new-mss=clamp-to-pmtu passthrough=no protocol=tcp tcp-flags=syn
- /system reboot
[1] https://dimitrije.website/posts/ ... -and-wireguard.html
作者: 张无忌 時間: 2024-11-27 18:48
本帖最後由 张无忌 於 2025-5-2 05:20 編輯
MikroTik routers CN to HK performance via WireGuard
下列routers:
RB951G-HnD
hAP ac2
CCR1009-7G-1C-PC
hAP ax lite
RB5009UG+S+IN
hAP ax3
有了HK Gateway后,PC、手机、iPAD都不用VPN,就能直接HK network (HK-Gateway)。
https://speedtest.ofca.gov.hk/speedtest.html
Mainland China client side:RB951G-HnD,1CPU,v7.16.2,broadband=500Mbps/50Mbps
HK server side:hAP ac3,4CPU,v7.16.1,broadband=300Mbps/300Mbps
Table 1 (maximum kept)
- Date Time Latency(ms) Jitter(ms) Download(Mbps) Upload(Mbps)
- 2024-12-01 13:33 41 0.9 53 40
- 2024-12-02 09:20 41 0.4 53 45
- 2024-12-04 09:24 40 0.4 54 38
- 2024-12-06 08:03 42 0.8 54 39
- 2024-12-08 07:58 41 0.2 53 44
HK server side:hAP ac3,4CPU,v7.16.2, broadband=300Mbps/300Mbps
Table 2 (maximum kept)
- Date Time Latency(ms) Jitter(ms) Download(Mbps) Upload(Mbps)
- 2024-12-18 16:15 38 0.1 245 35
- 2024-12-23 17:36 37 0.2 249 43
- 2024-12-26 14:16 40 0.2 249 44
- 2025-01-04 10:28 41 0.3 243 42
- 2025-01-09 12:18 40 0.3 248 31
HK server side:hAP ac3,4CPU,v7.17.1, broadband=300Mbps/300Mbps
Table 3 (maximum kept)
- Date Time Latency(ms) Jitter(ms) Download(Mbps) Upload(Mbps)
- 2025-01-27 11:17 39 0.5 239 38
- 2025-01-28 14:12 40 0.2 243 43
- 2025-02-02 12:28 38 0.2 244 43
- 2025-02-05 08:16 37 0.2 248 41
- 2025-02-07 08:51 40 0.5 235 41
HK server side:hAP ac3,4CPU,v7.17.2, broadband=300Mbps/300Mbps
Table 4 (maximum kept)
- Date Time Latency(ms) Jitter(ms) Download(Mbps) Upload(Mbps)
- 2025-02-15 09:36 42 0.3 136 34
- 2025-02-16 09:49 40 0.4 140 36
- 2025-02-18 09:30 45 1.0 129 43
- 2025-02-19 09:02 43 0.2 129 43
- 2025-02-23 09:01 39 0.2 139 46
HK server side:hAP ac3,4CPU,v7.18, broadband=300Mbps/300Mbps
Table 5 (maximum kept)
- Date Time Latency(ms) Jitter(ms) Download(Mbps) Upload(Mbps)
- 2025-02-24 07:46 42 0.3 168 34
- 2025-02-27 17:07 52 3.4 173 34
- 2025-02-28 11:27 40 0.3 239 41
- 2025-03-02 09:16 37 0.2 256 42
- 2025-03-03 08:08 39 0.2 169 45
HK server side:hAP ac3,4CPU,v7.18.1, broadband=300Mbps/300Mbps
Table 6 (maximum kept)
- Date Time Latency(ms) Jitter(ms) Download(Mbps) Upload(Mbps)
- 2025-03-07 09:48 41 0.2 264 40
- 2025-03-08 15:29 42 0.5 259 36
- 2025-03-09 09:26 38 0.3 247 28
- 2025-03-10 08:20 37 0.2 169 39
- 2025-03-12 09:07 37 0.2 158 31
作者: freshtomato 時間: 2024-11-28 09:37
多謝分享!
用你上面的例子
問如果香港server router Os 已经GUI设定好 (睇YouTube 教学)
可以iPhone wireguard client logon,
宜家我多隻Microtik router 放在內地(reset default configuration)、 想张呢隻router 去setup wireguard client side,
我有wireguard client conf file,
問點樣可以人手或import conf file 去隻内地Microtik router? 麻烦指點!
Thanks in advance!!!
作者: 张无忌 時間: 2024-11-28 17:39
本帖最後由 张无忌 於 2025-2-20 09:29 編輯
Thank for appreciation and you have bought several MikroTik routers in (both Hong Kong and) Mianland China.
1. 香港的router是MikroTik吗?
2. 大陆的MikroTik routers能否have public IP?
3. 我上面的script有两部分,HK and China (Mainland),我只是用terminal输入的,但是改为输入方法,应该可以。
作者: freshtomato 時間: 2024-11-28 20:37
本帖最後由 freshtomato 於 2024-11-28 12:38 編輯
香港Pccw, 有兩個public ip, 一台Mikrotik(HK1) 一台Qnap(HK2), 两台router都是wireguard server,
大陸Broadband 無public ip, 有隻Mikrotik router (CN) ROS 7.16.2
我可以用mikrotik terminal 輸入,
最后,如果可以的话、教一下advance version, when Mikrotik CN wireguard to HK1, if connect failed 3 times, Mikrotik CN auto switch to wireguard HK2!
多谢🙏
作者: linuxfans 時間: 2024-11-29 10:03
回覆 1# 张无忌
好文 收藏+拜读 !!!赞!!!
作者: linuxfans 時間: 2024-11-29 10:15
回覆 5# freshtomato
如果您要同时连接香港两条WG,可以做成负载均衡即一条线连接不上时还可以连接另一条线路来使用。配置复杂一些。
一般个人在电脑或手机APP上使用WG,就直接切换到两条WG线路即可,简单快捷!
作者: 雯雯 時間: 2024-11-29 10:19
Thank for appreciation and you have bought several MikroTik routers in (both Hong Kong and) Mianland ...
张无忌 發表於 2024-11-28 17:39
我補充一下, Mikrotik既site to site wirguard只要求一個site有public IPV4/IPV6便可.
作者: Evangeline 時間: 2024-11-29 10:50
Thanks for share
作者: freshtomato 時間: 2024-11-29 14:48
香港那边已经做好wireguard server, 因为有时大约一两个星期或一个月香港那边换public IP, 一换public, 我要人手入去个大陸router 换IP, 如果可以的话, 其实我想要3个答案
1, Normal Mikrotik CN to Microtik HK ( 1 to 1) 应该最简单
2, On mainland side Mikrotik router WIfi SSID: ABC, Mikrotik CN to HK1, SSID: JKL, Mikrotik CN to HK2, 2 wireguards connect to both HK1 & HK2 at the same time, no need to detect wireguard connection failure.
3, when Mikrotik CN wireguard to HK1, if connect failed 3 times, Mikrotik CN auto switch to wireguard HK2!
Thanks
作者: liutim1127 時間: 2024-11-29 16:22
唔怕貴D嘅其實都可以搵D計流量嘅IEPL VM,
個賣家會比一個香港VM同一個深圳/廣州VM
VM 有兩個interface,
一個係public IP,
另一個係佢地之間互連嘅interface(IPEL) ,
互ping 通常3ms 內
我會改哂佢地做RouterOS CHR (P1)
起wireguard tunnel
同埋我會將IPEL 兩個VM 嘅tunnel interface 都放去其他vrf 方便 routing
依種用法網絡連接好穩定
latency 又唔高
以下係我從廣州routeros經以上setup ping 1.1.1.1 嘅result
第一個hop係深圳VM routeros
第二個hop係香港VM routeros
第三個hop係香港屋企 routeros

作者: 雯雯 時間: 2024-11-29 16:53
邊間? 我見通常賣port forward多.
作者: liutim1127 時間: 2024-11-29 18:29
回覆 12# 雯雯
nodeseek 偶然就會見到一兩間賣廣告, 經TG搵可能會簡單啲
不過依家都越嚟越少, 始終做端口轉發唔使用佢咁多粒public IP
作者: 张无忌 時間: 2024-11-29 19:55
本帖最後由 张无忌 於 2024-11-29 20:56 編輯
回覆 10# freshtomato
谢谢linuxfans和雯雯的建议。
freshtomato兄说有一台MikroTik (HK1), 一台QNAP (HK2)和Private IP大陆MikroTik (CN)。还有“香港那边已经做好wireguard server, 因为有时大约一两个星期或一个月香港那边换public IP, 一换public, 我要人手入去个大陸router 换IP”,看来freshtomato兄不太熟悉Dynamic DNS, 就是IP change,IP address会更新在Dynamic DNS。 其中MikroTik每一个router都有hostname(即DDNS),例如xxxxyyyyyzzzz.sn.mynetname.net。
还有你说:“果可以的话, 其实我想要3个答案
1, Normal Mikrotik CN to Microtik HK ( 1 to 1) 应该最简单
2, On mainland side Mikrotik router WIfi SSID: ABC, Mikrotik CN to HK1, SSID: JKL, Mikrotik CN to HK2, 2 wireguards connect to both HK1 & HK2 at the same time, no need to detect wireguard connection failure.
3, when Mikrotik CN wireguard to HK1, if connect failed 3 times, Mikrotik CN auto switch to wireguard HK2!”
1、 应该我的帖子能回答你的问题,已有在大陆的MikroTik router有Ethernets and WLANs。
2、 要有两个MikroTik routers,跟上面的1、一样做法。
3、 这个有点像ISP1 (HK1) and ISP2 (HK2), 大陆MikroTik router CN 选HK1,连不通就连HK2。
估计你在大陆比较多时间,可以大陆的CN有什么要改都可以,香港有public IP,不过要经过Wireguard,再用winbox到香港。如果你在香港的话,香港的MikroTik routers都可以改动,但是大陆你不能改,因为private IP,你在香港不能access到,那个时候你需要MikroTik Back-To-Home feature. 但是一般有delay,不过还能用。如果速度要快,你在大陆要有一台public IP MikroTik router,你大陆CN用Wireguard连接,然后香港用Win10,Win11用Wireguard client去连接大陆public IP MikroTik router。当接通后就可以用winbox连接大陆的CN router。
作者: 张无忌 時間: 2024-11-29 20:14
本帖最後由 张无忌 於 2024-11-30 08:34 編輯
回覆 11# liutim1127
请问是专线吗?Tx/Rx是多少?价格是多少一个月?
作者: Bose14 時間: 2024-11-29 21:40
大陸 UDP 有QoS 現在用Wireguard 好多時候都唔穩定
作者: liutim1127 時間: 2024-11-29 22:15
IPEL VPS - 1TB(IN+OUT all count) - Speed:200Mbps - 廣州/深圳移動入口
大約HKD400/月, 有D做得平D, 最低見過HKD300/月
2TB 價錢翻倍, 要再大一D流量嘅還請自己詢問賣家吧
流量型比起直接租100mbps 平唔少, 前提係你搵到嗰少數肯做流量型嘅賣家
有唔少都只係肯做獨佔型, 即係租一條100mb成條都係你咁
作者: 张无忌 時間: 2024-12-4 09:45
回覆 10# freshtomato
不知道你在大陆的测试的结果?
作者: kirafung 時間: 2024-12-4 10:59
大陸可以用VPN ?
作者: freshtomato 時間: 2024-12-4 19:26
本帖最後由 freshtomato 於 2024-12-5 09:53 編輯
成功安装、可以使用!
作者: 张无忌 時間: 2024-12-5 23:30
本帖最後由 张无忌 於 2024-12-6 08:33 編輯
回覆 20# freshtomato
"成功安装、可以使用!" 你的意思上面第一帖的script的HK-Gateway可以用?
你HK-Gateway的download speed是多少?
作者: freshtomato 時間: 2024-12-6 11:29
本帖最後由 freshtomato 於 2024-12-6 03:36 編輯
因为HK wireguard server 已经做好, 我只安装mainland Mikrotik,
依你step 1-4
Step 1, 我用Mikrotik winbox gui 解决 (其实同我之前set Mikrotik wg server 一樣)
Step 2, 我常试消化你cmdline 转用gui 去改setting, 唔知点解唔work, reset router 重来step 1,再step2用terminal成功
Step 3, I am lazy, direct paste the command to terminal
已经成功去HK Mikrotik server
Step 4 无设置, 唔知mangle 有什么用,无去set,
作者: 张无忌 時間: 2024-12-11 12:55
本帖最後由 张无忌 於 2024-12-13 08:57 編輯
回覆 22# freshtomato
很高兴你能建立HK-Gateway,相信一般情况没有问题的。
Step 1-4的scripts为了方便你用Winbox terminal输入,而不是用GUI输入,用terminal比较交快。因为你没用Step 4,里面主要有些MTU比较大,大约0.5%,需要改一下,效率比较高。
- #################################################
- # Step Four
- #################################################
- /ip firewall mangle
- add action=change-mss chain=forward new-mss=clamp-to-pmtu passthrough=yes protocol=tcp tcp-flags=syn
- add action=change-mss chain=output new-mss=clamp-to-pmtu passthrough=no protocol=tcp tcp-flags=syn
另外一个问题,就是abc.xyz.org [2], 因为resolve不到,那是后要另外的hostame,resolve到IP。这个问题。加入你离开香港有2000公里,所有大陆以外连接不到,你需要iPhone FaceTime [3] and iMessage [4],你可以利用它联系大陆以外,而不需要VPN,如香港等,找到香港IP就可以联系,直接把IP输入Wireguard Endpoint。那么IP怎样得到?你用手机iPhone Safari browser打开checkip.com or whatismyipaddress.com,把图或者IP address用iMessage传送对方或用FaceTime用语音通话,这样方法不需要VPN。如果没有iPhone手机,用Android的话,就要用不安全的WeChat。
Ref:
[1] https://www.hkepc.com/forum/redi ... 80&pid=42427439
[2] https://www.hkepc.com/forum/viewthread.php?fid=12&tid=2736880
[3] https://www.hkepc.com/forum/view ... 169&tid=2736061
[4] https://www.hkepc.com/forum/view ... 169&tid=2737713
作者: wayllon 時間: 2024-12-14 21:49
我印象中大陸用wireguard好像會被封port. 可以連接到但是用1-2日后會被封port
作者: bendoraemon 時間: 2024-12-14 22:35
佢哋用專線應該冇呢個問題
作者: cyruschan112 時間: 2024-12-15 15:56
之前試過系vultr 到租個vps ,用wg-easy docker 起完
玩左1晚第二日就block 左
作者: anthonyko 時間: 2024-12-15 19:47
本帖最後由 anthonyko 於 2024-12-15 19:49 編輯
係...我唔會用wirdguard ...用tailscale好過
之前已經有師兄介紹tailscale
https://www.hkepc.com/forum/view ... =2699895&page=1
作者: wayllon 時間: 2024-12-17 02:24
回覆 27# anthonyko
Wireguard 已經係公開的秘密
作者: liutim1127 時間: 2024-12-17 14:34
係大陸用wireguard 唔過牆冇人理的,
過牆就好易比人block/ drop 到你用唔到
所以幫襯D 流量轉發或者租對IEPL VPS係相對穩定嘅option
不過流量轉發UDP就唔係間間都做得好,有D QoS Q 到係ON99
作者: 张无忌 時間: 2024-12-23 11:18
回覆 16# Bose14 ,回覆 19# kirafung ,回覆 24# wayllon ,回覆 25# bendoraemon ,回覆 26# cyruschan112 ,回覆 27# anthonyko ,回覆 29# liutim1127
WireGuard本身出自Linux UDP,比IPSec IKEv1 or IKEv2 还要快 [1]。大陆经过香港Internet,WireGuard UDP容易被control,所以经常traffic QoS control [Bose14],在一般家用网络,无法避免,除非有特别出路 [liutim1127]。如果大陆只看大陆新闻,不必须要用VPN,如果大陆以外新闻,你就要科学上网,大陆的网民都是科学上网 [kirafung] 。如果在大陆上网,大陆与香港的路由器一天要跟换一次,最简单有开一次 power reset,一般关15分钟,可以跟改,但是如果HKBN不会改,如果用户PCCW就可以,有些网友用timer control,可以用手机遥控控制,在大街都可控制,有在RouterOS 可以set timer script [wayllon]。专线没有用过。我的使用一般家用网络 [bedoraemon] 。都是大陆和香港一天换一次IP,block现象会减少 [cyruschan],tailscale都是WireGuard,都是这样做 [anthonyko]。
总结一下怎样防止IP被封
1、Routers要每天至少更换一次,有时候一天跟换多次。
2、用timer control方法,去夜深更换IP,也可以用手机更换IP,时间大约15分钟,然后用手机连上路由器,用手机输入checkip.com,检查IP,然后用手机iMessage发给大陆陆亲友,或者等后一段时间,DDNS will propagate to China DNS server。
3、白天router表现很好,晚上比较差一些 [2]。
Ref.
[1] https://www.wireguard.com
[2] https://www.hkepc.com/forum/redi ... 80&pid=42427439
作者: 张无忌 時間: 2024-12-29 19:46
用WireGuard,你能知道有data flow,看不到里面的内有,以为大陆用很多WireGuard,不能block,只能QoS,因为太多了!!!
作者: kirafung 時間: 2024-12-30 12:16
想問下Tailscale 係免費版都大陸用到?
作者: t101 時間: 2024-12-30 12:37
可以
不過每個地方速度會唔同
作者: t101 時間: 2024-12-30 12:38
回覆 Bose14 ,回覆 kirafung ,回覆 wayllon ,回覆 bendoraemon ,回覆 cyruschan112 ,回覆 antho ...
张无忌 發表於 2024-12-23 11:18
換udp port,或用port range簡單D
作者: 张无忌 時間: 2024-12-31 23:14
Copied!
今晚L2TP/IPsec不行,只有pptp可以。
作者: anthonyko 時間: 2025-1-1 03:43
我估冇問題
作者: 467 時間: 2025-1-2 17:55
回覆 10# freshtomato
DDNS可以自動更新PUBLIC IP,或者轉用ZEROTIER
作者: 张无忌 時間: 2025-1-4 15:53
用第一帖说的HK-Gateway(简HKG),使用效果非常好!比用电脑的WireGuard效果好,电脑用WireGuard,还有电脑本身,会出现一些不明白的现象,如用WinBox出来的码不动,WinBox是RouterOS的工作。
用HKG(LAN+WiFi),电脑就不需要安装任何VPN,技能直接登入香港网站。看YouTube的speed可以达到300000kbps,有的时候更达到720000kbps,看8k的YouTube都没问题。
作者: fakeman 時間: 2025-1-5 14:02
WireGuard本身出自Linux UDP,比IPSec IKEv1 or IKEv2 还要快 [1]。大陆经过香港Internet,WireGuard UDP容易被control,所以经常traffic QoS control [Bose14]
张无忌 發表於 2024-12-23 11:18
Wireguard / IKEv2 都係用 UDP 嘅,所以呢個唔係 WG 快過 IKEv2 嘅原因,WG 快係因為佢嘅 lightweight coding design,少 d code 少 d 特別 processing 自然可以快 D,而且 WG 仲有 kernel mode integration 行得更加快
作者: 张无忌 時間: 2025-1-12 20:53
回覆 39# fakeman
我想手机可以加入IKEv2,什么时候加入WireGuard在手机built-in,那么用起来就更加方便。
作者: 张无忌 時間: 2026-3-24 21:14
本帖最後由 张无忌 於 2026-3-24 14:32 編輯
GL-MT3600BE
GL-MT3600BE WireGuard settings,Line 03=10.1.0.2/24
- [Interface]
- PrivateKey = 8N8uKPLa0H+pyL8lHxMoySqSq60wieDpCvhiKOlQhG0=
- Address = 10.1.0.2/24, fd00:9262:bc00:b88c::2/64
- DNS = 10.1.0.1, fd00:9262:bc00:b88c::1, 64.6.64.6
- MTU = 1420
- [Peer]
- PublicKey = rHT/pRV/ovJr7tVgRQQ2vaQA3WkcLo4C1gnV1Xd9YhM=
- PresharedKey = qAnHo8uMf5CrgqFP0XzyFHsG1EZW8+BWG8I3GW/rPUQ=
- AllowedIPs = 0.0.0.0/0, ::/0
- Endpoint = xyz.abc.com:51820
- PersistentKeepalive = 25
MikroTik RB951G-2HnD,Line 12=10.1.0.2/24
- #################################################
- # Step one
- #################################################
- /interface wireguard
- add listen-port=13231 mtu=1420 name=wg-hk private-key=\
- "8N8uKPLa0H+pyL8lHxMoySqSq60wieDpCvhiKOlQhG0=" \
- comment="WG HK"
- #######################
- # Assign address to the router on the new interface.
- /ip address
- add address=10.1.0.2/24 comment="Wireguard" interface=wg-hk \
- network=10.1.0.0
- #/ip firewall filter
- #add action=accept chain=input comment="Wireguard" dst-port=13231 \
- # protocol=udp
- # Set up HK peer
- /interface wireguard peers
- add name=hk allowed-address=0.0.0.0/0 comment="hk" \
- endpoint-address=abc.xyz.com endpoint-port=51820 \
- interface=wg-hk public-key=\
- "rHT/pRV/ovJr7tVgRQQ2vaQA3WkcLo4C1gnV1Xd9YhM=" \
- preshared-key="qAnHo8uMf5CrgqFP0XzyFHsG1EZW8+BWG8I3GW/rPUQ=" \
- persistent-keepalive=25
- #################################################
- # Step Two
- #################################################
- # On China MikroTik
- /routing table
- add comment="For use by local clients" disabled=no fib name=wg-vpn
- /routing rule
- add action=lookup-only-in-table \
- comment="Local clients should use (only) Wireguard routing table" \
- disabled=no interface=bridge src-address=192.168.88.0/24 table=wg-vpn
- /ip route
- add dst-address=0.0.0.0/0 gateway=wg-hk routing-table=wg-vpn
- /ip firewall nat \
- add chain=srcnat out-interface=wg-hk action=masquerade
- ### Open MSDOS window input "curl http://myip.dnsomatic.com" to display HK IP address ###
- #################################################
- # Step Three
- #################################################
- /ip dns
- set allow-remote-requests=yes servers=1.1.1.1,8.8.8.8
- /ip dhcp-server network
- set 0 dns-server=1.1.1.1,8.8.8.8
- #must reboot once
- # /system reboot
- #################################################
- # Step Four
- #################################################
- /ip firewall mangle
- add action=change-mss chain=forward new-mss=clamp-to-pmtu passthrough=yes protocol=tcp tcp-flags=syn
- add action=change-mss chain=output new-mss=clamp-to-pmtu passthrough=no protocol=tcp tcp-flags=syn
- /system reboot
References:
[1] Mainland China VPN Hong Kong via MikroTik and WireGuard
[2] https://dimitrije.website/posts/ ... -and-wireguard.html
作者: 张无忌 時間: 2026-3-24 21:14
本帖最後由 张无忌 於 2026-3-24 14:31 編輯
hAP ac lite
hAP ac lite WireGuard settings,Line 03=10.3.0.5/32
- [Interface]
- PrivateKey = uLxOU/qK69xmEiryFoqZ2Z9IaeoDb6E2p9fn4R7CcUU=
- Address = 10.3.0.5/32
- DNS = 1.1.1.1, 8.8.8.8
- [Peer]
- PublicKey = 1WhizDkvtctaL6Ob/HNOPxvgwgHELlBRlQL/rEwTMGs=
- PresharedKey = qAnHo8uMf5CrgqFP0XzyFHsG1EZW8+BWG8I3GW/rPUQ=
- AllowedIPs = 0.0.0.0/0
- Endpoint = xyz.abc.com:19991
- PersistentKeepalive = 25
MikroTik RB951G-2HnD,Line 12=10.3.0.5/32
- #################################################
- # Step one
- #################################################
- /interface wireguard
- add listen-port=13231 mtu=1420 name=wg-hk private-key=\
- "uLxOU/qK69xmEiryFoqZ2Z9IaeoDb6E2p9fn4R7CcUU=" \
- comment="WG HK"
- #######################
- # Assign address to the router on the new interface.
- /ip address
- add address=10.3.0.5/32 comment="Wireguard" interface=wg-hk \
- network=10.3.0.0
- #/ip firewall filter
- #add action=accept chain=input comment="Wireguard" dst-port=13231 \
- # protocol=udp
- # Set up HK peer
- /interface wireguard peers
- add name=hk allowed-address=0.0.0.0/0 comment="hk" \
- endpoint-address=abc.xyz.com endpoint-port=19991 \
- interface=wg-hk public-key=\
- "1WhizDkvtctaL6Ob/HNOPxvgwgHELlBRlQL/rEwTMGs=" \
- preshared-key="qAnHo8uMf5CrgqFP0XzyFHsG1EZW8+BWG8I3GW/rPUQ=" \
- persistent-keepalive=25
- #################################################
- # Step Two
- #################################################
- # On China MikroTik
- /routing table
- add comment="For use by local clients" disabled=no fib name=wg-vpn
- /routing rule
- add action=lookup-only-in-table \
- comment="Local clients should use (only) Wireguard routing table" \
- disabled=no interface=bridge src-address=192.168.88.0/24 table=wg-vpn
- /ip route
- add dst-address=0.0.0.0/0 gateway=wg-hk routing-table=wg-vpn
- /ip firewall nat \
- add chain=srcnat out-interface=wg-hk action=masquerade
- ### Open MSDOS window input "curl http://myip.dnsomatic.com" to display HK IP address ###
- #################################################
- # Step Three
- #################################################
- /ip dns
- set allow-remote-requests=yes servers=1.1.1.1,8.8.8.8
- /ip dhcp-server network
- set 0 dns-server=1.1.1.1,8.8.8.8
- #must reboot once
- # /system reboot
- #################################################
- # Step Four
- #################################################
- /ip firewall mangle
- add action=change-mss chain=forward new-mss=clamp-to-pmtu passthrough=yes protocol=tcp tcp-flags=syn
- add action=change-mss chain=output new-mss=clamp-to-pmtu passthrough=no protocol=tcp tcp-flags=syn
- /system reboot
References:
[1] Mainland China VPN Hong Kong via MikroTik and WireGuard
[2] https://dimitrije.website/posts/ ... -and-wireguard.html

