✅ 实现方式概览(智能 + 自动 + 回流)
1️⃣ 定时脚本自动将 pppoe-out1
的地址写入 address-list:
/system script
add name=update-wan-ip policy=read,write source="
:local current [/ip address get [find interface=pppoe-out1] address];
:local ip [:pick \$current 0 [:find \$current \"/\"]];
/ip firewall address-list remove [find list=wan-ip];
/ip firewall address-list add list=wan-ip address=\$ip timeout=1h;
"
# 每10分钟更新一次
/system scheduler
add name=update-wan-ip interval=10m on-event=update-wan-ip
2️⃣ 然后配合这条 dst-nat
:
/ip firewall nat
add chain=dstnat dst-address-list=wan-ip protocol=tcp dst-port=5000,5001,5002,9091 \
action=dst-nat to-addresses=10.10.10.66 comment="智能公网IP映射"