由于使用了双软路由,ROS上设置upnp,端口不能实现自动转发,所以使用ROS的jump方式来实现这个功能。

  1. 首先在ROS功能界面打开 IP → Firewall → NAT
image-20201125232043901
  1. 添加一个 NAT 规则 (设置jump)

    1️⃣ General 设置

    image-20201125232323939

    2️⃣ Action 设置

    image-20201125232515115
  2. 设置需要的端口转发

    1️⃣ 添加一个 NAT 规则 (General 设置)

    image-20201125233019443

    2️⃣ Action 设置

    image-20201125233236947

    到此端口转发就设置完成。

  3. 番外

    由于公网每次拨号,可能导致公网地址会发生改变,这里使用ROS的脚本来实现自动设置JUMP里面的公网地址。

    1️⃣ 在ROS界面 System → scripts 添加一个脚本

    image-20201125234013781

    2️⃣ 设置脚本

    image-20201125234414683

    script脚本代码:

    :global addold
    :global addnew
     :set addnew [/interface get [/interface find name="pppoe-out1"] running]
     :if ($addnew=true) do={
      :set addold [/ip address get [/ip address find dynamic=yes interface="pppoe-out1"] address]
      :set addold [:pick $addold 0 ([:len $addold ] -3)]
       /ip firewall nat set [/ip firewall nat find comment="dynamic_nat"] dst-address=$addold
    }
    

    3️⃣ 设置一个定时Profile

    ROS界面 → PPP → Profiles 添加一个新的Profile

    image-20201125234658556

    设置Profiles

    image-20201125234911018

    设置 Scripts

    image-20201125235117699

    profile脚本代码:

    delay 3s
    :execute "dynamic_nat"
    

🌈以上,公网端口转发的jump设置全部设置完毕,如果过程有错误的地方,还请各位指教一起讨论,谢谢。💨