Skip to content

Instantly share code, notes, and snippets.

@gilangvperdana
Last active May 8, 2023 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gilangvperdana/a7da6889a71c2b26baf427ad8c2ba767 to your computer and use it in GitHub Desktop.
Save gilangvperdana/a7da6889a71c2b26baf427ad8c2ba767 to your computer and use it in GitHub Desktop.
PPTP (Point to Point Tunneling Protocol Virtual)

Mikrotik PPTP Server Creates

  • Aktifkan fitur PPTP VPN Server Mikrotik. Masuk ke menu PPP --> Pada Tab Interface --> Klik PPTP Server --> Centang kotak Enabled --> OK
  • Selanjutnya kita buat User PPTP VPN nya. Masuk ke tab Secret --> Klik Tombol + --> Isikan Data Sebegai Berikut :
    • Name : Username PPTP VPN nya
    • Password : Password PPTP VPN nya
    • Service : Pilih service yang digunakan, bisa pilih pptp atau pilih any saja.
    • Profile : Pilih profile yang akan digunakan, pilih default-encryption saja.
    • Local Address : IP Address yang akan digunakan oleh PPTP VPN Server
    • Remote Address : IP Address yang akan diberikan kepada PPTP VPN Client

Ubuntu PPTP Client

sudo apt-get update
cd /etc/ppp/peers
apt install pptp-linux
touch PPTP
nano /etc/ppp/peers/PPTP
pty "pptp Your_Server_IP --nolaunchpppd --debug"
name Your_Username
password Your_Password
remotename PPTP
require-mppe-128
require-mschap-v2
refuse-eap
refuse-pap
refuse-chap
refuse-mschap
noauth
debug
persist
maxfail 0
defaultroute
replacedefaultroute
usepeerdns
chmod 600 /etc/ppp/peers/PPTP
  • Activate PPTP
pon PPTP
  • Deactivate PPTP
poff PPTP
  • Verify
ifconfig ppp0

tail -f /var/log/syslog | grep pptp
  • Auto Start PPTP Create an .sh, then point it every minute on cronjob.
#!/bin/bash

# Check PPTP
if [[ $(ifconfig | grep ppp) ]]; then
    echo "VPN sudah terkoneksi"
    exit
fi

# Create a new Connection
sudo pon PPTP
  • Route Pool behind PPTP Server
    • Assume :
      • 192.168.0.0/24 are network we are want to reach
      • 10.20.30.1 are gateway from ppp0
      • ppp0 are interface name who created from ppp client
      ip route 192.168.0.0/24 via 10.20.30.1 dev ppp0
      

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment