How to share VPN connection over LAN using Mikrotik Router OS?

In this tutorial I’m going to discuss about sharing a VPN connection (PPTP) over LAN using Mikrotik Router OS.

VPN Setup – Mikrotik

This is useful in many cases where you are a premium VPN subscriber and want to share the service over LAN.

Script for configuration :

[admin@MikroTik] > /export
# aug/11/2013 15:58:05 by RouterOS 6.0
# software id = 
/interface pptp-client
add connect-to= disabled=no name=pptp-out1 password=a user=a
/interface ethernet
set 0 mac-address=00:0C:29:4C:AB:51 name=LAN
set 1 mac-address=00:0C:29:4C:AB:47 name=WAN
/ip hotspot user profile
set [ find default=yes ] idle-timeout=none keepalive-timeout=2m mac-cookie-timeout=3d
/ip pool
add name=dhcp_pool1 ranges=,
/ip dhcp-server
add address-pool=dhcp_pool1 disabled=no interface=LAN name=dhcp1
set 0 name=serial0
set 1 name=serial1
/ip address
add address= interface=WAN network=
add address= interface=LAN network=
/ip dhcp-server network
add address= dns-server= gateway=
/ip firewall mangle
add action=mark-routing chain=prerouting new-routing-mark=vpn src-address=
/ip firewall nat
add action=masquerade chain=srcnat out-interface=pptp-out1
/ip route
add distance=1 gateway=pptp-out1 routing-mark=vpn
add check-gateway=ping distance=1 gateway=

Interfaces :

WAN – Connected to Internet
LAN – Connected to Local Area
pptp-out – VPN Connection

This is the first experimental setup which I did. Feel free to correct any mistake if you find any. Thanks šŸ™‚


Enjoyed this post? Share it!