|
发表于 2007-4-1 22:26:21
|
显示全部楼层
For ROS 2.9.27 ADSL动态IP的映射和回流了~(修改自网络2.8版本脚本)
#增加上线、断网监控
/ tool netwatch
add host=202.103.225.68 timeout=1s interval=10s up-script=addhuiliu down-script=removehuiliu disabled=no
#添加上线脚本
/system script add name="addhuiliu" source="
#添加外网映射
/ ip firewall nat
add chain=dstnat in-interface=all dst-address=[/ip address get [/ip address find interface= [ /interface find type=pppoe-out ]] address] dst-port=21 protocol=tcp action=dst-nat to-addresses=192.168.2.250 to-ports=21 comment="21" disabled=no
/ ip firewall nat
add chain=dstnat in-interface=all dst-address=[/ip address get [/ip address find interface= [ /interface find type=pppoe-out ]] address] dst-port=80 protocol=tcp action=dst-nat to-addresses=192.168.2.250 to-ports=80 comment="80" disabled=no
#下面做回流
#ftp端口回流
/ ip firewall nat
add chain=srcnat out-interface=lan dst-address=[/ip address get [/ip address find interface= [ /interface find type=pppoe-out ]] address] dst-port=21 protocol=tcp action=src-nat to-addresses=202.96.128.60 to-ports=21 comment="21src" disabled=no
/ ip firewall nat
add chain=dstnat in-interface=lan dst-address=[/ip address get [/ip address find interface= [ /interface find type=pppoe-out ]] address] dst-port=21 protocol=tcp action=dst-nat to-addresses=192.168.2.250 to-ports=21 comment="21dst" disabled=no
#Web端口回流
/ ip firewall nat
add chain=srcnat out-interface=lan dst-address=[/ip address get [/ip address find interface= [ /interface find type=pppoe-out ]] address] dst-port=80 protocol=tcp action=src-nat to-addresses=202.96.128.60 to-ports=80 comment="80src" disabled=no
/ ip firewall nat
add chain=dstnat in-interface=lan dst-address=[/ip address get [/ip address find interface= [ /interface find type=pppoe-out ]] address] dst-port=80 protocol=tcp action=dst-nat to-addresses=192.168.2.250 to-ports=80 comment="80dst" disabled=no "
#添加断网脚本
/system script add name="removehuiliu" source="
#移除外网映射
/ip firewall dst-nat
remove 21
remove 80
#移除回流映射
/ip firewall src-nat
remove 21src
remove 80src
/ip firewall dst-nat
remove 21dst
remove 80dst "
说明:其中端口不用我说了吧,就是21和80,192.168.2.250是要映射到的内网IP,各位自己更改~ 202.103.225.68可以改成任一公网IP,不影响使用~
[ 本帖最后由 qazmlp 于 2007-4-1 22:27 编辑 ] |
|