Automatic add routes when PPTP client connects to PPTP server
Lama blm sempet update dan bikin catatan yang maksud dan tujuan nya adalah menambahkan static route di PPTP server ketika PPTP clinet konek karena ini di pake untuk site to site, berjalan baik di centos dan debian
Site 1 (pptp server) debian 9
ip pub = 103.xx.xx.xx
ip pptp server = 10.101.1.1
Lan site 1 = 10.10.0.0/24
Site 2 (pptp client) mikrotik
ip pub = 103.xx.xx.xx
ip pptp client = 10.101.1.10
Lan site 2 = - 192.168.0.0/24
- 192.168.2.0/24
- 192.168.25.0/24
Site 3 (pptp client) mikrotik
ip pub = 103.xx.xx.xx
ip pptp client = 10.101.1.15
Lan site 3 = 192.168.10.0/24
Langsung saja bikin file di /etc/ppp/ip-up.local yang isi nya sbb
#!/bin/bash
case "$5" in
10.101.1.10)
/sbin/route add -net 192.168.0.0/24 gw 10.101.1.10
/sbin/route add -net 192.168.2.0/24 gw 10.101.1.10
/sbin/route add -net 192.168.25.0/24 gw 10.101.1.10
;;
esac
dimana $5 adalah ip tujan remote untuk debian bisa baca di /etc/ppp/ip-up
berikut cuplikan nya file /etc/ppp/ip-up
# This script is called with the following arguments:
# Arg Name Example
# $1 Interface name ppp0
# $2 The tty ttyS1
# $3 The link speed 38400
# $4 Local IP number 12.34.56.78
# $5 Peer IP number 12.34.56.99
# $6 Optional ``ipparam'' value foo
root@debian:/home# /etc/init.d/pptpd restart
connect dan di connect pptp clinet cek hasil route nya
root@debian:/home# route -n
untuk multi multi client misal site 1 site 2 dan site 3 sbb
#!/bin/bash
case "$5" in
10.101.1.10)
/sbin/route add -net 192.168.0.0/24 gw 10.101.1.10
/sbin/route add -net 192.168.2.0/24 gw 10.101.1.10
/sbin/route add -net 192.168.25.0/24 gw 10.101.1.10
;;
10.101.1.15)
/sbin/route add -net 192.168.10.0/24 gw 10.101.1.10
;;
*)
esac
Thank u
Site 1 (pptp server) debian 9
ip pub = 103.xx.xx.xx
ip pptp server = 10.101.1.1
Lan site 1 = 10.10.0.0/24
Site 2 (pptp client) mikrotik
ip pub = 103.xx.xx.xx
ip pptp client = 10.101.1.10
Lan site 2 = - 192.168.0.0/24
- 192.168.2.0/24
- 192.168.25.0/24
Site 3 (pptp client) mikrotik
ip pub = 103.xx.xx.xx
ip pptp client = 10.101.1.15
Lan site 3 = 192.168.10.0/24
Kurang lebih topologi nya sbb
Langsung saja bikin file di /etc/ppp/ip-up.local yang isi nya sbb
#!/bin/bash
case "$5" in
10.101.1.10)
/sbin/route add -net 192.168.0.0/24 gw 10.101.1.10
/sbin/route add -net 192.168.2.0/24 gw 10.101.1.10
/sbin/route add -net 192.168.25.0/24 gw 10.101.1.10
;;
esac
dimana $5 adalah ip tujan remote untuk debian bisa baca di /etc/ppp/ip-up
berikut cuplikan nya file /etc/ppp/ip-up
# This script is called with the following arguments:
# Arg Name Example
# $1 Interface name ppp0
# $2 The tty ttyS1
# $3 The link speed 38400
# $4 Local IP number 12.34.56.78
# $5 Peer IP number 12.34.56.99
# $6 Optional ``ipparam'' value foo
root@debian:/home# /etc/init.d/pptpd restart
connect dan di connect pptp clinet cek hasil route nya
root@debian:/home# route -n
untuk multi multi client misal site 1 site 2 dan site 3 sbb
#!/bin/bash
case "$5" in
10.101.1.10)
/sbin/route add -net 192.168.0.0/24 gw 10.101.1.10
/sbin/route add -net 192.168.2.0/24 gw 10.101.1.10
/sbin/route add -net 192.168.25.0/24 gw 10.101.1.10
;;
10.101.1.15)
/sbin/route add -net 192.168.10.0/24 gw 10.101.1.10
;;
*)
esac
Thank u
Komentar
Posting Komentar