找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: javen520

[其它] [原创] 正确 映射 + 回流 (有图)

[复制链接]
发表于 2007-11-27 12:42:21 | 显示全部楼层
请问怎样让内网的机子通过域名访问在服务器上显示内网机子的IP,而不是网关IP,这个问题困扰我好久了,一真没有解决.
routeros
回复

使用道具 举报

发表于 2007-12-15 16:47:59 | 显示全部楼层
做个记号,学习一下
routeros
回复

使用道具 举报

发表于 2007-12-15 22:29:12 | 显示全部楼层

回复 6# 的帖子

你说的没错,同样的问题,就是解决不了.
routeros
回复

使用道具 举报

发表于 2007-12-17 01:44:18 | 显示全部楼层
/ip fir nat add chain=srcnat out-interface=wan action=masquerade
/ip fir nat add chain=dstnat dst-address=61.61.61.61 protocol=tcp dst-port=80 action=dstnat to-address=192.168.0.200
/ip fir nat add chain=srcnat src-address=192.168.0.0/24 dst-address=192.168.0.200 protocol=tcp dst-port=80 action=srcnat to-address=1.2.3.4
routeros
回复

使用道具 举报

发表于 2007-12-17 10:53:09 | 显示全部楼层
哈哈.不錯..學習ing.
routeros
回复

使用道具 举报

发表于 2007-12-17 11:22:02 | 显示全部楼层
不太明白呀。还有得学呢
routeros
回复

使用道具 举报

发表于 2007-12-17 12:28:43 | 显示全部楼层
请问19楼的,这个能解决,内网的机子通过域名访问在服务器上显示内网机子的IP,而不是网关IP吗.
routeros
回复

使用道具 举报

发表于 2008-3-10 23:39:40 | 显示全部楼层
顶。学习中
routeros
回复

使用道具 举报

发表于 2008-3-11 10:55:29 | 显示全部楼层
快速回复主题
选项
routeros
回复

使用道具 举报

发表于 2008-3-11 14:16:30 | 显示全部楼层
学习学习再说
routeros
回复

使用道具 举报

发表于 2008-4-9 23:40:23 | 显示全部楼层
回流的问题,,怎么还是解决不了?
routeros
回复

使用道具 举报

发表于 2008-9-7 16:20:38 | 显示全部楼层
原帖由 javen520 于 2006-6-18 19:44 发表
动态的我倒还没现实做过~`

不过却可以使用脚本 Script 来动态更新 IP ~~`

而且你的路由器一连上 ADSL 就会获取一个 IP ~`你可以将他看成是固定 IP ~`

然后做个脚本~` 监视 ADSL 的 IP ~`只要重新连接发生 I ...

这个说法是对的.我看了很多下面写的方法,我想问你们有没有做过,不要在网上COPY过来加分就好.
我只想更正一下."监视 ADSL 的 IP ~`只要重新连接发生"这样做不好.你监视多常时间监视一次.如果在你监视的时间内以重新连接好,那无法做到你想要的要求了.
小弟有一个方法
      映谢可以用脚本建立删除修改.当我用修改好了.在一定的时间内不理ADSL外网IP有没有变,对映射进行修改.这样不用去监视ADSL.我个我不是说说.我是动手做过.常期时间下成功
我先把网上的做法COPY出来.
             1.端口映射:
winbox中
system->scripts中添加名字为add-nat,内容如下:

#script add-nat
:log info "Add-Nat: Sending Dynamic NAT  update  Begin"
/ip firewall nat add chain=dstnat dst-address=[ /ip address get [/ip address find interface=pppoe-out] address ] protocol=tcp dst-port=80 action=dst-nat to-addresses=192.168.0.57 to-ports=80 comment="WEB"
/ip firewall nat add chain=dstnat dst-address=[ /ip address get [/ip address find interface=pppoe-out] address ] protocol=tcp dst-port=110 action=dst-nat to-addresses=192.168.0.57 to-ports=110 comment="OP"
/ip firewall nat add chain=dstnat dst-address=[ /ip address get [/ip address find interface=pppoe-out] address ]  protocol=tcp dst-port=25 action=dst-nat to-addresses=192.168.0.57 to-ports=25 comment="SMTP"
:log info "Add-Nat: Sending Dynamic NAT  update  End Sucess!!!"
#script remove-nat
:log info "remove when ip is down"
/ip firewall nat remove WEB
/ip firewall nat remove POP
/ip firewall nat remove SMTP
/ip firewall nat remove cxhemule
:log info "remove sucessful!!!"
端口映射:
winbox中
system->scripts中添加名字为remove-nat,内容如下:



#script remove-nat

:log info "remove when ip is down"

/ip firewall nat remove WEB
/ip firewall nat remove POP
/ip firewall nat remove SMTP

:log info "remove sucessful!!!"



添加好以上2个脚本后,在 tools->netwatch里面
host:填你当地的dns服务器
interval:00:01:00
timeout:1000ms

up:add-nat
down:remove-nat

填好以后,就开始每interval时间测试该IP是否连通,如果由up->down就执行remove-nat,由down->up就执行add-nat


2.更新DDNS
www.changeip.com申请个免费DDNS


winbox中
system->scripts中添加名字为DDNSUP,内容如下:




:log info "DDNS: Begin"

:global ddns-user "登陆changeip的帐号"
:global ddns-pass "密码"
:global ddns-host "*1"
:global ddns-interface "pppoe拨号的interface我的是pppoe-out"

:global ddns-system ("mt-" . [/system package get [/system package find name=system] version] )

:global ddns-ip [ /ip address get [/ip address find interface=$ddns-interface] address ]

:if ([ :typeof $ddns-lastip ] = nil ) do={ :global ddns-lastip 0.0.0.0/0 }

:if ([ :typeof $ddns-ip ] = nil ) do={

  :log info ("DDNS: No ip address present on " . $ddns-interface . ", please check.")

} else={

  :if ($ddns-ip != $ddns-lastip) do={

    :log info "DDNS: Sending Update!"
    :log info [ /tool dns-update name=$ddns-host address=[:pick $ddns-ip 0 [:find $ddns-ip "/"] ] key-name=$ddns-user key=$ddns-pass ]
    :global ddns-lastip $ddns-ip

  } else={

    :log info "DDNS: No change"

  }

}

:log info "DDNS: End"





在system->scheduler里面添加:


name:ddnsrun
interval:00:30:00
on eventDNSUP



OK,interval:00:30:00 表示30分钟执行一次
on eventDNSUP表示执行DDNSUP这个脚本
以上是网络上的资料
我做了修改
就是不去监视外网是否断线.
不理是否断线了,每多长时间修改一次端口映射就可以了.
怎么做想一想
也可以加我的QQ:88420649
routeros
回复

使用道具 举报

发表于 2008-9-7 19:43:58 | 显示全部楼层
先回贴再看看
routeros
回复

使用道具 举报

发表于 2008-9-18 14:51:53 | 显示全部楼层
新手,看得不明白,不过先顶一下先。。。。
routeros
回复

使用道具 举报

发表于 2008-9-19 09:58:05 | 显示全部楼层
没钱了不能下载了
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-10-1 05:27 , Processed in 0.165085 second(s), 3 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表