內網 ping 不到路由, 但是可以 src nat 出去
各位大大,請教一個奇怪的環境問題,我配置了一台 routeros 2.9.6 + 4 網卡
分別叫做 dot1-wan, dot1-lan, dot2-wan, 跟 dot2-lan
dot1-lan ip 設定為 192.168.1.254
dot2-lan ip 設定為 192.168.2.254
dot-1 wan 設定為 pppoe-out1, 走 ADSL, 為 A.B.C.D
dot2-wan 設定為固定 IP, 為 E.F.G.H
因為想要 dot1-lan 走 dot1-wan, dot2-lan 走 dot2-wan
因此在 mangle 跟 route 做了處理, 如下:
ip firewall mangle add chain=prerouting src-address=192.168.1.0/24 action=mark-routing new-routing-mark=dot1-route passthrough=yes
ip firewall mangle add chain=prerouting src-address=192.168.2.0/24 action=mark-routing new-routing-mark=dot2-route passthrough=yes
ip route add gateway=A.B.C.D routing-mark=dot1-route
ip route add gateway=E.F.G.H routing-mark=dot2-route
ip route add gateway=E.F.G.H #default gateway
ip firewall nat add chain=srcnat out-interface=pppoe-out1 src-address=192.168.1.0/24 action=masquerade
ip firewall nat add chain=srcnat out-interface=dot2-wan src-address=192.168.2.0/24 action=masquerade
目前 dot1-lan, dot-2wan 內部用 masquerade 方式出去都很正常
問題在
1. dot1-lan 內部 ping不到 dot2-wan, 但是 dot1-lan 內部 ping 的到 dot1-wan
2. dot2-lan 內部 ping不到 dot2-wan, 但是 dot2-lan 內部 ping 的到 dot1-wan
why ?
附上設定檔, 還請各位大大解謎了 大致看了一下,你想達到什么效果。 2.9.6和2.9.27好象在这个方面的用法上面有点不一样的,只用过2.9.27
ping不通,有可能是禁止了ping路由器,把防火墙里的规则检查一下,不知道具体用途和影响的规则,最好不要用
回复 2# 的帖子
後來檢查了一下 nat 裡面的東西, 發現如果設定那兩條 srcnat masquerade 的話是可以 ping 的到 dot1-wan 跟dot2-wan 的
我想要的是
既然是固定 ip, 我想在內部架設一些服務器, 例如網頁服務器什麼的, 然後用 dst-nat 穿出去
假設內部 web server ip 為 192.168.2.200( dot2 lan 內 )
那麼
1. 對於從外部來的 ip 要如何設定 dst-nat ?
2. 對於從內部來的 ip 要如何設定 dst-nat ?
困惑了, 搞不懂要怎麼做:L
回复 4# 的帖子
上面的寫錯了非常奇怪, 會有時 ping 不到, 然後又有時 ping 的到
不知道為什麼, 連發生什麼狀況都不知道 :')
可否有高手指點迷津 ? 根据你的接口名,我判断你大概是有3个内网,和3个出口。
看你的路由表:/ ip route
add dst-address=0.0.0.0/0 gateway=220.128.122.254 scope=255 target-scope=10 \
routing-mark=dot2-route comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=114.44.128.254 scope=255 target-scope=10 \
routing-mark=dot1-route comment="" disabled=no
add dst-address=0.0.0.0/0 gateway=220.128.122.254 scope=255 target-scope=10 \
comment="" disabled=no 并没有dot1、dot2、dot3之间的路由,只有这么3条默认路由,所以你3个内网不能互通。至于你说的 有時 ping 不到, 然後又有時 ping 的到,我猜是ISP的问题,因为根据第三个路由条目,你的192.168.3.0/24会被发送到220.128.122.254上。
这个我也很奇怪,怎么会有C类内网地址,比如说我所在地区:C:\Documents and Settings\yy_admin>ipconfig/all
Windows IP Configuration
Host Name . . . . . . . . . . . . : 004
Primary Dns Suffix. . . . . . . :
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Ethernet adapter 本地连接 4:
Connection-specific DNS Suffix. :
Description . . . . . . . . . . . : DiskOnlan DNA network Adapter
Physical Address. . . . . . . . . : 00-E0-4C-14-95-9B
Dhcp Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.0.4
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.254
DNS Servers . . . . . . . . . . . : 202.96.64.68
202.96.69.38
C:\Documents and Settings\yy_admin>C:\Documents and Settings\yy_admin>tracert 172.16.254.254 -d
Tracing route to 172.16.254.254 over a maximum of 30 hops
1 <1 ms <1 ms 1 ms192.168.0.254
2 1 ms 1 ms 1 ms218.25.70.45
3 1 ms <1 ms 1 ms218.25.3.29
4 2 ms 3 ms 2 ms218.25.3.254
5 4 ms 4 ms 7 ms168.168.0.62
6 3 ms 2 ms 2 ms172.16.254.254
Trace complete.
C:\Documents and Settings\yy_admin>要使你的内网能互通,加上相应的路由条目。
这是对外的映射,大概是这样,因为在外面没有ros不知道有没有语法错误。/ip fi nat dst-add=220.128.122.241 dst-port=80 action=dst-nat to-address=192.168.2.200 to-port=80
页:
[1]