找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2312|回复: 1

[其它] 關於動態ADSL的端口映射問題

[复制链接]
发表于 2007-10-19 17:10:41 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
最近因需要架設測試郵件服務器.在ros裡用了動態域名.但在映射時遇到一個問題.在NAT裡的Dst.Address裡需要寫入ADSL的IP.但ADSL是隨時變動IP的.根本沒辦法固定..我也找了一些方法,有一些說在In.Interface裡把ADSL的名稱選擇就行.但實際上根本行不動.在這裡還請大家幫幫忙,我本人是想用寫腳本的方法來實現.但水平有限.在這裡還要請教一下大家.
routeros
发表于 2007-10-19 18:39:51 | 显示全部楼层
:global ip [ /ip address get [/ip address find interface=ADSL] address ]
:global new-ip [:pick $ip 0 [:find $ip "/"]]
:global old-ip [/ip fi nat get [/ip fi nat find comment="3389"] dst-address]
:if ($new-ip != $old-ip) do={
        :log info [/ip fi nat set [/ip firewall nat find comment="3389"] dst-address=$new-ip]
        :log info "〖3389映射修改完毕〗"
}

:global ip [ /ip address get [/ip address find interface=ADSL] address ]
:global new-ip [:pick $ip 0 [:find $ip "/"]]
:global old-ip [/ip fi nat get [/ip fi nat find comment="80"] dst-address]
:if ($new-ip != $old-ip) do={
        :log info [/ip fi nat set [/ip firewall nat find comment="80"] dst-address=$new-ip]
        :log info "〖80映射修改完毕〗"
}

:global ip [ /ip address get [/ip address find interface=ADSL] address ]
:global new-ip [:pick $ip 0 [:find $ip "/"]]
:global old-ip [/ip fi nat get [/ip fi nat find comment="bt"] dst-address]
:if ($new-ip != $old-ip) do={
        :log info [/ip fi nat set [/ip firewall nat find comment="bt"] dst-address=$new-ip]
        :log info "〖bt映射修改完毕〗"
}

:global ip [ /ip address get [/ip address find interface=ADSL] address ]
:global new-ip [:pick $ip 0 [:find $ip "/"]]
:global old-ip [/ip fi fil get [/ip fi fil find comment="gj"] dst-address]
:if ($new-ip != $old-ip) do={
        :log info [/ip fi fil set [/ip firewall filter find comment="gj"] dst-address=$new-ip]
        :log info "〖gj规则修改完毕〗"
}

丢到计划任务里,10分钟一次就行了
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-2 06:26 , Processed in 0.042710 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

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