弟想在一台RB450G上
做多WAN策略路由
因為一直摸不到方向,所以懇請各位大大能賜教!!
弟的環境如下:
ether1 -> 設置命名為(CABLE) dhcp client -> 自動取得cable業者配發的ip 並設置(add default route=yes)
ether2 -> 設置命名為(COMPANY) dhcp client -> 自動取得公司內網配的ip->192.168.2.75 遮罩->255.255.252.0 閘道->192.168.3.254
ether3 -> 設置命名為(xDSL) pppoe client ->撥取中華電信的浮動固定ip
ether4 -> 設置命名為(LAN-1) dhcp server ->配發192.168.88.0/24的網段給ether4及ether5所接的桌上型電腦
ether5 -> 設置命名為(LAN-2) 將Master port指向 LAN1
弟的需求如下:
1.當ether4後接的電腦,取得192.168.88.x 的電腦上線時,
一般上網走ether1, 但如需要開啟outlook(連上exchange server)等軟件時,
會改走ether2, 並且可以tracert到 192.168.0.0/22 底下其他提供服務的設備
2.當ether5後接的電腦,取得ip為192.168.88.10 - 192.168.88.20 區間的電腦
所有上網行為走ether3
弟嘗試在ip -> route 裡新增new route 將dst.address設定192.168.0.0/22, gatway 192.168.3.254(呈現藍色)
(routeros 內的tracert route工具 無法tracert到192.168.1.145)
在ip -> route 裡新增new route 將dst.address設定192.168.0.145, gatway 192.168.3.254 (呈現黑色)
(routeros 內的tracert route工具 可以tracert到192.168.1.145 但ether4底下的電腦ip 192.168.88.200 tracert不到192.168.1.145)
想請問各位前輩我該怎麼設定才是正確的呢?
danies0207 wrote:有貼圖的代表是基本設定,請注意比對圖與您設定"細節"的不同.
各位前輩好弟想在一台...(恕刪)
另外像是ether?與pppoe的名稱要注意,會影響最後code的文字內容!
/interface
ether1-3:
ether4:
ether5:
/ip address
/ip dhcp-server
/ip dhcp-client
ether1:
ether2:
/interface pppoe-client
以下是code ! 注意ether?與pppoe名稱若與您的設定不同,code也要對應修改.
或許您還會問202.39.224.125是什麼地址? 那是中華電信的@msa.hinet.net信箱.
/ip firewall nat不知道您有無注意上面的code沒有ether1 ?
add action=masquerade chain=srcnat disabled=no out-interface=ether1
add action=masquerade chain=srcnat disabled=no out-interface=ether2
add action=masquerade chain=srcnat disabled=no out-interface=vdsl
/ip firewall mangle
add action=mark-routing chain=output dst-address=202.39.224.125 \
new-routing-mark=to_ether2 passthrough=no
add action=mark-routing chain=output dst-port=25,587,143,993,110,995 \
new-routing-mark=to_ether2 passthrough=no protocol=tcp
add action=mark-routing chain=prerouting dst-address=202.39.224.125 \
new-routing-mark=to_ether2 passthrough=no
add action=mark-routing chain=prerouting dst-port=25,587,143,993,110,995 \
new-routing-mark=to_ether2 passthrough=no protocol=tcp
add action=mark-routing chain=prerouting src-address=192.168.88.10-192.168.88.20 \
new-routing-mark=to_vdsl passthrough=no
/ip route
add distance=1 dst-address=192.168.0.0/22 gateway=ether2
add distance=1 gateway=ether2 routing-mark=to_ether2
add distance=1 gateway=vdsl routing-mark=to_vdsl
原因是dhcp-client中ether1設定add default route=yes,
系統會自動新增,您無需手動設定相關.
default route只能有一個,所以用在ether1上.
沒有設定及需指定routing的連線,才需要在/ip route中設定.
gfx wrote:
有貼圖的代表是基本設...(恕刪)
超級超級感謝gfx大的教學!!!
摸索了兩星期..完全抓不到頭緒,
但依您的code 實現了我的需求,
後續加上端口的策略路由,
公司的oracle連線也完全正常了,
不過..誠如您所說...
/ip firewall mangle
add action=mark-routing chain=output dst-address=202.39.224.125 \
new-routing-mark=to_ether2 passthrough=no
add action=mark-routing chain=output dst-port=25,587,143,993,110,995 \
new-routing-mark=to_ether2 passthrough=no protocol=tcp
add action=mark-routing chain=prerouting dst-address=202.39.224.125 \
new-routing-mark=to_ether2 passthrough=no
add action=mark-routing chain=prerouting dst-port=25,587,143,993,110,995 \
new-routing-mark=to_ether2 passthrough=no protocol=tcp
這一段完全看不懂.....

為什麼要mark-routing 這個ip的這些port走 ether2呢??
另外
add distance=1 dst-address=192.168.0.0/22 gateway=ether2
這行新增出來的routes 是呈現藍色如下圖,(藍色是不是指沒有作用?)

但實際在連線192.168.0.0/22的這些網段確實沒有問題!!
可否請gfx大說明一下,真的再次非常感謝您!!
/ip firewall mangle您不是要mail都走ether2嗎? 這些port都是常用e-mail連接埠 ,
add action=mark-routing chain=output dst-address=202.39.224.125 \
new-routing-mark=to_ether2 passthrough=no
add action=mark-routing chain=output dst-port=25,587,143,993,110,995 \
new-routing-mark=to_ether2 passthrough=no protocol=tcp
add action=mark-routing chain=prerouting dst-address=202.39.224.125 \
new-routing-mark=to_ether2 passthrough=no
add action=mark-routing chain=prerouting dst-port=25,587,143,993,110,995 \
new-routing-mark=to_ether2 passthrough=no protocol=tcp
這一段完全看不懂.....
為什麼要mark-routing 這個ip的這些port走 ether2呢??
還有202.39.224.125這個hinet信箱.TCP/UDP埠清單
chain=output是指定rb450g 送出封包的策略 ,chain=prerouting則是區網電腦.
若您有使用VPN ,也可以改用策略路由. 不用預設的ether1 ,改用pppoe翻牆.
add distance=1 dst-address=192.168.0.0/22 gateway=ether2
這行新增出來的routes 是呈現藍色如下圖,(藍色是不是指沒有作用?)
gfx wrote:
您不是要mail都走...(恕刪)
gfx大好!!
哈哈,結果我的端口策略路由失敗,oracle server只連上了一次,
中斷後再連就連不上了,但多試幾次又會再成功,目前不知道什麼問題,
是因為沒有routing-mark到嗎?
請問可以從哪裡監看到是否該連線是有被mark到
我用tools -> troch 這工具看是看不到的..
另外我自己加了/ip route add distance=1 dst-address=172.16.0.0/16 gateway=ether2
這個規則,發現開網頁連172.16.0.2xx這個是會走ether2出去的,且tracert的到,
但用telnet 172.16.210.1x 這個ip則連不上,且tracert也tracert不到,很怪
最後想請問gfx大
您這四行/ip firewall mangle
add action=mark-routing chain=output dst-address=202.39.224.125 new-routing-mark=to_ether2 passthrough=no
add action=mark-routing chain=output dst-port=25,587,143,993,110,995 new-routing-mark=to_ether2 passthrough=no protocol=tcp
add action=mark-routing chain=prerouting dst-address=202.39.224.125 new-routing-mark=to_ether2 passthrough=no
add action=mark-routing chain=prerouting dst-port=25,587,143,993,110,995 new-routing-mark=to_ether2 passthrough=no protocol=tcp
依您所說是否我把特並port要走ether2的port號直接加在第二第四行即可?
是因為沒有routing-mark到嗎?
請問可以從哪裡監看到是否該連線是有被mark到
用mark-connection 再標記一次不就可以在/ip firewall connnection看得到了?
加了/ip route add distance=1 dst-address=172.16.0.0/16 gateway=ether2因為RB450G無法分辯您的172.16.0.2xx 與172.16.210.1x 是該往ether1 ,還是ether2...
這個規則,發現開網頁連172.16.0.2xx這個是會走ether2出去的,且tracert的到,
但用telnet 172.16.210.1x 這個ip則連不上,且tracert也tracert不到,很怪
若要防止172.16.0.0/16 部份連線往預設ether1跑,那就用策略路由強制只能往ether2送!
以上是針對區網電腦.
若是使用RB450G工具也要往ether2送,那還得增加chain=output相同的設定.
依您所說是否我把特並port要走ether2的port號直接加在第二第四行即可?改採樓上設定,Port免了! 就這樣!!!
內文搜尋

X