|  | 
 
 发表于 2016-7-10 01:34:15
|
显示全部楼层 
| 不對,是在route.
 pppoe-client的設定裡有個add default route的方框,
 將default route方框勾選後,還有個distance可以填數字(預設是1)
 
 所以重點來了,distance是用來決定路由的優先權.
 因為pppoe-client的distance預設是1(數字越小越優先,1只大於內網distance的0),
 所以除內網(distance=0)的封包,都會從pppoe-client出去.
 
 若再開pppoe-client2 ,它的distance一樣定為預設的1
 當pppoe-client1與pppoe-client2的distance同為1時,會以後面連接的為準,所以封包改從pppoe-client2出.
 
 為了避免公網出口因pppoe-client連線先後造成錯亂,最好將兩clients的distance錯開.如:
 
 pppoe-client1 distance定為2 ,pppoe-client2 distance定為3.
 當兩個pppoe-client同時連接時,因pppoe-client1的distance小於pppoe-client2 (2<3),
 所以網路出口會以pppoe-client1當.
 
 不過當pppoe-client1離線,會自動由下一個distance遞補,也就是pppoe-client2.
 一旦pppoe-client1再度上線,則又是兩client的distance比較(2<3),所以網路出口權又再回到pppoe-client1
 ================================================
 若這時再參入pptp-client呢? 其實意思相同,pptp-client同樣有add default route的方框,可以填distance數字.
 若您將add default route打勾,然後使用distance預設的1
 
 這時pptp-client distance小於pppoe-client1與pppoe-client2 (1<2<3)
 所有的封包都將會往pptp-client走,不往任一個pppoe-client.
 
 若您的目標的確是要用pptp-client代理翻到網路另一端,使用add default route可以;
 但若只是小部份區網,如:172.16.0.0/24 使用add default route就不合適,因為default route代表著0.0.0.0/0
 
 所以這時您就不該勾add default route,要用手動的方式來新增路由.
 在/ip route add dst-address=172.16.0.0/24 gateway=pptp-client distance=1
 
 若遇送發172.16.0.0/24範圍內的封包,路由該往pptp-client/pppoe-out1/pppoe-out2那一個?
 最終由distance決定,由distance為1的pptp-client勝出!!
 
 因172.16.0.0/24範圍的封包都往pptp-client先送,其它的才往pppoe-client1
 
 
 
 | 
 |