電訊茶室's Archiver

角色 發表於 2014-8-17 21:14

【RouterOS】—— Policy base routing

[i=s] 本帖最後由 角色 於 2014-8-18 02:17 編輯 [/i]

因为很多时候Policy Routing是非常有用,所以先建立一幅帖子,集中讨论。

[url]http://blog.butchevans.com/2008/09/mikrotik-policy-routing-implementation-example/[/url]

[url]http://wiki.mikrotik.com/wiki/Policy_Base_Routing[/url]

[url]http://aacable.wordpress.com/2011/10/27/mikrotik-policy-routing-based-on-client-ip-address/[/url]

角色 發表於 2014-8-17 21:14

[i=s] 本帖最後由 角色 於 2017-10-31 20:07 編輯 [/i]

Purpose: Client located in China and watch HK news/facebook/youtube

Step 1: Establishment of a PPP link between two sites

Step 2: IP-based policy route using the packet-marking method

Step 3: NAT

Step 4: Routing based on the marked packets

角色 發表於 2014-8-17 21:27

[i=s] 本帖最後由 角色 於 2017-10-31 20:28 編輯 [/i]

Step 1: Establishment of a PPP link between two sites

This can be done very easy. For example you may use PPTP or SSTP to link up two sites. In general the server should be located in HK and the client should be located in the Mainland China.

Step 2: IP-based policy route using the packet-marking method

1) Set the IP address of a PC to be connected to the HK VPN server, e.g. 192.168.99.101
2) Using the "Mangle" function to mark the packet.
/ip firewall mangle add chain=prerouting src-address=192.168.99.103 action=mark-routing passthrough=no


Step 3: NAT
/ip firewall nat add chain=srcnat src-address=192.168.9
9.103 out-interface=sstp-out1 action=masquerade

Step 4: Routing based on the marked packets
add new a new route to direct the data stream whose packets marked to the desired interface.

vpn-learner 發表於 2018-10-19 12:52

Please would you discribe more on Step 4? Can I use the IP of my router ( instead of IP of my PC)in step one?
Thank you!

角色 發表於 2018-10-19 13:23

[i=s] 本帖最後由 角色 於 2018-10-19 13:41 編輯 [/i]

你可以看考下面帖子:

[url]http://www.telecom-cafe.com/forum/viewthread.php?tid=7185&extra=page%3D1[/url]

里面部分的东西包含你说的东西。[code]
/ip firewall nat
add action=masquerade chain=srcnat comment="masq. vpn traffic" src-address=192.168.89.0/24
[/code]Step 4只是简单,很多具体都在我上面的帖子有写到的。等我有空的时候给你写过简单版,或者gfx都能办到你,他是非常熟悉MikroTik里的指令。

vpn-learner 發表於 2018-10-20 00:00

请问在设定 static route 时,输入 dst address 0.0.0.0/24 是什么意思? 是否指所有的addresses?

[attach]4214[/attach]

vpn-learner 發表於 2018-10-20 00:02

刚才打错字!
0.0.0.0/0

角色 發表於 2018-10-20 01:48

就是所有mask都是0,就是让所有address都通过,然后traffic后面的gateway。

vpn-learner 發表於 2018-10-20 12:24

如果这样设定 route 0.0.0.0/0 是否即表示数据没有分流? 全都去了那个gateway?

角色 發表於 2018-10-20 12:51

Policy route就是依据 routing mark,是routing mark,才去required gateway(如ppp)。

vpn-learner 發表於 2018-10-20 15:09

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=45586&ptid=6333]8#[/url] [i]角色[/i] [/b]


    这可否理解为(类似) 全局模式了?

角色 發表於 2018-10-20 17:44

简单来说是可以这样想。(要有routing mark那些才会)

Skypeus 發表於 2018-10-29 14:42

这个我还没有学会。

角色 發表於 2018-10-29 17:32

[b]回復 [url=http://www.telecom-cafe.com/forum/redirect.php?goto=findpost&pid=45622&ptid=6333]13#[/url] [i]Skypeus[/i] [/b]

想起最初的我对于Policy-based Routing都不太会,但是多看,多google一下,慢慢也会了!其实我用的Policy-base routing是非常旧的版本,gfx还有新的方法更加简单,但是由于没有时间去follow,所以。。。现在只能用旧的。

vpn-learner 發表於 2018-10-30 13:05

用 PBR 是否需要IP address list来 配合呢?IP address list 是否需要自己去更新?因为实在有太多网网址要输入了!

頁: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.