gfx wrote:
chain=prerouting...(恕刪)
感謝提供詳細設定參考。
請問第一張圖的「VPN網域」是指VPN Client所在的LAN嗎?以我的設定,VPN client的dhcp pool拿到的網段是和RB450G LAN網段一樣的,都是192.168.100.0/24,這樣我在Address list只做一條應該沒錯吧?
# LIST ADDRESS TIMEOUT
0 support 192.168.100.0/24
在Mangle的部分,圖中只有圈#1的accept pre-routing,區網的部分我是按照您提供的參考設定#0~#2都做了。在「路由器入口」的部分是每一條都是必要的嗎?還是只有綠色匡的部分必要?請問做mark routing和mark connection之後在哪裡用到?
我自己的Mangle只有做Routing mark,為了區隔動態和固定IP不同出口。
0 ;;; LAN Pre-routing
chain=prerouting action=accept dst-address-type=local
src-address-list=support dst-address-list=support log=no log-prefix=""
1 chain=prerouting action=accept dst-address-type=local
src-address-list=support log=no log-prefix=""
2 chain=prerouting action=accept dst-address-type=local
dst-address-list=support log=no log-prefix=""
3 ;;; Out. Routing Mark
chain=prerouting action=mark-routing new-routing-mark=out_Hinet_Dyn
passthrough=no src-address=192.168.100.2-192.168.100.150 log=no
log-prefix=""
4 chain=prerouting action=mark-routing new-routing-mark=out_Hinet_Static
passthrough=no src-address=192.168.100.151-192.168.100.199 log=no
log-prefix=""
5 chain=prerouting action=mark-routing new-routing-mark=out_Hinet_Dyn
passthrough=no src-address=192.168.100.200-192.168.100.254 log=no
log-prefix=""
在第四張圖NAT的部分,我是用PPTP Server測試,所以在「VPN伺服器」我只做gre和tcp 1723這樣應該沒問題吧?另外,#13和#19有什麼差異?從圖中看起來都是accept dstnat protocol = gre。
在第四張圖中下方還設定了其他service的dstnat,我想要內網之間全部開放dstnat、互相不用過濾就互通,所以我改成accept dstnat Src. Address list 和Dst. Address list都設LAN IP list(對應第一張圖就是All LAN),Dst. Address Type = local,不知道這樣會不會有什麼潛在問題?
7 ;;; NAT Loopback
chain=srcnat action=masquerade src-address=192.168.100.0/24
dst-address=192.168.100.0/24 log=no log-prefix=""
8 ;;; Hinet Dyn mas
chain=srcnat action=masquerade out-interface=Hinet_Dyn log=no
log-prefix=""
9 ;;; Hinet Static mas
chain=srcnat action=masquerade out-interface=Hinet_Static log=no
log-prefix=""
10 ;;; VPN Server
chain=dstnat action=accept protocol=tcp dst-address-type=local
dst-port=1723 log=no log-prefix=""
11 chain=dstnat action=accept protocol=gre dst-address-type=local log=no
log-prefix=""
12 chain=dstnat action=accept protocol=tcp dst-address-type=local
src-port=1723 log=no log-prefix=""
13 ;;; Accept LAN dstnat ALL
chain=dstnat action=accept dst-address-type=local
src-address-list=support dst-address-list=support log=no log-prefix=""
剛剛測試過後,真的和您說的一樣,目前只有固定IP那一條線進入PPTP Server是ok的,從浮動IP那一條線是無法連接PPTP Server,看起來NAT的部分出了問題。
目前依照上述的設定仍然無法ping到RB450G後方LAN的電腦,請繼續指教,謝謝。
補充:目前可以從VPN Client ping到RB450G了,成功的第一步。

My Blog -> 白髮.青春 http://www.blogger.idv.tw/
gfx wrote:
chain=prerouting...(恕刪)
自問自答一下,我把Mangle的部分設錯了,正確的應該是按照您的圖中LAN的部分即可。
0 ;;; LAN Pre-routing
chain=prerouting action=accept src-address-list=support
dst-address-list=support log=no log-prefix=""
1 chain=prerouting action=accept dst-address-type=local
src-address-list=support log=no log-prefix=""
2 chain=prerouting action=accept dst-address-list=support log=no
log-prefix=""
除了#1要dat-address-type=local以外,其他都不需要。

這三條會直接影響packet是否能正確送到電腦。
My Blog -> 白髮.青春 http://www.blogger.idv.tw/
WilliamTai wrote:您對標記路由的使用還不夠成熟,尤其您還做NAT-Loopback.
自問自答一下,我把Mangle...(恕刪)
但相關Mangle標記卻什麼都沒有...

/ip firewall address匯入後您再運行VPN ,看匯入前和匯入後有何不同.
add list="Hinet_Dyn" address=1.1.1.1
add list="Hinet_Static" address=2.2.2.2
/system scheduler
add interval=15s name=pppoe on-event=":local publicip1 [/ip address \\
get [find interface=\\"Hinet_Dyn\"] address]\r\
\n:set publicip1 [:pick \$publicip1 0 [:find \$publicip1 \"/\"]]\r\
\n:set publicip1 [:toip \$publicip1]\r\
\n:local pppoe1 [/ip firewall address-list get [find list=\"Hinet_Dyn\"] add\
ress]\r\
\n:if (\$publicip1!=\$pppoe1) do={/ip firewall address-list set [find list=\
\"Hinet_Dyn\"] address=\$publicip1}\r\
\n:local publicip2 [/ip address get [find interface=\"Hinet_Static\"] addres\
s]\r\
\n:set publicip2 [:pick \$publicip2 0 [:find \$publicip2 \"/\"]]\r\
\n:set publicip2 [:toip \$publicip2]\r\
\n:local pppoe2 [/ip firewall address-list get [find list=\"Hinet_Static\"] \
address]\r\
\n:if (\$publicip2!=\$pppoe2) do={/ip firewall address-list set [find list=\
\"Hinet_Static\"] address=\$publicip2}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive start-date=\
may/31/2015 start-time=00:00:00
/ip firewall nat disable [find comment="Accept LAN dstnat ALL"]
foreach i=[/ip firewall mangle find chain="prerouting"||chain="output"] \
do={/ip firewall mangle disable $i}
/ip firewall mangle
add chain=prerouting action=accept dst-address=192.168.100.0/24 \
src-address=192.168.100.0/24
add chain=prerouting action=accept dst-address-type=local \
src-address=192.168.100.0/24
add chain=output action=accept dst-address=192.168.100.0/24
add chain=prerouting action=mark-connection \
new-connection-mark="Hinet_Dyn_conn" \
dst-address-list="Hinet_Dyn"
add chain=prerouting action=mark-connection \
new-connection-mark="Hinet_Static_conn" \
dst-address-list="Hinet_Static"
add chain=output action=mark-routing connection-mark="Hinet_Dyn_conn" \
new-routing-mark="out_Hinet_Dyn" passthrough=no
add chain=output action=mark-routing connection-mark="Hinet_Static_conn" \
new-routing-mark="out_Hinet_Static" passthrough=no
add chain=prerouting action=mark-routing connection-mark="Hinet_Dyn_conn" \
new-routing-mark="out_Hinet_Dyn" passthrough=no src-address=192.168.100.0/24
add chain=prerouting action=mark-routing connection-mark="Hinet_Static_conn" \
new-routing-mark="out_Hinet_Static" passthrough=no src-address=192.168.100.0/24
add chain=output action=mark-routing new-routing-mark="out_Hinet_Dyn" \
passthrough=no src-address-list="Hinet_Dyn"
add chain=output action=mark-routing new-routing-mark="out_Hinet_Static" \
passthrough=no src-address-list="Hinet_Static"
add chain=prerouting action=mark-routing new-routing-mark="out_Hinet_Dyn"
passthrough=no src-address=192.168.100.2-192.168.100.150
add chain=prerouting action=mark-routing new-routing-mark="out_Hinet_Dyn"
passthrough=no src-address=192.168.100.200-192.168.100.254
add chain=prerouting action=mark-routing new-routing-mark="out_Hinet_Static"
passthrough=no src-address=192.168.100.151-192.168.100.199
gfx wrote:
您對標記路由的使用...(恕刪)
add chain=prerouting action=mark-routing new-routing-mark="out_Hinet_Dyn"
passthrough=no src-address=192.168.100.2-192.168.100.150
add chain=prerouting action=mark-routing new-routing-mark="out_Hinet_Dyn"
passthrough=no src-address=192.168.100.200-192.168.100.254
add chain=prerouting action=mark-routing new-routing-mark="out_Hinet_Static"
passthrough=no src-address=192.168.100.151-192.168.100.199
這三條在terminal輸入的時候會少了src-address的參數,我自己補上了還好。另外在停用mangle的for each迴圈也是失效的,這部分我也自己手動處理ok。
mangle輸入之後最直接的改變就是兩個WAN都能連線VPN了。

我看了一下mangle內容
1.對不同WAN出口的連線進行mark
2.連線mark之後,進行routing mark
3.對來自LAN並且帶有mark的連線封包進行routing mark
4.對來自不同WAN Src.的封包進行routing mark
最後一段就和我原本的routing mark相同動作。
我重新看了一下packet flow
http://wiki.mikrotik.com/wiki/Manual:Packet_Flow
但我不是很了解為何要進行connection mark,請問是否有推薦的參考資料?
My Blog -> 白髮.青春 http://www.blogger.idv.tw/
WilliamTai wrote:
我看了一下mangle內容
1.對不同WAN出口的連線進行mark
2.連線mark之後,進行routing mark
3.對來自LAN並且帶有mark的連線封包進行routing mark
4.對來自不同WAN Src.的封包進行routing mark
最後一段就和我原本的routing mark相同動作。
我重新看了一下packet flow
http://wiki.mikrotik.com/wiki/Manual:Packet_Flow
但我不是很了解為何要進行connection mark,請問是否有推薦的參考資料?
如果有明確的 Source Address 或 Input Interface,是可以直接設定 Mark Routing 而不用先 Mark Connection。Mark Connection 是為了其他在 routing 前的後續動作使用,譬如 Mark Packet。
WilliamTai wrote:foreach i=[/ip firewall mangle find chain="prerouting"||chain="output"] \
add chain...(恕刪)
do={/ip firewall mangle disable $i}
這應該是極閘運算的問題,改成
foreach i=[/ip firewall mangle find (chain="prerouting"||chain="output")] \
do={/ip firewall mangle disable $i}
這樣就不會出包了.
路由沒問題應該是Hinet_Dyn 與Hinet_Static-list順利更新,
很高興解決您的問題

Mangle最後3行標記,即您的設定對VPN連入影響幾近為0.
它的影響只有VPN-Client連線後,對外的Public地址是Hinet Dyn或Static.
與其說是少了src-address的參數,其實更確切形容是根本沒必要.
就算這3行標記刪除,對VPN使用一點影響也沒有.
倒數4&5 Mangle則是作用於Site-to-Site ,與您VPN-Client連入無關.
但是Router對其它VPN-Server連接,則承擔著關鍵成敗.
內文搜尋

X