Resep

Menghapus pengaturan ForestVPN lama dari MikroTik

Satu skrip menghapus pengaturan lama dengan container qproxy dan antarmuka WireGuard fvpn0, beserta kill switch dan aturan mangle-nya, agar aplikasi ForestVPN bisa terpasang dengan bersih.

Diperbarui 19 November 2026

Di halaman ini (7)

Yang Anda dapatkan

Pengaturan ForestVPN sebelumnya hilang: container qproxy, antarmuka WireGuard fvpn0, daftar alamat under_fvpn, tabel perutean fvpn beserta aturan “ForestVPN Kill Switch”-nya, dan aturan mangle mereka. Jika dibiarkan, kill switch dan aturan mangle itu terus mengarahkan LAN Anda ke terowongan yang sudah tidak ada, sehingga instalasi menolak berjalan selama salah satunya masih ada. Skrip ini ditempel terpisah, sebelum instalasi.

Sebelum memulai

  • Perangkat: MikroTik yang masih memiliki pengaturan ForestVPN sebelumnya. Tidak yakin? Tempel saja skripnya: di router yang tidak memilikinya, skrip akan mengatakannya dan tidak mengubah apa pun.
  • Firmware: RouterOS 7.21 atau lebih baru, dengan paket container dan mode perangkat container yang aktif.
  • Waktu: lima menit.
  • Yang bisa bermasalah: LAN tidak punya terowongan antara penghapusan dan tersambungnya container baru. Akun dari pengaturan lama tidak ikut terbawa: tautkan router lagi dengan kode (kode pemasangan muncul di /log).

Langkah

  1. Tempel ini ke terminal router (WinBox atau WebFig, New Terminal).

    Menghapus pengaturan ForestVPN sebelumnya

    {
    :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/."
    }
    }

    Skrip menyimpan konfigurasi Anda ke forestvpn-before-removal.rsc, menghapus tepat objek-objek yang disebut di atas, membiarkan bridge containers yang masih dipakai container lain (beserta alamat dan masquerade 172.17.0.0/24-nya, yang juga dibuat panduan container MikroTik sendiri), dan memeriksa bahwa tidak ada yang tersisa. Skrip berakhir dengan “the previous setup is removed”.

  2. Tempel instalasi dari Ambil aplikasinya → Router, dengan pengaturan yang Anda pilih di atasnya.

Memeriksa hasilnya

Tidak satu pun dari qproxy, under_fvpn, atau fvpn0 boleh muncul di ekspor, begitu pula 172.17.0. kecuali container lain masih memakai bridge containers.

Menampilkan seluruh konfigurasi

/export terse

Membatalkannya

Ekspor yang tersimpan adalah catatan, bukan cadangan: rahasia tidak ada di dalamnya. Untuk kembali, tambahkan lagi objek darinya secara manual, atau impor di router yang sudah di-reset.

Mengimpor konfigurasi yang tersimpan

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

Jika ada yang salah

GejalaPenyebabSolusi
Instalasi menampilkan “this router still has the previous ForestVPN setup”Pengaturan lama masih adaTidak ada yang diubah. Tempel skrip di langkah 1, lalu instalasinya lagi.
“the previous setup could not be removed completely”Masih ada sesuatu yang disesuaikan secara manualBaca /export dan hapus sisanya menurut nama, lalu tempel skripnya lagi.
LAN tidak punya internet setelah penghapusanContainer baru belum tersambungTunggu halaman status, atau tautkan router dari ponsel dengan data seluler. Lihat pemecahan masalah.

Batasan

  • Skrip hanya mencari nama-nama di atas: pengaturan lama yang disesuaikan secara manual perlu /export dibaca oleh seseorang.
  • Skrip tidak membawa akun lama. Tautkan router lagi dengan kode.
  • Skrip menghapus bridge containers, alamat, dan masquerade-nya hanya jika tidak ada hal lain di atasnya.

Kembali ke Bantuan

Kembali ke atas

Tanyakan apa saja pada kami