Cara Setting NAT IP Public via Tunnel (SSTP / L2TP) ke IP Lokal Server di MikroTik

Diposting pada
Pada beberapa kasus, IP Public tidak langsung didapat dari ISP,
melainkan berasal dari tunnel (SSTP / L2TP).
IP Public tersebut kemudian digunakan untuk mengakses
server lokal (Ubuntu, Docker, WordPress, WhatsApp Gateway).

Tutorial ini membahas cara NAT IP Public dari tunnel
ke IP lokal server menggunakan MikroTik.


Skema Topologi

Internet
   |
VPS / ISP
   |
Tunnel (SSTP / L2TP)
   |
[MikroTik]
   |
LAN
   |
Server (192.168.1.11)

Contoh Data

  • Interface Tunnel: sstp-out1
  • IP Public Tunnel: 151.xxx.xxx.xxx
  • IP Server Lokal: 192.168.1.11

Persiapan

  • Tunnel SSTP / L2TP sudah Connected
  • IP Public sudah muncul di interface tunnel
  • Server lokal menggunakan IP statis

Cek tunnel:

/interface sstp-client print
/interface l2tp-client print

Step 1 – NAT All Port dari Tunnel ke Server

Metode ini mengarahkan SEMUA PORT
dari IP Public tunnel ke server lokal.

/ip firewall nat add \
chain=dstnat \
in-interface=sstp-out1 \
action=dst-nat \
to-addresses=192.168.1.11

Dengan rule ini, server bisa diakses langsung via IP Public tunnel.


Step 2 – NAT Port Tertentu (Lebih Aman)

Contoh port penting:

  • HTTP → 80
  • HTTPS → 443
  • SSH → 22

Contoh NAT HTTPS:

/ip firewall nat add \
chain=dstnat \
protocol=tcp \
dst-port=443 \
in-interface=sstp-out1 \
action=dst-nat \
to-addresses=192.168.1.11 \
to-ports=443

Step 3 – Masquerade ke Tunnel (WAJIB)

Tanpa masquerade, koneksi tidak akan balik ke client.

/ip firewall nat add \
chain=srcnat \
out-interface=sstp-out1 \
action=masquerade

Step 4 – Allow Forward (Jika Diperlukan)

Jika firewall filter ketat, tambahkan rule allow forward:

/ip firewall filter add \
chain=forward \
in-interface=sstp-out1 \
action=accept

Step 5 – Cek Rule NAT & Filter

/ip firewall nat print
/ip firewall filter print

Pastikan:

  • dst-nat berada di atas
  • masquerade aktif
  • interface tunnel benar

Test Akses Server

Akses dari luar jaringan:

http://IP-PUBLIC-TUNNEL
https://IP-PUBLIC-TUNNEL

Jika berhasil, NAT via tunnel sudah aktif.


Troubleshooting Umum

  • IP Public harus benar-benar berada di interface tunnel
  • Pastikan VPS / endpoint tunnel mengizinkan port tersebut
  • Server lokal tidak memblokir firewall
  • Gunakan torch untuk cek trafik

Cek trafik:

/tool torch sstp-out1

Kapan NAT All Port Dipakai?

  • Belajar server
  • Homelab
  • Colocation mini

Untuk produksi serius, gunakan NAT per-port + firewall ketat.


Cocok untuk Colocation Mini

Metode ini sangat umum digunakan untuk
IP Public sewa via tunnel
pada layanan Colocation Mini.


Penutup

Dengan NAT IP Public via tunnel, server lokal bisa diakses
dari internet meskipun tidak mendapat IP Public langsung dari ISP.

Tutorial lanjutan MikroTik:

  • Firewall aman untuk server via tunnel
  • NAT IP tambahan (1:1)
  • Monitoring koneksi tunnel

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *