Community discussions

MikroTik App
 
robinpecha
newbie
Topic Author
Posts: 39
Joined: Mon May 10, 2010 12:36 pm

[SOLVED]How to route all traffic to tunnel pptp,eoip,ipsec

Thu Aug 22, 2013 5:26 pm

Hi all.
I've read many posts and tutorials but I can not figure out how to easily solve my situation.

Exactly as it is written:
"While other IPsec howtos fully describe how to set a secure tunnel to get traffic in between two networks, but none of them describe how to get traffic to go over a tunnel where the destination isn’t a network on the remote end."
http://wiki.mikrotik.com/wiki/Routing_t ... over_IPsec
But as is in header of wiki page: "Note: This is currently a work in progress and is not complete."
Important part is missing.

Everybody can setup tunnel but nobody nows how to easily route all traffic through it.

All I want is to that local RB have tunnel connected to the RB in datacenter and I want all Internet traffic went from LAN on local RB then into the data centers RB and then to the Internet and back.
If I setup pptp client on my ubuntu laptop, it works exactly as I wish.
When I did it on those RBs, it does not work and Im trying it for hours.

Please, can somebody help me?
Thank you :cry:

=======================================================================

[EDIT - WORKING SOLUTION:]

PptpPubIp = public ip of PPTP server
PptpIpRemote = remote ip used in pptp tunnel
PptpIpLocal = local ip used in pptp tunnel
LocalWanIp = local ip on WAN interface / could be set by DHCP
LocalWanGw = ip of localy used GATEWAY / could be set by DHCP

ROUTES

Only dhcp on WAN interface enabled:
DST-ADDRESS ____ GATEWAY _____ DISTANCE
0.0.0.0/0 _______ LocalWanGw __ 0
...

Dhcp on WAN and pptp enabled:
DST-ADDRESS ____ GATEWAY ______ DISTANCE
0.0.0.0/0 _______ LocalWanGw ___ 0
0.0.0.0/0 _______ PptpIpRemote __ 1
...

CHANGE DISTANCE OF PPTP DEFAULT ROUTE
/ interface pptp-client set 0 ##chose_your_pptp_interface## add-default-route=yes default-route-distance=2

CHANGE DISTANCE OF DHCP DEFAULT ROUTE
/ ip dhcp-client set 0 add-default-route=yes default-route-distance=3

ADD STATIC ROUTE TO PPTP SERVER
/ ip route add dst-address=PptpPubIp gateway=LocalWanGw distance=1

Dhcp on WAN, enabled pptp and all internet traffic going over tunnel:
DST-ADDRESS ____ GATEWAY _______ DISTANCE
PptpPubIp _______ LocalWanGw ____ 1 (STATIC ROUTE - DISTANCE 1)
0.0.0.0/0 _______ PptpIpRemote ___ 2 (DYNAMIC PPTP ROUTE - DISTANCE 2)
0.0.0.0/0 _______ LocalWanGw ____ 3 (STATIC / DYNAMIC (in case of DHCP) - DISTANCE 3)
...

Uf. Pls check if i wrote it right.
Last edited by robinpecha on Thu Aug 22, 2013 7:07 pm, edited 2 times in total.
 
sergeysi
just joined
Posts: 13
Joined: Mon Aug 19, 2013 6:59 pm

Re: How to route all traffic to tunnel (pptp,eoip,ipsec,...)

Thu Aug 22, 2013 6:02 pm

Do you add "add-default-route" option when you create PPTP client connection? It also has the same name in Winbox/Webfig; you just have to enable the checkbox for it.
 
robinpecha
newbie
Topic Author
Posts: 39
Joined: Mon May 10, 2010 12:36 pm

Re: How to route all traffic to tunnel (pptp,eoip,ipsec,...)

Thu Aug 22, 2013 6:21 pm

No, it didnt help.
Ip on WAN is from dhcp.
DHCP add default gateway with distance 0.
PPTP add default gateway with distance 1. RB is connected to internet, but directly, not over tunnel.
PPTP add default gateway -- with distance 0. Internet is disconnected.

ip address print
_____ ADDRESS ______ NETWORK _ INTERFACE
_____ 1.1.1.1/24 _____ 1.1.1.0 ____ etherLAN
D ___ 10.0.0.25/24 ___ 10.0.0.0 ___ etherWAN
D ___ 10.6.5.2/32 ____ 10.6.5.1 ___ pptp-client

ip route print
# ____ DST-ADDRESS ___ PREF-SRC ___ GATEWAY __ DISTANCE
ADS __ 0.0.0.0/0 ___________________ 10.0.0.1 ____ 0
DS ___ 0.0.0.0/0 ___________________ 10.6.5.1 ____ 1
ADC __ 1.1.1.0/24 ______ 1.1.1.1 _____ etherLAN ___ 0
ADC __ 10.0.0.0/24 _____ 10.0.0.25 ___ etherWAN __ 0
ADC __ 10.6.5.1/32 _____ 10.6.5.2 ____ pptp-client __ 0
Last edited by robinpecha on Thu Aug 22, 2013 6:29 pm, edited 1 time in total.
 
User avatar
nickshore
Long time Member
Long time Member
Posts: 521
Joined: Thu Mar 03, 2005 4:14 pm
Location: Suffolk, UK.
Contact:

Re: How to route all traffic to tunnel (pptp,eoip,ipsec,...)

Thu Aug 22, 2013 6:25 pm

You can change the DHCP route distance in the DHCP client.

You then need to add a static route for the PPTP endpoint over the WAN ethernet.

Then your PPTP default route will work.

Nick.
 
robinpecha
newbie
Topic Author
Posts: 39
Joined: Mon May 10, 2010 12:36 pm

Re: How to route all traffic to tunnel (pptp,eoip,ipsec,...)

Thu Aug 22, 2013 6:30 pm

Ill try (again), wait a minute pls.
 
robinpecha
newbie
Topic Author
Posts: 39
Joined: Mon May 10, 2010 12:36 pm

Re: How to route all traffic to tunnel (pptp,eoip,ipsec,...)

Thu Aug 22, 2013 6:36 pm

SOLVED
I have tried this config before of course. But I did mistake.
My earlier static route point to ip of pptp end. It must be directed to public ip of pptp server. My fault.

Who is online

Users browsing this forum: davordaco86, jaclaz, Majestic-12 [Bot], markinhusxp, PLJ020 and 192 guests