وصفة

إزالة إعداد ForestVPN القديم من موجّه MikroTik

سكربت واحد يزيل الإعداد القديم بحاوية qproxy وواجهة WireGuard fvpn0، مع مفتاح الإيقاف (kill switch) وقواعد mangle، ليُثبَّت تطبيق ForestVPN بنظافة.

آخر تحديث: 19 نوفمبر 2026

في هذه الصفحة (7)

ما الذي تحصل عليه

يختفي إعداد ForestVPN السابق: حاوية qproxy، وواجهة WireGuard fvpn0، وقائمة العناوين under_fvpn، وجدول التوجيه fvpn مع قاعدته “ForestVPN Kill Switch”، وقواعد mangle الخاصة بها. لو بقيت، لظلّ هذا الـ kill switch وقواعد mangle هذه توجّه شبكتك المحلية إلى نفق لم يعد موجودًا، لذلك يرفض التثبيت العمل ما دام شيء منها قائمًا. هذا السكربت يُلصق على حدة، قبل التثبيت.

قبل أن تبدأ

  • الجهاز: موجّه MikroTik ما زال فيه إعداد ForestVPN السابق. لست متأكدًا؟ الصق السكربت على أي حال: على موجّه لا يوجد فيه ذلك الإعداد يقول ذلك ولا يغيّر شيئًا.
  • البرنامج الثابت: RouterOS 7.21 أو أحدث، مع الحزمة container وتفعيل وضع الجهاز للحاويات.
  • الوقت: خمس دقائق.
  • ما قد يسوء: لا يكون للشبكة المحلية نفق بين الإزالة واتصال الحاوية الجديدة. ولا ينتقل حساب الإعداد القديم: اربط الموجّه من جديد برمز (يظهر رمز الاقتران في /log).

الخطوات

  1. الصق هذا في طرفية الموجّه (WinBox أو WebFig، New Terminal).

    يزيل إعداد ForestVPN السابق

    {
    :local old [:toarray ""]
    :if ([:len [/container/find where name~"qproxy"]] > 0) do={ :set old ($old , "the qproxy container") }
    :if ([:len [/interface/wireguard/find where name="fvpn0"]] > 0) do={ :set old ($old , "WireGuard interface fvpn0") }
    :if ([:len [/ip/firewall/address-list/find where list="under_fvpn"]] > 0) do={ :set old ($old , "address list under_fvpn") }
    :if ([:len [/routing/table/find where name="fvpn"]] > 0) do={ :set old ($old , "routing table fvpn") }
    :if ([:len [/routing/rule/find where table="fvpn" or comment~"ForestVPN Kill Switch"]] > 0) do={ :set old ($old , "the ForestVPN Kill Switch rule") }
    :if ([:len [/ip/firewall/mangle/find where src-address-list="under_fvpn" or connection-mark="under_fvpn" or out-interface="fvpn0" or in-interface="fvpn0"]] > 0) do={ :set old ($old , "its mangle rules") }
    :if ([:len [/interface/list/member/find where interface="fvpn0"]] > 0) do={ :set old ($old , "fvpn0 in an interface list") }
    :if ([:len $old] = 0) do={ :put "ForestVPN: this router has no previous ForestVPN setup. Nothing was changed." }
    :if ([:len $old] > 0) do={
    :put ("ForestVPN: removing the previous ForestVPN setup: " . [:tostr $old] . ". Your configuration before this is saved as forestvpn-before-removal.rsc.")
    /export file=forestvpn-before-removal
    :foreach c in=[/container/find where name~"qproxy"] do={
    :do { /container/stop $c } on-error={}
    :local n 0
    :while ([/container/get $c running] && $n < 30) do={ :delay 1s; :set n ($n + 1) }
    :delay 2s
    /container/remove $c
    }
    # A mark into table fvpn, which goes below, would route by the main table, out the WAN, once it is gone.
    /ip/firewall/mangle/remove [find where src-address-list="under_fvpn" or connection-mark="under_fvpn" or out-interface="fvpn0" or in-interface="fvpn0" or (chain="prerouting" and action="accept" and dst-address="192.168.88.1") or new-routing-mark="fvpn"]
    /ipv6/firewall/mangle/remove [find where src-address-list="under_fvpn" or connection-mark="under_fvpn"]
    /routing/rule/remove [find where table="fvpn" or comment~"ForestVPN Kill Switch"]
    /ip/route/remove [find where routing-table="fvpn"]
    /ipv6/route/remove [find where routing-table="fvpn"]
    /interface/wireguard/peers/remove [find where interface="fvpn0"]
    /interface/list/member/remove [find where interface="fvpn0"]
    /ip/address/remove [find where interface="fvpn0"]
    /ipv6/address/remove [find where interface="fvpn0" and !dynamic]
    /interface/wireguard/remove [find where name="fvpn0"]
    /routing/table/remove [find where name="fvpn"]
    /ip/firewall/address-list/remove [find where list="under_fvpn"]
    /interface/bridge/port/remove [find where interface~"veth-qproxy"]
    /interface/veth/remove [find where name~"veth-qproxy"]
    # The "containers" bridge, its address and its 172.17.0.0/24 masquerade only if nothing else is
    # still on it: MikroTik's own container guide uses the same names, so other containers may share them.
    :if ([:len [/interface/bridge/find where name="containers"]] = 1 and [:len [/interface/bridge/port/find where bridge="containers"]] = 0) do={
    /ip/firewall/nat/remove [find where src-address="172.17.0.0/24"]
    /ip/address/remove [find where interface="containers"]
    /interface/list/member/remove [find where interface="containers"]
    /interface/bridge/remove [find where name="containers"]
    }
    # The same check the install makes before it runs.
    :if ([:len [/container/find where name~"qproxy"]] + [:len [/interface/wireguard/find where name="fvpn0"]] + [:len [/ip/firewall/address-list/find where list="under_fvpn"]] + [:len [/routing/table/find where name="fvpn"]] + [:len [/routing/rule/find where comment~"ForestVPN Kill Switch"]] > 0) do={ :error "ForestVPN: the previous setup could not be removed completely. See /export and fvpn.net/help/mikrotik-remove-old/." }
    :put "ForestVPN: the previous setup is removed. Now paste the install from fvpn.net/download/mikrotik/."
    }
    }

    يحفظ إعدادك في forestvpn-before-removal.rsc، ويزيل الكائنات المذكورة أعلاه بالضبط، ويترك الجسر containers إن كانت حاويات أخرى ما زالت تستخدمه (مع عنوانه وإخفاء العنوان (masquerade) 172.17.0.0/24، وهو ما يُنشئه أيضًا دليل الحاويات الرسمي من MikroTik)، ويتحقق من أنه لم يبقَ شيء. وينتهي بعبارة “the previous setup is removed”.

  2. الصق التثبيت من احصل على التطبيق: الموجّه، مع الإعدادات التي اخترتها فوقه.

التحقق من نجاح العملية

يجب ألا يظهر أيٌّ من qproxy أو under_fvpn أو fvpn0 في التصدير، ولا 172.17.0. إلا إذا كانت حاويات أخرى ما زالت تستخدم الجسر containers.

يعرض الإعداد كاملًا

/export terse

التراجع

التصدير المحفوظ سجلّ وليس نسخة احتياطية: الأسرار ليست فيه. وللرجوع، أعد إضافة الكائنات منه يدويًا، أو استورده على موجّه أُعيدت تهيئته.

يستورد الإعداد المحفوظ

/import file-name=forestvpn-before-removal.rsc

إذا حدث خطأ

العَرَضالسببالحل
يقول التثبيت “this router still has the previous ForestVPN setup”الإعداد القديم ما زال موجودًالم يتغيّر شيء. الصق سكربت الخطوة 1، ثم التثبيت مرة أخرى.
“the previous setup could not be removed completely”ما زال هناك شيء مُعدَّل يدويًااقرأ /export وأزل ما تبقّى بالاسم، ثم الصق السكربت من جديد.
لا إنترنت في الشبكة المحلية بعد الإزالةلم تتصل الحاوية الجديدة بعدانتظر صفحة الحالة، أو اربط الموجّه من هاتف على بيانات الجوال. راجع استكشاف الأخطاء.

الحدود

  • يبحث عن الأسماء المذكورة أعلاه فقط: الإعداد القديم المُعدَّل يدويًا يحتاج إلى شخص يقرأ /export.
  • لا ينقل الحساب القديم. اربط الموجّه من جديد برمز.
  • يزيل الجسر containers وعنوانه وإخفاء العنوان (masquerade) الخاص به فقط حين لا يكون عليه شيء آخر.

العودة إلى المساعدة

العودة إلى الأعلى

اسألنا أي شيء